Releases: tangrams/tangram
v0.9.0
Enhancements
-
Scenes can be loaded from .zip-file bundles (#358)
- Allows all scene resources (imported scene YAMLs, images, and fonts) to be consolidated into one package for easier distribution and decreased network overhead.
- Zip bundles must contain a single scene YAML file at the top-level directory, to act as the "root scene".
-
Improved handling of points w/attached text labels:
- Will only render by default if both the text and point pass collision (#349).
- Text can be made optional with
optional
flag, allowing point to render with or without text, as collision allows:
- Text can be made optional with
draw: points: ... text: optional: true ...
- Multiple anchor placement candidates for substantial increase in the number of labels placed (#351).
anchor
can accept an array of possible placements, evaluated in priority order.- Default is now:
anchor: [bottom, top, right, left]
- Example of all anchor candidates for maximum label placement (speed/# of labels trade-off):
anchor: [bottom, top, right, left, bottom-right, bottom-left, top-right, top-left]
- Attached text and point objects will not collide with each other (enables rendering of highway shields and similar symbols).
- Will only render by default if both the text and point pass collision (#349).
-
Incremental tile build (#367)
- Polygon and line features will display more quickly, while label rendering and collision for point and text features completes in the background.
- Labels for new tile areas will fade-in to provide a gentler transition (note, not all labels are faded in, such as higher zoom tiles when replacing lower zooms, to avoid label "flicker" from rapid fade out/in).
-
Improved proxy tile behavior for lines
- Adjust line width based on zoom level, to prevent proxied lines from being either too small or too big.
Bug Fixes
- Scene global properties can be set to "false-y" values such as
null
. - Fix map size initialization issue between Leaflet + Tangram, avoiding initial single-tile render.
- Fix scaling of camera
vanishing_point
(#372). - Fix behavior when
0px
text stroke is specified (#370). - Add
try/catch
and error message for function-basedfilters
(#364).
Internal
- Fonts: use native FontFace API when available to load fonts
- Add debug drawing options for text label collision and texture boxes.
v0.8.2
Enhancements
- Support
visible
property fortext
nested underpoints
- Support
visible
property foroutline
block (underlines
) - Trigger
scene_import
event when a sceneimport
fails to load (#340)
Bug Fixes
- Re-initialize web workers when data source custom scripts change (#346)
Internal
- Remove cache busting URL params (unnecessary and resolves issues with some data sources) (#343)
- Force GL context loss on scene destroy (avoids browser warnings when several GL contexts are created/destroyed in same browser session)
- Preparation to support multiple map instances (#350)
TileManager
,TilePyramid
,RenderState
, andVertexArrayObject
are now managed per scene/GL context.
v0.8.1
Bug Fixes
- Fix removing and re-adding a Tangram Leaflet layer (#280)
- Re-initialize Vertex Array Object extension and destroy old VAO bindings for new GL context (#329)
- Fix Leaflet 0.7.x issue where Tangram canvas could be removed from DOM on zoom
- Fix texture lifecycle management (dangling references on scene destroy and tile build cancel)
- Fix rendering of
points
withtext
rules missingfont
a property - Fix
priority
evaluation for text attached to a point (was being evaluated at lower priority than specified) - Fix
centroid
option for polygons rendered as points (was being ignored in 0.8.0) - Text
capitalize
transform should only modify first character of each word (and leave other characters unmodified) (#330) - Add small buffer to geojson-vt (fixes edge cases with dropped geometries) (see #333)
- Imported scenes can overwrite scalar properties w/object structures, such as in material definitions (see #339)
- Set polygon
min_height
to zero when single extrude value provided (matches ES behavior, avoids "inverted" buildings whenheight
is below feature'smin_height
property) (#337) - Skip polygons that couldn't be decoded from non-tiled sources (e.g. degenerate/zero area rings returned geojson-vt) (see #331)
Internal
- Restore inline source maps to debug builds.
- Load custom data source scripts before Tangram in workers, in an attempt to increase reliability of large script loads.
v0.8.0
New Features
- Unified point/text style (#306)
- Dashed line patterns (#312)
- Support for custom web fonts (#326)
- Feature selection:
- Generate polygon centroid label positions for non-tiled GeoJSON/TopoJSON sources (#302)
- Data source
scripts
should be relative to scene file (#315) - Default updateConfig() to
rebuild: true
option
Optimizations / Improvements
- Significant memory use reduction (15% to 50+%) from switch to GL element arrays ( #313)
- Significant speed-up (20% to 45%) for processing of complex filters (#322)
- New build process with live reload (#291)
- Better centroid calculation (proper geometric centroid instead of simple average)
- Optimize GL uniform setting (#298)
- Avoid redundant GL calls (for depth function + mask)
(2d59986, 7a506fd) - Remove unnecessary normalization of GL vertex attributes (#309)
- Cache some Canvas text operations (816b0ab, 84e7117)
Deprecations
- Remove ability to define textures via "inline objects" (simple URL-based textures can still be defined inline, more complex textures should be moved to the scene's top-level
textures
object) (18d7978) - Remove support for custom shader uniforms for GLSL
struct
's and arrays of vectors/struct
's. - Remove ability to create custom data layers by setting the
source:data:layer
property to a function (this can be done with the more generic data sourcetransform
property (4176ca6)
Bug Fixes
- Fix line width precision loss at high overzoom (#310, #267, #307)
- Leaflet: adapt scroll wheel behavior for Leaflet 1.0 rc1 (note: if continuous zoom is desired, please use Leaflet 1.0 rc1 or above!)
- Support sub-meter precision for height values (#318)
- Support single-feature TopoJSON sources (0a54d8d)
- Fix loading of data URL images in Safari (CORS bug workaround) (a38cd69)
- Fix intermittent failures when loading large scripts with data source
scripts
parameter (1b559f3)
v0.7.2
v0.7.1
v0.7.0
New Features & Enhancements
-
Scene imports
- Scene files can now import other scene files, with a new top-level
import
block. Each scene file can import one or more additional scene files (which can then in turn recursively import others). - Enables several use cases including:
- Overlays: import a basemap and add new layers
- Themes: import a basemap and modify color or style parameters
- File management: split large scenes into multiple files
- Common components: import spritesheets, shaders, etc. published by Mapzen or others
- The
import
statement works by deep-merging each imported scene into the current one. The "child" (imported) file is merged first, with the "parent" file merged after, overwriting any properties shared with the child. - Examples:
import: pois.yaml
(import a single file)import: [pois.yaml, roads.yaml, landuse.yaml]
(import multiple files)
- See #278 for more info and examples.
- Scene files can now import other scene files, with a new top-level
-
Global scene properties
- Adds global scene properties, user-defined properties in the scene file that can be substituted for values elsewhere in the file.
- Examples include common colors, language preferences, or visibility flags used to tweak styles.
- Similar to YAML's anchors & references, but with the added benefit that they can be updated at run-time, enabling features like an in-app language selector.
- Global properties are defined in the scene's top-level
global
block, and can be referenced as YAML property values or in JS function filters and properties withglobal.
syntax. Properties can also be nested and accessed with dot notation, e.g.global.group.property
. - Example:
global: colors: roads: red layers: roads: data: ... draw: lines: color: global.colors.roads # global property is substituted here width: 4px ...
- See #263 for more info and examples.
-
Raster tiles + normal maps
Raster
data sources to load raster tiles from a URL template- Built-in
raster
style to render raster tiles, either as a traditional basemap, or optionally masked against other polygon geometry Style
functionality for accessing one or moreRaster
data sources as texture samplers within shaders, enabling advanced effects (e.g. unpacking of custom encoded rasters, deriving surface normals from height maps, etc.)- Built-in support for applying raster samplers as normal maps (for terrain rendering).
- See #282 for more info and examples.
- Terrain rendering example with geometry masking, colored by landuse polygons:
-
Linear texture coordinates on lines
- Texture coordinates for line geometries are generated with a linear scale in relation to the line's width, enabling properly spaced line patterns. (Previously, texture coordinates ranged from 0-1 in the Y coordinate across the whole line, which did not provide any consistent means to scale a pattern.)
- When
texcoords: true
for anylines
-based style, the value ofv_texcoord.x
will range from 0-1 across the width of the line, and the value ofv_texcoord.y
will be a floating number where a unit of 1 covers the same distance as the line's width. - For example, setting
color.rgb = vec3(fract(v_texcoord.y));
creates a pattern of repeating greyscale gradient squares across the line: - The pattern's aspect ratio can be adjusted by dividing the
v_texcoord.y
, for examplefract(v_texcoord.y / 2.)
creates a pattern that is twice as long as it is wide:
-
Simplified event handling for feature click and hover
- New
hover
andclick
events simplify the process of setting up Tangram feature selection callbacks, removing the need for boilerplate code for DOM events. - For example, an
events
object with callback functions can be passed when initializing the layer:
var layer = Tangram.leafletLayer({ scene: 'scene.yaml', events: { hover: function(selection) { console.log('Hover!', selection); }, click: function(selection) { console.log('Click!', selection); } } };
- Selection event handlers will be passed the same
selection
object returned by direct calls toscene.getFeatureAt()
(which is still supported and available for custom input/event needs). - Selection events can be added, changed, or removed after layer creation with a call to
layer.setSelectionEvents(events)
. See #279 for more info and examples.
- New
-
The
Scene.setDataSource()
method returns a promise, to allow for chaining, e.g. to take a screenshot immediately after updating a data source.
Deprecations
- Generic scene
import
functionality from #278 allows us to deprecate two earlier attempts at modularity:- Remote
styles
imported viaurl
keyword (see example). - Remote shader
blocks
, referenced by URL (see example).
- Remote
- Layer-specific
properties
have been removed, in favor of global scene properties (added in #263). - Font
typeface
legacy syntax has been removed (it was replaced by more specific font face properties introduced in v0.4.0
Bug Fixes
- Fix "diamond" style mixin patterns, where a single source style is
mix
'ed into more than one of a target style's ancestors. For example: styleA
is mixed into stylesB
andC
withmix: A
, and styleD
includes both of those withmix: [B, C]
. In this case,A
should only be mixed intoD
once.
Internal
- The depth function is set to
GL_LESS
instead ofGL_LEQUAL
. This should not result in visual rendering changes, but can reduce overdraw.
v0.6.3
v0.6.2
v0.6.1
New Features
-
Feature selection:
- The names of the matching
layers
for each feature (fully qualified with.
notation) are now returned with the selection object, asselection.feature.layers
. See #274. Example:
scene.getFeatureAt(pixel).then(function(selection) { if (selection.feature) { console.log(selection.feature.layers); } }); => ["roads:major_road:trunk_primary:early", "roads:major_road:trunk_primary:routes:early", "roads:major_road:trunk_primary:labels-trunk_primary-z13"]
- Additional information about the tile a feature was built for is also now included, as
selection.feature.tile
. See 3e03353.
- The names of the matching
-
Shader blocks: the v0.6.0 shader block changes revealed compatibility issues with existing styles and limitations on procedurally generated textures and custom lighting setups. This logic has been revised so that the
color
andnormal
blocks are always executed, regardless of thelighting
mode. See #271.
Bug Fixes
- Fix incorrectly scaled max label repeat distance logic on overzoomed tiles, preventing some valid labels more than 256px apart from being placed.
- Fix regressions in tile cancelation logic that caused visual artifacts (missing tiles) and/or console errors in applications that modified the
scene.config
object programmatically and/or rapidly rebuilt the scene (withscene.updateConfig()
and/orscene.rebuild()
). (See Tangram explorer demo for an example.)