Skip to content

v0.16.0

Compare
Choose a tag to compare
@bcamper bcamper released this 26 Nov 04:25
· 311 commits to master since this release

Build Changes

  • This release has a major change in Tangram's distribution files, adding a new ES module build which is now the preferred way of loading Tangram for current browsers (in practice, almost any browser in widespread use besides IE11). This build is loaded via a <script type="module"> tag, and because all browsers that support ES modules also support the most commonly used ES6+ features, includes minimal JS code transpiling. This leads to smaller bundle sizes and faster loading, with less code for the browser to download and parse.
    • The ES module build is published with new tangram.min.mjs and tangram.debug.mjs files, following the JS community and Node.js practice of using the .mjs file extension to distinguish ES modules from CommonJS modules. This minified/zipped build is 154k.
    • A fully transpiled ES5 build is still available, under the existing tangram.min.js and tangram.debug.js files. This minified/zipped build is 170k.
    • You can use this snippet to automatically load the best build for your browser, using the module/nomodule pattern:
    <!-- modern browsers load the optimized .mjs file, older browsers (IE11) load the transpiled .js file -->
    <script type="module" src="https://unpkg.com/tangram/dist/tangram.min.mjs"></script>
    <script nomodule src="https://unpkg.com/tangram/dist/tangram.min.js"></script>
    • See #677 (though note PR now has outdated file names and build tooling info).
  • This release also switches the build process to use Rollup, which is the leading bundler for libraries (and used by React, Vue, D3, etc.). #681
  • Related build tooling changes: upgrading to Babel 7 with preset-env and "auto-polyfilling" by usage, and Terser for minification.

New Features

  • Data sources can specify custom HTTP request headers with the request_headers property #670
    • For example, including an OAuth bearer token:
    sources:
        tiles:
            type: TopoJSON
            url: ...
            request_headers:
                Authorization: Bearer XXXXXX
    
  • Add $source, $layer, $geometry, and $visible properties to queryFeatures() #676
    • Allows for more advanced introspection of data source features; example, querying a breakdown of features by their data source layer, geometry type, and visibility status:
      scene.queryFeatures({ group_by: ['$layer', '$geometry', '$visible'] })
      45778131-c897bf00-bc25-11e8-8ad0-1dc7c51d246b
  • Scene background color can be zoom-interpolated #682
  • Tile coordinates and bounds are now available in data source transform functions #675

Bug Fixes

  • Fix "sticky" global property bug when updating scene.config via JS #683
  • Fix race condition leading to intermittent missing labels, usually on simple scenes (often observed in Differ tests) #646 6972e57...c29a7cb
  • Fix shader uniforms that are arrays of vectors 1b2cec8
    • Example:
    shaders:
      uniforms:
        u_colors:
          - [0.5, 0.5, 0.5] # gray
          - [1, 0, 0] # red
          - [1, 0, 1] # purple
    

Improvements (Optimizations & Internal)

  • Cache user-defined JS functions, to improve scene load performance #684
    • On Mapzen/Nextzen styles, the reduction in number of functions compiled is anywhere from 40% (on Bubble Wrap) to almost 300% (on Walkabout)
  • If scene animation flag is true, still skip continuous rendering if no animated styles are visible, to improve rendering performance 7c5c799
  • Simplify GLSL uniform injection c1373c0
  • Remove unused shader files 0072252
  • Clarify log messages re: missing sprite definitions, and downgrade to debug level (this is a valid technique for scene authoring) fb3fa62