v0.16.0
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
andtangram.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
andtangram.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).
- The ES module build is published with new
- 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 toqueryFeatures()
#676 - Scene background color can be zoom-interpolated #682
- Matches recently added functionality for Tangram ES tangrams/tangram-es#1885
- Tile coordinates and bounds are now available in data source
transform
functions #675
Bug Fixes
- Fix "sticky"
global
property bug when updatingscene.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 istrue
, 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