Skip to content

Releases: tangrams/tangram

v0.5.1

12 Feb 20:02
Compare
Choose a tag to compare

New Features

  • Support data sources with either clock-wise (CW) or counter-clock-wise (CCW) winding order. See #241.
    • Winding requirements are inconsistent across formats: GeoJSON has no formal requirement, while recent MVT spec versions mandate CW winding. For the greatest flexibility, we now detect the winding order and adapt to the data source (including allowing mixing data sources with different winding orders).
    • As part of this change, the enforce_winding parameter for data sources is deprecated; it is a no-op with the new behavior, so will cause no compatibility issues if present (it will simply be ignored).

Bug Fixes

  • Fix rendering issues for polygon outlines when using MVT data sources with buffered tiles. See #242.
    • When drawing polygon outlines, any line segments wholly outside the tile bounds are now discarded. Fixes issues on polygons extending into the buffer area.
    • Improves rendering of buffered tile sources such as Mapbox's. (Mapzen's MVT tiles are not buffered, but Mapbox's are.)
  • Query GL API for shader float precision
    • Fixes issue with devices not supporting highp float in fragment shader (reported as issue on Samsung S3 Mini).
  • Build line outline before the line fill
    • Ensures the outline geometry is placed in the VBO before the fill, which partially fixes an issue where outlines were not drawing properly with blend: overlay (the "outline" would render on top of the fill, making the entire line appear in the outline color).
    • Note: there is still an issue with order conflicts between outlines/fill when lines segments intersect/overlap each other. To address, all outlines should be consolidated underneath all fills, but this necessitates larger structural changes.

Internal

  • Peg all node module versions for more reliable build process and avoid unexpected regressions from automatic version upgrades.

v0.5.0

22 Jan 06:54
Compare
Choose a tag to compare

