Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mapbox/mapbox-gl-js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.9.2
Choose a base ref
...
head repository: mapbox/mapbox-gl-js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.10.0
Choose a head ref

Commits on May 12, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    128e82b View commit details

Commits on May 16, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    8d4417b View commit details
  2. Adding test for globe marker rotation (#11890)

    * Fix ignoring marker rotation for map-aligned markers on globe
    
    * Adding test for globe marker rotation
    SnailBones authored May 16, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    f294c74 View commit details

Commits on May 17, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    b51ea41 View commit details
  2. Add support for unit in NumberFormat (#11839)

    * Add support for `unit` in `NumberFormat`
    
    * Add test for `unit` in `NumberFormat`
    
    * Update docs for `unit` NumberFormat
    varna authored May 17, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    3228854 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    e114f26 View commit details

Commits on May 18, 2022

  1. Add filter features within map view with globe release test (#11888)

    * add filter features within map view with globe release test
    avpeery authored May 18, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    facf404 View commit details
  2. Adding rotationAlignment: 'horizon' for markers on globe (#11894)

    Co-authored-by: Karim Naaji <karim.naaji@gmail.com>
    SnailBones and karimnaaji authored May 18, 2022

    Partially verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
    Copy the full SHA
    2ad1134 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    844766c View commit details

Commits on May 20, 2022

  1. ScaleControl: add i18n support (#11850)

    * ScaleControl: add i18n support
    
    * hardcode nautical miles as `nm` for all locales
    stepankuzmin authored May 20, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    88fcbc9 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    119227f View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c0e0f56 View commit details

Commits on May 31, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9ac6e6d View commit details
  2. Fix potential flickering on image source updates (#11928)

    * Fix flickering of image source on reload
    
    * Add unit tests
    karimnaaji authored May 31, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    178789b View commit details
  3. Fix setStyle breaking with globe view (#11913)

    * set draping for terrain
    
    * use map option for terrain draping check
    
    * move to one line
    
    * wip: add render test
    
    * fixed error with render test
    
    * demonstrate issue with mercator
    
    * fix background id to update in second setStyle call
    
    * bring zoom out to show sphere
    
    * Updating expected.png
    
    * better readability
    
    * fix conditional
    
    * fix lint
    
    Co-authored-by: Aidan H <aidan.hendrickson@mapbox.com>
    avpeery and SnailBones authored May 31, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    e6d9c44 View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4ddb42b View commit details
  5. Add video to globe release tests (#11929)

    * add ozone video on globe to release tests
    
    * formatting
    
    * formatting
    
    * fix lint issues
    
    * simplify play/pause button
    
    * added atmosphere
    avpeery authored May 31, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    22e322b View commit details
  6. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    2ea9b76 View commit details
  7. Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    b573850 View commit details

Commits on Jun 3, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    e9b7c0e View commit details

Commits on Jun 4, 2022

  1. Clone stylesheet to allow toggling different styles with setStyle (#…

    …11942)
    
    * clone stylesheet instead of manipulating it directly
    
    * style should not contain terrain since it is no longer being overwritten
    
    * add unit test
    
    * add in default values for terrain when updating
    
    * Add test for projections
    
    * unit test for terrain exaggeration does not need sources
    
    * should have two calls to setStyle to fully test toggling
    
    * default value does not need to be added if previous terrain style also used the default value
    
    * hasOwnProperty is already a boolean
    
    * no need to check currSpec because checks for deep equals and 1 is already set for default
    
    * fix unit tests
    
    * fix style setting in unit test
    
    * accidental deletion
    
    * switch to deep clone from extend
    
    * better way to find default value
    
    * use hasOwnProperty instead
    
    * convert to false from undefined
    
    * create reusable function for setting transition parameters
    
    * update _setTransitionParameters
    
    * mix up between duraton/delay values
    
    * reduce repetitive code to update style spec and transitions between terrain and fog
    
    * revert change
    avpeery authored Jun 4, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    285b5f7 View commit details

Commits on Jun 7, 2022

  1. minimize scale changes when panning in globe view (#11951)

    * adjust scale at low zoom levels in globe view
    
    * improve
    
    * Adding render test catching missing tiles with minzoom
    
    * Allowing lower zoom level tiles toward the poles
    
    * Fix lint
    
    * Updating render tests to pass
    
    * Updating tolerances to fix failing tests
    
    * Updating one more tolerance
    
    * Fixing query tests
    
    * use GLOBE_ZOOM_THRESHOLD_MIN
    
    * rename to mercatorScaleRatio
    
    * add comment about matching scale
    
    * avoid recentering on terrain if rendering globe
    
    * update unit tests
    
    * lint
    
    Co-authored-by: Aidan H <aidan.hendrickson@mapbox.com>
    ansis and SnailBones authored Jun 7, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    3424632 View commit details
  2. Do not set the map language to the user's preferred language by defau…

    …lt (#11952)
    
    * Do not set the map language to the user's preferred language by default
    
    * fix unit test
    
    * cleanup
    
    * cleanup
    
    * fix worldview setter
    stepankuzmin authored Jun 7, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    dmathieu Damien Mathieu
    Copy the full SHA
    b456388 View commit details

Commits on Jun 8, 2022

  1. As per #11944 (#11950)

    karimnaaji authored Jun 8, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    970f259 View commit details
  2. Reload tiles after TileJSON is loaded in VectorTileSource#setSourcePr…

    …operty (#11963)
    
    * Reload tiles after TileJSON is loaded in setSourceProperty
    
    * add more i18n tests
    
    * drop the language validation
    
    * mark i18n API as private
    stepankuzmin authored Jun 8, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    pellared Robert Pająk
    Copy the full SHA
    41c4f71 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    bb3bed2 View commit details

Commits on Jun 9, 2022

  1. Disable custom anti-aliasing when terrain exaggeration is > 0 (#11977)

    * Disable custom anti-aliasing when terrain exaggeration is > 0
    
    * Fix flow
    karimnaaji authored Jun 9, 2022
    Copy the full SHA
    af9d108 View commit details

Commits on Jun 13, 2022

  1. Copy the full SHA
    debb666 View commit details
  2. Add render tests for validating fog parameters on style change (#11990)

    * Add render tests for validating fog parameters on style change
    
    * update ignores.json
    mpulkki-mapbox authored Jun 13, 2022
    Copy the full SHA
    83881c4 View commit details

Commits on Jun 15, 2022

  1. Copy the full SHA
    c8a291b View commit details
  2. Fix symbols not rendering on globe after style change (#11999)

    * Broadcast setProjection event on all style changes
    
    * Adding render test
    
    * Apply updates before triggering new frame
    SnailBones authored Jun 15, 2022
    Copy the full SHA
    b1c54af View commit details

Commits on Jun 16, 2022

  1. Fix precision errors in pack/unpack depth (#12005)

    Current code is introducing precision errors in the pack/unpack depth functions by not using the correct range of values. When the packed_depth is written to R8G8B8A8 texture the maximum value it can store is 255 per channel, not 256. We were introducing errors in the third decimal in a range from 0..1. Seems this code was also wrong in three.js and other libraries, hence the confusion. Coded a godbolt to prove the issue (https://godbolt.org/z/8MrrhPh11).
    
    This fix also helps in gl-native terrain occlusion and shadow rendering, as otherwise artifacts are visible
    jtorresfabra authored Jun 16, 2022
    Copy the full SHA
    f49831e View commit details
  2. Add extra constrain to avoid unnecessary line shader calculations if …

    …'line-trim-offset' is not set (#12004)
    
    * Add extra constrains for the line-trim-offset calculation in shader
    
    * rename the macro and add the macro value when line-trim-offset is enabled
    
    * fix lint issue
    
    * Fix preprocess preconditions
    zmiao authored Jun 16, 2022
    Copy the full SHA
    8e66136 View commit details
  3. Doc changes for globe view (#12002)

    * Add globe to map.options
    
    * Update fog example to include all new properties
    
    * Update style spec to reflect new limitations
    
    * Update src/ui/map.js
    
    Co-authored-by: Aidan H <aidan.hendrickson@mapbox.com>
    
    * Update src/ui/map.js
    
    Co-authored-by: Aidan H <aidan.hendrickson@mapbox.com>
    
    * Update src/style-spec/reference/v8.json
    
    Co-authored-by: Aidan H <aidan.hendrickson@mapbox.com>
    
    * Update projection link
    
    Co-authored-by: Aidan H <aidan.hendrickson@mapbox.com>
    avpeery and SnailBones authored Jun 16, 2022
    Copy the full SHA
    4d051bc View commit details
  4. Relaxed behavior for unsupported globe APIs (#12008)

    * Relaxed unsupported globe APIs to prevent some plugin from being unusable
    
    Fixup
    
    * Update error message
    karimnaaji authored Jun 16, 2022
    Copy the full SHA
    19ec68b View commit details

Commits on Jun 17, 2022

  1. Prevent flickering of symbols during globe mercator transition (#11957)

    * Prevent flickering of symbols during globe mercator transition
    
    * Fixup
    
    * Simplify extraneous statement
    
    * Fix placement of mixed symbol tiles into the collision index
    
    * Revert debug changes
    
    * Better variable name + fix flow
    
    * Refactor and cleanups
    
    * Ensure correct tile matrix with assert and fix order of operation when
    updating the projection for placement and collision index tile matrix
    
    * Add some documentation to `pixelSpaceConversion`
    
    * Fix bad merge
    karimnaaji authored Jun 17, 2022
    Copy the full SHA
    6c69aec View commit details
  2. Fix geolocate control on globe (#12009)

    * Fix geolocate control with Globe View
    
    * Combine examples
    
    * Add unit test
    karimnaaji authored Jun 17, 2022
    Copy the full SHA
    f34b72f View commit details
  3. Fix setting fog default values when calling setStyle (#11992)

    * fix using default params with fog
    
    * Fix flow issue
    
    * remove default values checks from fog.js
    
    * remove checking old style spec to take default
    
    * fixed typos
    
    * no longer takes in old style spec in fog.set
    
    * add unit test
    
    * should pass render test
    
    * fix skip accidentally added render test
    
    * unwanted deletion from ignores.json
    
    * fix render test pass, and allowing default values to pass when using map.setFog({})
    
    * fix flow and lint issues
    
    * fix some broken tests
    
    * conditional order importance
    
    * check in diff not working
    
    * working locally render test should pass
    
    * this functionality of using previous style without removing fog needs refactoring - not yet supported in gl js
    
    * added wait operation for render test to pass
    
    * should pass test
    
    * adding render test, expected.png not generating
    
    * typos, but still can't generate image
    
    * fix test, add expected.png
    
    * add allowed
    avpeery authored Jun 17, 2022
    Copy the full SHA
    8d36a15 View commit details
  4. Refactor circle and heatmap layer rendering on globe (#11931)

    * Fix circle layer scale and alignment properties on globe
    
    * Update render test baselines
    
    * Skip query test for now
    
    Co-authored-by: Karim Naaji <karim.naaji@gmail.com>
    mpulkki-mapbox and karimnaaji authored Jun 17, 2022
    Copy the full SHA
    6426367 View commit details

Commits on Jun 20, 2022

  1. Copy the full SHA
    18f1fe3 View commit details
  2. fix line-trim-offset shader (#12017)

    * fix line-trim-offset shader
    
    * fix line-trim-offset check
    stepankuzmin authored Jun 20, 2022
    Copy the full SHA
    b8b4e8a View commit details
  3. Copy the full SHA
    e65f1f9 View commit details
  4. Fill extrusion ambient occlusion (#11926)

    * Faux ambient occlusion specialized for buildings
    
    Styleable layout property fill-extrusion-faux-ao (boolean). Implementation in shaders done under #ifdef FAUX_AO not to affect other use cases.
    
    This is a low cost approach that potentially combined with line-blur (TODO: line-blur artefacts issue #10000) provides plausible results, somewhat reminding of ambient occlusion.
    
    The approach shades vertical walls vertically near ground and horizontally near concave angles. In contrast to vertical-gradient that's linearly interpolated in fragment shader, exponential shading is exponential
    Implementation is specialized for scale of buildings. Open for later introduction of data constant paint property fill-extrusion-faux-ao-radius (in meters). E.g. defgault value of 3 would correspond to this implementation. Arguably, data visualizations on globe zoom levels benefit more from vertical-gradient that is linearly interpolated from ground to top than from this since in most of use cases there are no concave angles.
    
    Setting the property also activates an improvement for #3324 - z-fighting artefacts are especially noticeable on buildings. This improvement could be promoted to all the cases later. As it would take time to re-evaluate if the fix is acceptable for all the cases, it is enabled in shaders under #ifdef FAUX_AO. The appropach is based on common z-fighting culprits coming from overlapping fill extrusion walls that have different height and different base. In such case, higher planes and those with higher base (since often height is the same) are brought forward.
    
    * AO: Replace faux-ao layout boolean by intensity and radius paint properties
    
    Instead of fill-extrusion-faux-ao layout constant property, 2 paint properties are introduced:
    - fill-extrusion-ambient-occlusion-intensity, in range [0..1]
    - fill-extrusion-ambient-occlusion-radius, in meter units, values larger than 0.
    
    Reasons:
    - is it too early top specify layout property that would be use as a hard switch of the feature. In future, we might have multiple types of AO (server side included) where type of AO would be used, not a boolean property.
    - separate properties intensity and radius are needed for globe zoom level visualization and those properties are expected when modelling AO, e.g. similar is found in Blender.
    
    * Fill extrusion z fighting render test, fill extrusion pattern support for AO
    
    With ambient occlusion intensity of 0.001, expected result is the same as with no ambient occlusion, but with z fighting fixed.
    
    * Render tests, process review comments.
    
    Shaders: removed sqrt and mix-es that are using constants
    
    Thanks @karimnaaji
    
    * Process review comments. Render tests for small angles
    
    * Link to documentation in shader code.
    
    Processing the latest comments and rebase.
    astojilj authored Jun 20, 2022
    Copy the full SHA
    6348a20 View commit details

Commits on Jun 21, 2022

  1. flat-roof-ao render test transition duration set to 0 (#12022)

    In gl-native, this render test is flaky/incorrect as it transitions to light set in the operation. Transition set to 0 makes is transition to new light in gl js and the same behavior as in gl-native
    astojilj authored Jun 21, 2022
    Copy the full SHA
    aaa4ee5 View commit details
  2. Refactoring globe tile position calculation (#11987)

    * Refactoring globe tile code
    
    * Small verbacity improvement
    
    * Undoing logic change to scale in calculateGlobeMercatorMatrix
    
    * Update src/geo/projection/globe_util.js
    
    Co-authored-by: Karim Naaji <karim.naaji@gmail.com>
    
    * Changing tileScale to tileCount
    
    Co-authored-by: Karim Naaji <karim.naaji@gmail.com>
    SnailBones and karimnaaji authored Jun 21, 2022
    Copy the full SHA
    aac1eac View commit details

Commits on Jun 22, 2022

  1. Add shadow rendering to shaders (#11985)

    * Shadow rendering shader changes
    
    - Receive shadows on fill extrusions
    - Shadow rendering with terrain
    
    * Fix various issues with shadow shaders
    
    - Fix fill extrusion apply fog
    - Remove duplicate shadow prelude
    - Remove unused uniform in terrain_raster
    - Reorganize shadow shader code and fix metal rendering
    - Move unpack_depth to general prelude.fragment
    - Fix shadow prelude
    - Fixes for OpenGL
    
    * Address review comments
    
    * Address review comments and other fixes
    
    - Allow use of pack_depth in all fragment shaders
    - Rename fill_extrusion_shadow to fill_extrusion_depth
    - Don't use mix() in shadow prelude
    - Don't process shadow specific shaders
    - Don't inset fill extrusions into the ground for shadow map
    - Remove bias from shadows without normals
    
    * Address review comments
    
    - Removed min() call from shadow pos.z
    - Added early exit to shadowed_color_normal()
    - Added comment about the shadow sampling method
    
    Co-authored-by: Mikko Pulkki <mikko.pulkki@mapbox.com>
    
    * Add highp precision for unpack_depth function
    
    * Revert earlier change, as further testing revealed an issue
    
    Co-authored-by: Mikko Pulkki <mikko.pulkki@mapbox.com>
    Co-authored-by: Jordi Torres <jtorresfabra@gmail.com>
    3 people authored Jun 22, 2022
    Copy the full SHA
    5a0b7d7 View commit details
  2. Copy the full SHA
    80e5afd View commit details

Commits on Jun 23, 2022

  1. Copy the full SHA
    283442c View commit details

Commits on Jun 29, 2022

  1. Optimize tile calculations for globe (#12050)

    * eliminate matrix allocation in aabbForTileOnGlobe
    
    * less array allocations in aabbForTileOnGlobe
    
    * simplify globeECEFNormalizationScale
    
    * less globe matrix allocations
    mourner authored Jun 29, 2022
    Copy the full SHA
    147c385 View commit details

Commits on Jun 30, 2022

  1. Copy the full SHA
    fb857af View commit details
Showing 394 changed files with 6,508 additions and 2,053 deletions.
58 changes: 57 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,77 @@
## 2.10.0

## Features ✨ and improvements 🏁
* Add new marker styling option rotationAlignment: 'horizon' allowing marker rotation to match the curvature of the horizon in globe view ([#11894](https://github.com/mapbox/mapbox-gl-js/pull/11894))
* Improve panning precision on Globe View and relax constraints on lower zoom levels ([#12114](https://github.com/mapbox/mapbox-gl-js/pull/12114))
* Add unit option to number-format expression ([#11839](https://github.com/mapbox/mapbox-gl-js/pull/11839)) (h/t [varna](https://github.com/varna))
* Add screen reader alert for cooperative gestures warning message. ([#12058](https://github.com/mapbox/mapbox-gl-js/pull/12058))
* Improve rendering performance on globe view ([#12050](https://github.com/mapbox/mapbox-gl-js/pull/12050))
* Improve tile loading performance on low zoom levels ([#12061](https://github.com/mapbox/mapbox-gl-js/pull/12061))
* Improve globe-mercator transition and map load performance with globe projection ([#12039](https://github.com/mapbox/mapbox-gl-js/pull/12039))


## Bug fixes 🐞
* Fix a bug where `id` expression didn't correctly handle a value of 0 ([#12000](https://github.com/mapbox/mapbox-gl-js/pull/12000))
* Fix precision errors in depth pack/unpack ([#12005](https://github.com/mapbox/mapbox-gl-js/pull/12005))
* Fix `cooperativeGestures` preventing panning on mobile while in fullscreen. ([#12058](https://github.com/mapbox/mapbox-gl-js/pull/12058))
* Fix misplaced raster tiles after toggling `setStyle` with a globe projection ([#12049](https://github.com/mapbox/mapbox-gl-js/pull/12049))
* Fix exception on creating map in an iframe with sandbox attribute. ([#12101](https://github.com/mapbox/mapbox-gl-js/pull/12101))
* Fix "improve map" link in the attribution to include location even if map hash is disabled ([#12122](https://github.com/mapbox/mapbox-gl-js/pull/12122))
* Fix Chrome console warnings about ignored event cancel on touch interactions ([#12121](https://github.com/mapbox/mapbox-gl-js/pull/12121)) (h/t [jschaf](https://github.com/jschaf))

## 2.9.2

### Bug fixes 🐞

* Add a workaround in `ScaleControl` to support localization in browsers without `NumberFormat` support. ([#12068](https://github.com/mapbox/mapbox-gl-js/pull/12068))
* Fix `GeolocateControl` not working in Safari. ([#12080](https://github.com/mapbox/mapbox-gl-js/pull/12080))

## 2.9.1

### Bug fixes 🐞

* Fix missing lines on some Windows devices. ([#12017](https://github.com/mapbox/mapbox-gl-js/pull/12017))

## 2.9.0

### Features ✨

* Add `globe` projection. This new projection displays the map as a 3d globe and can be enabled by either passing `projection: globe` to the map constructor or by calling `map.setProjection('globe')`. All layers are supported by globe except for Custom Layers and Sky.
* Extend atmospheric `fog` with three new style specification properties: `high-color`, `space-color` and `star-intensity` to allow the design of atmosphere around the globe and night skies. ([#11590](https://github.com/mapbox/mapbox-gl-js/pull/11590))
* Add a new line layer paint property in the style specification: `line-trim-offset` that can be used to create a custom fade out with improved update performance over `line-gradient`. ([#11570](https://github.com/mapbox/mapbox-gl-js/pull/11570))
* Add an option for providing a geolocation adapter to `GeolocateControl`. ([#10400](https://github.com/mapbox/mapbox-gl-js/pull/10400)) (h/t [behnammodi](https://github.com/behnammodi))
* Add `Map.Title` property to locale options to localise the map `aria-label`. ([#11549](https://github.com/mapbox/mapbox-gl-js/pull/11549)) (h/t [andrewharvey](https://github.com/andrewharvey))
* Allow duplicated coordinates in tile request URLs. ([#11441](https://github.com/mapbox/mapbox-gl-js/pull/11441)) (h/t [ozero](https://github.com/ozero))

### Bug fixes 🐞

* Fix an issue which causes line layers to occasionally flicker. ([#11848](https://github.com/mapbox/mapbox-gl-js/pull/11848))
* Fix markers in fog sometimes becoming more visible when behind terrain. ([#11658](https://github.com/mapbox/mapbox-gl-js/pull/11658))
* Fix an issue where setting terrain exageration to 0 could prevent the zoom to be resolved. ([#11830](https://github.com/mapbox/mapbox-gl-js/pull/11830))
* Copy stylesheet to allow toggling different styles using setStyle without overwriting some of the properties. ([#11942](https://github.com/mapbox/mapbox-gl-js/pull/11942))

## 2.8.2

### Bug fixes 🐞

* Fix an issue where the special bundle for CSP-restricted environments was not compatible with further minification in some bundling setups. ([#11790](https://github.com/mapbox/mapbox-gl-js/pull/11790))

## 2.8.1

### Bug fixes 🐞

* Fix the special bundle for CSP-restricted environments that broke in the 2.8.0 release. ([#11739](https://github.com/mapbox/mapbox-gl-js/pull/11739))

## 2.8.0

## Performance improvements 🏁
### Performance improvements 🏁

* Improve memory usage by freeing memory more eagerly after loading tiles. ([#11434](https://github.com/mapbox/mapbox-gl-js/pull/11434))
* Improve memory usage by reducing repeated line labels on overscaled tiles. ([#11414](https://github.com/mapbox/mapbox-gl-js/pull/11414))
* Improve performance when placing many symbols on terrain. ([#11466](https://github.com/mapbox/mapbox-gl-js/pull/11466))

### Bug fixes 🐞

* Fix `map.fitBounds()`, `map.fitScreenCoordinates()`, and `map.cameraForBounds()` incorrectly matching bounds with non-zero bearing. ([#11568](https://github.com/mapbox/mapbox-gl-js/pull/11568)) (h/t [TannerPerrien](https://github.com/TannerPerrien))
* Improve control button appearance by applying `border-radius` more consistently. ([#11423](https://github.com/mapbox/mapbox-gl-js/pull/11423)) (h/t [nagix](https://github.com/nagix))
* Fix `ScaleControl` displaying incorrect units with some projections.([#11657](https://github.com/mapbox/mapbox-gl-js/pull/11657))
94 changes: 87 additions & 7 deletions debug/3d-playground.html
Original file line number Diff line number Diff line change
@@ -52,6 +52,13 @@
this.sunHaloColor = [ 255, 255, 255 ];
this.skyColor = [ 255, 255, 255 ];
this.sunIntensity = 30.0;
this.verticalGradient = false;
this.lightIntensity = 0.26;
this.aoIntensity = 0.3;
this.aoRadius = 3;
this.aoGroundLine = true;
this.buildingColor = [ 255, 255, 255 ];
this.buildingOpacity = 1;
};

var demo3d = new Demo3D();
@@ -78,9 +85,9 @@
var terrain = gui.addFolder('Terrain');
var enableTerrain = terrain.add(demo3d, 'enableTerrain');
enableTerrain.onFinishChange((value) => {
map.setTerrain(value ? {"source": "mapbox-dem", "exaggeration": 1.5} : null);
map.setTerrain(value ? {"source": "mapbox-dem", "exaggeration": demo3d.terrainExaggeration} : null);
});
var terrainExaggeration = terrain.add(demo3d, 'terrainExaggeration', 0.5, 2);
var terrainExaggeration = terrain.add(demo3d, 'terrainExaggeration', 0, 2);
terrainExaggeration.onFinishChange((value) => {
if (demo3d.enableTerrain) {
map.setTerrain({"source": "mapbox-dem", "exaggeration": value});
@@ -94,11 +101,11 @@
sky.add(demo3d, 'animateSky');
var sunAltitude = sky.add(demo3d, 'sunAltitude', 0.0, 90.0);
sunAltitude.onFinishChange((value) => {
map.setLight({'position': [1, demo3d.sunAzimuth, value], 'anchor': 'map'});
map.setLight({'position': [1, demo3d.sunAzimuth, value], 'anchor': 'map', intensity: this.lightIntensity});
});
var sunAzimuth = sky.add(demo3d, 'sunAzimuth', 0.0, 360.0);
sunAzimuth.onFinishChange((value) => {
map.setLight({'position': [1, value, demo3d.sunAltitude], 'anchor': 'map'});
map.setLight({'position': [1, value, demo3d.sunAltitude], 'anchor': 'map', intensity: this.lightIntensity});
});
var sunIntensity = sky.add(demo3d, 'sunIntensity', 0.0, 100.0);
sunIntensity.onFinishChange((value) => {
@@ -124,6 +131,43 @@
map.setPaintProperty('sky', 'sky-atmosphere-color',
'rgba(' + value[0] + ', ' + value[1] + ', ' + value[2] + ', ' + demo3d.sunAtmosphereIntensity + ')');
});

var buildings = gui.addFolder('Buildings');
var verticalGradient = buildings.add(demo3d, 'verticalGradient');
verticalGradient.onFinishChange((value) => {
map.setPaintProperty('extrusion', 'fill-extrusion-vertical-gradient', value);
});
var buildingsAO = buildings.add(demo3d, 'aoIntensity', 0.0, 1.0);
buildingsAO.onFinishChange((value) => {
map.setPaintProperty('extrusion', 'fill-extrusion-ambient-occlusion-intensity', value);
map.setPaintProperty('footprint-blur5', 'line-opacity', value);
map.setPaintProperty('footprint-blur2', 'line-opacity', value);
});
var aoRadius = buildings.add(demo3d, 'aoRadius', 0.0, 50.0);
aoRadius.onFinishChange((value) => {
map.setPaintProperty('extrusion', 'fill-extrusion-ambient-occlusion-radius', value);
});
var aoGroundLine = buildings.add(demo3d, 'aoGroundLine');
aoGroundLine.onFinishChange((value) => {
const visible = value ? 'visible' : 'none';
map.setLayoutProperty('footprint-blur2', 'visibility', visible);
map.setLayoutProperty('footprint-blur5', 'visibility', visible);
});
var buildingColor = buildings.addColor(demo3d, 'buildingColor');
buildingColor.onFinishChange((value) => {
map.setPaintProperty('extrusion', 'fill-extrusion-color',
'rgb(' + value[0] + ', ' + value[1] + ', ' + value[2] + ')');
});
var buildingOpacity = buildings.add(demo3d, 'buildingOpacity', 0.0, 1.0);
buildingOpacity.onFinishChange((value) => {
map.setPaintProperty('extrusion', 'fill-extrusion-opacity', value);
});
var lightIntensity = buildings.add(demo3d, 'lightIntensity', 0.0, 1.0);
lightIntensity.onFinishChange((value) => {
const light = map.getLight();
light['intensity'] = value;
map.setLight(light);
});
};

var map = window.map = new mapboxgl.Map({
@@ -159,14 +203,49 @@
'source-layer': 'building',
'filter': ['==', 'extrude', 'true'],
'type': 'fill-extrusion',
'minzoom': 15,
'minzoom': 13,
'paint': {
'fill-extrusion-color': ['rgb', ['number', ['feature-state', 'hover-r'], r], ['number', ['feature-state', 'hover-g'], r], ['number', ['feature-state', 'hover-b'], r]],
'fill-extrusion-color': 'rgb(' + demo3d.buildingColor[0] + ', ' + demo3d.buildingColor[1] + ', ' + demo3d.buildingColor[2] + ')',
'fill-extrusion-height': ["get", "height"],
'fill-extrusion-opacity': 0.7
'fill-extrusion-base': ["get", "min_height"],
'fill-extrusion-opacity': demo3d.buildingOpacity,
'fill-extrusion-vertical-gradient': demo3d.verticalGradient,
'fill-extrusion-ambient-occlusion-intensity': demo3d.aoIntensity
}
}, 'waterway-label');

// Buildings AO lines
let buildingsBlurLayerId = "footprint-blur5";
if (!map.getLayer(buildingsBlurLayerId)) {
map.addLayer({
'id': buildingsBlurLayerId,
'source': 'composite',
'source-layer': 'building',
'filter': ['all', ['==', ['get', 'min_height'], 0], ['==', ['get', 'extrude'], 'true']],
'type': 'line',
'paint': {
'line-color': 'rgba(100, 100, 100, 0.3)',
'line-width': {"base": 1.3, "stops":[[14, 5], [22, 10]]},
'line-opacity': 0.4
}
}, "extrusion");
}
buildingsBlurLayerId = "footprint-blur2";
if (!map.getLayer(buildingsBlurLayerId)) {
map.addLayer({
'id': buildingsBlurLayerId,
'source': 'composite',
'source-layer': 'building',
'filter': ['all', ['==', ['get', 'min_height'], 0], ['==', ['get', 'extrude'], 'true']],
'type': 'line',
'paint': {
'line-color': 'rgba(100, 100, 100, 0.4)',
'line-width': 3,
'line-opacity': 0.4
}
}, "extrusion");
}

map.addLayer({
'id': 'sky',
'type': 'sky',
@@ -184,6 +263,7 @@
}
});
map.setFog({});
map.setLight({intensity: demo3d.lightIntensity});
var elevationDebug = document.getElementById('elevationDebug');
map.on('mousemove', (e) => {
const elevation = map.queryTerrainElevation(map.unproject(e.point));
64 changes: 64 additions & 0 deletions debug/buildings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<title>Mapbox GL JS debug page</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel='stylesheet' href='../dist/mapbox-gl.css' />
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
#radius {
position: absolute;
width: 700px;
top: 10px;
left: 10px;
z-index: 1000;
}
</style>
</head>

<body>
<div id='map'></div>
<!-- <input type="range" id="radius" min="0" max="50" step="any" value="20" />
-->
<script src='../dist/mapbox-gl-dev.js'></script>
<script src='../debug/access_token_generated.js'></script>
<script>

var map = window.map = new mapboxgl.Map({
container: 'map',
zoom: 12.5,
center: [-122.4194, 37.7749],
style: 'mapbox://styles/mapbox/streets-v11',
hash: true
});

map.on('load', () => {

map.addLayer({
'id': 'add-3d-buildings',
'source': 'composite',
'source-layer': 'building',
'filter': ['==', 'extrude', 'true'],
'type': 'fill-extrusion',
'minzoom': 15,
'layout': {
'fill-extrusion-edge-radius': 0.4
},
'paint': {
'fill-extrusion-color': '#bbb',
'fill-extrusion-height': ['get', 'height'],
'fill-extrusion-base': ['get', 'min_height'],
'fill-extrusion-opacity': 1,
'fill-extrusion-ambient-occlusion-intensity': 0.5,
'fill-extrusion-ambient-occlusion-radius': 0.1
}
});

map.setLight({intensity: 0.7});
});

</script>
</body>
</html>
20 changes: 6 additions & 14 deletions debug/custom-source.html
Original file line number Diff line number Diff line change
@@ -35,41 +35,33 @@
const colors = ['#74a9cf', '#3690c0', '#0570b0', '#045a8d'];
let currentColor = colors[0];

const canvas = document.createElement('canvas');
canvas.width = canvas.height = tileSize;
const context = canvas.getContext('2d', {willReadFrequently: true});

map.on('load', () => {
map.addSource('custom-source', {
type: 'custom',
tileSize,
async loadTile({z, x, y}) {
const tileSize = 256;
const canvas = document.createElement('canvas');
canvas.width = canvas.height = tileSize;
const context = canvas.getContext('2d');
context.fillStyle = 'red';
context.fillRect(0, 0, tileSize, tileSize);

context.font = '18px serif';
context.fillStyle = 'white';
context.textAlign = 'center';
context.fillText(`${z}/${x}/${y}`, tileSize / 2, tileSize / 2, tileSize);

const imageData = context.getImageData(0, 0, tileSize, tileSize);
return imageData;
return canvas;
},
prepareTile({z, x, y}) {
const tileSize = 256;
const canvas = document.createElement('canvas');
canvas.width = canvas.height = tileSize;
const context = canvas.getContext('2d');
context.fillStyle = currentColor;
context.fillRect(0, 0, tileSize, tileSize);

context.font = '18px serif';
context.fillStyle = 'white';
context.textAlign = 'center';
context.fillText(`${z}/${x}/${y}`, tileSize / 2, tileSize / 2, tileSize);

const imageData = context.getImageData(0, 0, tileSize, tileSize);
return imageData;
return canvas;
},
hasTile({z, x, y}) {
return (x + y) % 2 === 0;
Loading