Releases: tangrams/tangram
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.)
v0.6.0
Summary
This release focuses on one major new feature -- proxy tiles for better visual continuity and much improved general UX -- along with significant improvements to bundle size and geometry build speed. A few smaller features and several bug fixes are also included.
Bundle size: gzipped minified library size reduced by 35k (from 140k to 115k).
Geometry build time was predominantly reduced for dense mid-zooms, e.g. in the NYC region using a complex scene file:
- z9: 29% faster
- z11: 19% faster
New Features
- "Proxy" tiles: while new tiles are loading, previously loaded tiles from higher or lower zooms will be shown in their place, providing more visual continuity and reducing "breaks" or "flashes" between tile zooms. See #250.
- Data sources can append custom URL parameters, for easier customization (e.g. API keys, search keywords, etc.). See #204.
- JS function-based
color
parameters can return CSS colors, e.g.color: function() { return (feature.alert && 'red') || 'grey'; }
is now valid (previously color functions were required to return an RGB(A) array). Useful for using OSMcolour
tags to set feature colors, for example on transit lines. - More helpful default values for point lights. See #238.
Bug Fixes
- Remove duplicate consecutive points during line building, removing "fat arrow" artifacts caused by degenerate lines. See #264.
- Scale
modelPosition()
to account for tile overzooming, fixes incorrectly scaled shader patterns. See #266. - Clarify handling of lighting-related shader blocks for
vertex
andfalse
lighting modes. See #265. - Skip degenerate rings when decoding flattened polygon rings in MTV tiles.
- Fix alpha handling when rendering plain
points
(no sprite set). - Only build tile style VBO when it has geometry, fixes warnings for zero-geometry draw calls on some GPUs.
Internal
- Optimize the message-passing pipeline between main thread and worker threads. See #262.
- Optimize line builders, avoid extra computations for special cases or when certain style settings aren't active. See #232.
- Build the library without YAML write support, to reduce bundle size. See #261.
- Build the library with just the necessary subset of gl-matrix functions, to reduce bundle size.
- Extract view-related behavior from
Scene
toView
, and clarify matrix ownership between tile, camera, and view. - Reduce default tile padding to remove artifacts on highly overzoomed tiles.
- Don't create filter functions for layers without a filter (was previously creating no-op
return true
functions). - More robust tile cancelation, avoid further build computation when tile is no longer needed.
- Git commit sha that library was built with is now included in debug info