New Features

  • Sprite/point collision (so sprites and text labels don't overlap)
    • Extends the collision detection previously applied only to text labels so that it is also applied to features drawn with the point style (often sprites). priority is respected between these features to control which will be most likely to draw. (NB: Also fixes an issue where labels drawn with multiple styles derived from the text style would not collide with each other.) No new syntax is required, the behavior is automatically applied to points, though the collide: false parameter can be used to disable collision for points or text labels where desired. See #229.
  • Label text can be defined as a series of fallbacks
    • Enables support for a preferred label language, by adding the ability for text_source to be an array of possible sources of label text, in priority order. For example: text_source: [name:en, name] will display an English label (name:en) when available, and will fall back to the default local name when not available. See #235.
  • Dynamic (run-time) data sources
    • Adds a JS API, Scene.setDataSource (name, config) for creating or updating a data source at run-time. The data source can be provided either as aurl, or with direct data, such as by passing a GeoJSON object in the data field. See #227.
  • Dynamic (run-time) textures
    • Adds support for additional texture sources that can be created or updated at run-time.

    • img, canvas, and video DOM objects can be set directly on a texture with the element, or can be specified as CSS selectors, for example

      • HTML:
      <canvas class='awesome-texture'>
      
      • Scene YAML:
      textures:
         awesome-texture:
             element: .awesome-texture
      
    • Alternatively, raw RGBA byte data can be provided with data, width, and height parameters.

    • See #226.

  • Screenshot support and view_complete event
    • Adds a Scene.screenshot() method to assist in capturing the current map view. screenshot() returns a Promise that fulfills with url (a URL suitable for loading into an <img> or opening in a new tab/window) and blob (a Blob of type image/png, suitable for saving to a file). Note that actually saving the blob to disk is left to the user or 3rd party library such as FileSaver.js.
    • Example usage: scene.screenshot().then(function(result) { window.open(result.url); });
    • In addition, a scene event view_complete has been added. It fires when the view is in a "resting state", meaning new geometry is rendered, and no further tiles are loading/building. This is useful for detecting significant view changes, and can be paired with Scene.screenshot() to automate screenshots.
    • See #230.
  • Miter limit
    • Adds a miter_limit parameter to the lines style. Miter limits convert sharp miter joins to bevels when the miter join length is longer than the ratio of the miter_limit to the width of the line. See SVG miter limit for reference, and #231 for more info.
  • Filter line segments on any tile edge
    • Avoid artifacts in rare cases where very large features are clipped beyond the local tile area (The Highline in NYC is an example). See #237.

Bug Fixes

  • Fix modelPosition() y coordinate value range to be [0, 1] (rather than [0, -1]).
  • Fix handling of 2d values for point size.

v0.4.6

15 Jan 21:17
Compare
Choose a tag to compare

Bug Fixes

  • Apply basic packing of label texture atlas to keep texture within max GL size for the device. If atlas could not fit (should not happen or be very rare), an error is thrown and those labels will not be drawn. Fixes issue observed with Refill style at z20 on iPhone, where max texture size is 2048x2048.

v0.4.5

14 Jan 20:56
Compare
Choose a tag to compare

Maintenance release focused on optimization.

New Features

  • Add warnings for invalid layers & data sources.
  • Allow data sources to set a max_zoom higher than the overall Tangram default (currently 18).

Bug Fixes

  • Fix incorrect alpha for CSS-style colors.
  • Fix issue where visible layers weren't drawing if a non-visible layer also matched.
  • Guard against empty draw group definitions

Internal

  • Optimize style parsing and geometry build processes (~40% decrease in build time for complex scene of NYC z9).

v0.4.4

11 Dec 04:50
Compare
Choose a tag to compare

New Features + Style Syntax/API Changes

  • Adds minimum distance between similar labels, to reduce repeats.

    • Specify the minimum distance (in pixels) required between labels with repeat_distance. The default is 256px (the CSS pixel size of one tile). e.g. to make labels repeat more frequently than the default:
    draw:
      text:
         repeat_distance: 100px # label can repeat every 100 pixels
         ...
    
    • Specify the grouping mechanism by which labels are considered the "same" with the repeat_group parameter. By default, labels are grouped by the the set of layers (styling rules) that they match. For example, multiple road segments with different classifications (e.g. one matching a major_roads layer, one matching minor_roads layer) will be allowed to repeat even if they have the same label text, because they are placed into different repeat groups. If one wanted to place all roads into the same repeat group, that could be accomplished with repeat_group: roads-fewer-labels.
    • See #222.
  • Add blend_order to control render order of styles with non-opaque blending.

    • blend_order is an optional parameter used when defining a render style, which controls the order in which styles with non-opaque blending (add, multiply, inlay, overlay) are rendered.
    • For example, to create marker and icons styles that are drawn on top of the built-in styles:
    styles:
      marker:
         base: points
         blend: overlay
         blend_order: 1   # marker goes on top of icons and text
         ...
    
      icons:
         base: points
         blend: overlay
         blend_order: 0   # icons go on top of text, underneath marker
         ...
    
  • Add support for zoom interpolation (e.g. stops syntax) for the offset parameter applied to points (sprites) and text styles.

    • For example: offset: [[13, [0, 6px]], [15, [0, 9px]]]. This can be used in conjunction with anchor to position text and sprites adjacent to each other, even when the sprite's size is interpolating across zooms. (The preferred future solution to this is to offer a unified label style for sprite and text.)
  • Deterministically resolve conflicts between layers at the same depth that modify the same style properties. To resolve, layers are lexically sorted by name. As with deeper layers overwriting the properties of shallower layers, the last layer sorted by name will overwrite any earlier layers. e.g. layerB wins over layerA. See #225.

    layers:
      layerA:
         color: red
    
      layerB:
         color: blue   # feature will be blue because `layerB` sorts after `layerA`
    
  • Add text collide: false option to turn off collision (e.g. allow overlap) for text labels.

  • Fallback to Helvetica when all other fonts specified in family are unavailable.

  • When loading a scene with scene.load(), allow a full scene file URL to be passed as scene base path (previously only paths without the file itself were accepted; if a file URL is provided, the path will now be derived from it).

Bug Fixes

  • Remove Leaflet scroll wheel zoom modification that was interfering with zoom animations for Leaflet vector (SVG) layers.
  • Fix rare cases where Tangram canvas would not reposition relative to Leaflet container.

Internal

  • Track the layers that contributed to each final draw group (to aid future debugging and authoring tools).
  • Return to using round-robin assignment of workers, since random distribution didn't always seem very random :)

v0.4.3

25 Nov 21:39
Compare
Choose a tag to compare

Bug Fixes

  • Fix line label fitting logic, can result in significantly more line labels being placed
  • Fix sprite/label anchors on retina displays
  • Fix first frame render with un-initialized normal matrix (could result in brief render with incorrect lighting)
  • Handle features that have no geometry (a geometry: null is valid GeoJSON)
  • Additional error detail when layer fails to parse

Internal

  • Text style refactor

v0.4.2

14 Nov 22:25
Compare
Choose a tag to compare

Bug Fixes
Fixes regressions in line width handling introduced in v0.4.1.

v0.4.1

13 Nov 21:40
Compare
Choose a tag to compare

New Features + Style Syntax/API Changes

  • Zoom-based interpolation ("stops") for the following font properties:
    • Font size (specified in px, pt, or em)
    • fill color (partially worked previously, fixes bugs with using string colors)
    • Stroke width (specified in px)
    • Stroke color
    • Example (see #214 for more info):
draw:
  text:
    font:
      family: Helvetica
      fill: [[14, white], [18, gray]]
      size: [[14, 12px], [16, 16px], [20, 24px]]
      stroke:
        color: [[16, white], [18, red], [20, blue]] 
        width: [[14, 3px], [20, 8px]]
  • Add anchor positioning to points/sprites.
    • Uses the same anchor syntax as for point labels (left, bottom-right, etc.).
    • Unlike with labels, the align keyword is not needed.
    • See #213 for more info.
  • Add vec3 worldNormal() accessor in shaders, to complement modelPosition() and worldPosition() functions. Provides compatibility with Tangram ES. See #209.
  • Transparency (alpha) values are now supported in text rendering (e.g. font fill and stroke color will now parse alpha values).
  • If an explicit size is not specified for a sprite, it defaults to the sprite's pixel size.
  • Draw lines that have zero width at the current zoom but will scale up to have a positive width at the next zoom; causes lines to ease/scale in rather than popping in when the tile zoom changes.
  • When device pixel ratio changes, for example when switching from an external to built-in display, the map resolution is updated to match. See #211.

Bug Fixes

  • When an array is used as a layer filter, it is implicitly treated as an any filter.
    • To illustrate, the following are equivalent:
      • filter: [ kind: minor_road, railway: true ]
      • filter: { any: [ kind: minor_road, railway: true ] }
    • Fixes discrepancy with docs and Tangram ES.
  • Fix comparison of data sources updated at run-time. See #215.
  • GLSL global initializers must be constant. Not enforced on most devices, but fixes shader compilation errors on some (observed on Samsung Galaxy Note Edge). See #212.
  • Support multipolygon decoding for MTV tiles. See #217.
  • Don't render lines with negative or NaN width.
  • Don't load tiles outside expected coordinates for current zoom (e.g. negative tile coords).

Internal

  • Convert all JS properties/filters NaN return values to null (NaN is unpredictable when used as a binary value for typed arrays / GL VBOs).

v0.4.0

02 Nov 22:30
Compare
Choose a tag to compare

New Features + Style Syntax/API Changes

  • Multi-line labels: line wrapping of labels, controlled by text_wrap and align properties in text-based styles. By default, wrapping is enabled for point labels, and disabled for line labels. See #205 for more info.
    • Wrapping
      • text_wrap: true uses default wrapping (15 characters).
      • text_wrap: 10 sets a maximum line length of 10 characters.
      • text_wrap: false disables wrapping.
      • Explicit line breaks (\n chars) will cause a line break (even if text_wrap is disabled).
    • Alignment of text for multi-line labels can be controlled with align, with one of:
      • center (default)
      • left justified
      • right justified
      • Alignment has no effect for single-line labels.
  • Label anchors: point labels can be anchored relative to their point location. See #182 for more info.
    • anchor can be set to: center (default), top, bottom, left, right, top-left, top-right, bottom-left, bottom-right
    • Text alignment is also defaulted (if not explicitly set with align) to match the anchor type:
      • anchor: center | top | bottom => defaults align: center
      • anchor: left | top-left | bottom-left => defaults align: right
      • anchor: right | top-right | bottom-right => defaults align: left
    • JS-only option to move the label into the tile is now exposed as style property move_into_tile (defaults true to match previous behavior, but should be set to false if using anchor/align functionality for text + icon combinations, otherwise, text can get out of sync with expected position).
  • Transparent backgrounds: adds alpha to the Tangram GL canvas, which allows for Leaflet layers (or other HTML content) to be placed beneath the map, in addition to on top of it. See #202 for more info. Examples:
    • Default is transparent background, equivalent to:
      • scene: { background: { color: transparent } }
    • To allow background to show through with 50% opacity:
      • scene: { background: { color: [0, 0, 0, .5] } }
  • Shader position accessors: vec4 modelPosition() and vec4 worldPosition() accessors should be used in lieu of directly accessing attribute a_position and varying v_world_position.
    • modelPosition() provides vertex position within its tile (model) space, where [0, 1] is the scale of the tile on x & y axes. Unclipped geometries can contain values outside [0, 1] range, as can z coordinates which have the same scale, e.g. a height of 1 corresponds to the length of the tile in x and y.
    • worldPosition() provides vertex position in world space (web mercator meters), with wrapping (configurable via TANGRAM_WORLD_POSITION_WRAP) applied to avoid float precision issues at higher zooms.
    • This change avoids styles that depend on implementation details (such as position packed as a short integer) which are subject to change and which diverge between JS and ES. The new accessors provided a common interface to these properties. See #197.
  • Browserify/bundle compatibility: Tangram can be loaded outside of a bundled JS file. Due to lingering issues around web worker instantiation, Tangram still cannot (yet) be used as a a browserify module itself (except through browserify-shim), however dependencies such as Leaflet can now be bundled separately. See #208 for more info.

Breaking Changes

  • Due to new GL canvas position in DOM (to support transparency), event listeners that were previously attached to scene.container should now be attached to map.getContainer() (where map is the Leaflet map object). See the included demo here and here for an example. JS used for hover/click feature interactivity (for features marked interactive) are affected by this change and should be updated.

Bug Fixes

  • Style mixing: support "diamond" mixin patterns for more complex style composition, e.g.:
    • B mixes A
    • C mixes A
    • D mixes [B, C]
    • D should end up with only one copy of A's shader blocks
  • Shader uniform "inheritance": at run-time, style-specific uniforms will use the value explicitly defined for that style if present, otherwise will forward to the appropriate ancestor style from which it was mixed in. Allows uniform values to be changed at run-time and properly cascade one or more levels to descendant styles.
  • Polygon extrusion: don't extrude polygon edges along tile boundaries by default. These were usually invisible due to being "interior walls" in buildings, but are not desirable and produce artifacts when alpha blending is used.
  • Leaflet: fix ability for Leaflet scroll wheel zoom to be enabled/disabled at run-time.
  • Style materials: fix support for texture objects embedded in material properties, e.g. material: diffuse: texture: { url: ..., filtering: mipmap }
  • Style mixing: fix mixing of blend, null values would cause opaque default to be used, instead of falling back on base style via prototype.
  • Textures: add URL cache buster for textures.
  • Tile data: clear worker tile cache when data source config changes (sources with custom data transforms were not refreshing properly when config was updated).
  • Leaflet: when tile build finishes, only update tile list via tile manager internally; calling scene update was interfering with Leaflet animations such as flyTo().
  • Style layer rules: expose $layer property for JS filters/properties.
  • Feature selection: fix feature selection change flag (did not always register a change).
  • Resolves all remaining known issues with "dirty" text halos.

Internal

  • To support transparent backgrounds, the GL canvas is now inserted in the correct location in the Leaflet DOM (previously it was pulled out of the DOM to make positioning simpler, and because without alpha it often got covered by other layers).
  • Clean up shaders by moving attribute unpacking into macros.
  • Worker broker: remove neutered transferables from parent objects (these should not be accessed after transfer).
  • Move Canvas text layout and rasterization to own file.
  • Upgrade Babel (4.7.8 -> 5.8.29), and use runtime option (rather than polyfill) for both library and test builds.

v0.3.3

08 Oct 12:53
Compare
Choose a tag to compare
  • Modifications to scroll-wheel zoom behavior to fix issues with animated styles in Chrome
  • Make u_device_pixel_ratio uniform available in the points vertex shader
  • Fix alpha for points drawn with blend: inlay
  • Fix issue where px units caused parsing error with text stroke width
  • Fix issues with hyphens in style names
  • Fix issues with style trying to mix into itself