Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Bump GL-JS
Browse files Browse the repository at this point in the history
Backport GL-JS fix 'Hide glyphs behind the camera'(mapbox/mapbox-gl-js#9229)
  • Loading branch information
zmiao committed Feb 11, 2020
1 parent e0b1642 commit 7424c4e
Show file tree
Hide file tree
Showing 10 changed files with 486 additions and 433 deletions.
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ commands:
command: |
platform/darwin/scripts/generate-style-code.js
platform/darwin/scripts/update-examples.js
git add -A && git diff --staged --exit-code
git add -A && git diff --staged --exit-code | tee nitpick.patch
config:
parameters:
config_params:
Expand Down
2 changes: 1 addition & 1 deletion mapbox-gl-js
Submodule mapbox-gl-js updated 175 files
31 changes: 30 additions & 1 deletion metrics/ignores/platform-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"expression-tests/legacy/interval/composite-default": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/interval/tokens-zoom": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/resolved-locale/basic": "Even the 'en' locale may not be present on some test systems.",
"expression-tests/within/basic": "TODO: Fix by implementing `within` expression",
"expression-tests/within/invalid-geojson": "TODO: Fix by implementing `within` expression",
"probes/file-size/fail-file-doesnt-match": "Should fail, doesn't match the expectation.",
"probes/file-size/fail-file-not-found": "Should fail, file not found.",
"probes/file-size/fail-size-is-over": "Should fail, size is bigger than expected.",
Expand Down Expand Up @@ -55,6 +57,7 @@
"query-tests/regressions/mapbox-gl-js#6555": "skip - no querySourceFeatures in mbgl-node; needs issue",
"query-tests/regressions/mapbox-gl-js#7883": "https://github.com/mapbox/mapbox-gl-native/issues/14585",
"query-tests/world-wrapping/box": "skip - needs issue",
"query-tests/regressions/mapbox-gl-js#8999": "https://github.com/mapbox/mapbox-gl-js/pull/9138",
"render-tests/background-color/colorSpace-hcl": "needs issue",
"render-tests/background-color/transition": "https://github.com/mapbox/mapbox-gl-native/issues/10619",
"render-tests/canvas/default": "skip - js specific",
Expand Down Expand Up @@ -111,5 +114,31 @@
"render-tests/text-variable-anchor/remember-last-placement": "skip - fails on gl-native, as symbol index is not functional at static map mode - needs issue",
"render-tests/tilejson-bounds/overwrite-bounds": "started failing after https://github.com/mapbox/mapbox-gl-native/pull/16091",
"render-tests/video/default": "skip - https://github.com/mapbox/mapbox-gl-native/issues/601",
"render-tests/zoomed-fill/negative-zoom": "https://github.com/mapbox/mapbox-gl-native/issues/16019"
"render-tests/zoomed-fill/negative-zoom": "https://github.com/mapbox/mapbox-gl-native/issues/16019",
"render-tests/zoomed-fill/negative-zoom": "https://github.com/mapbox/mapbox-gl-native/issues/16019",
"render-tests/fill-extrusion-translate/default": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/fill-extrusion-opacity/literal": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/fill-extrusion-opacity/default": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/fill-extrusion-opacity/function": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/fill-extrusion-vertical-gradient/default" : "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/fill-extrusion-vertical-gradient/false": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/fill-extrusion-base/zoom-and-property-function": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/fill-extrusion-base/property-function": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/extent/1024-symbol": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/projection/perspective": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/feature-state/promote-id-fill":"https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/feature-state/promote-id-symbol": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/feature-state/promote-id-line": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/feature-state/promote-id-circle": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/feature-state/promote-id-fill-extrusion": "https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/text-variable-anchor/left-top-right-buttom-offset-tile-map-mode":"https://github.com/mapbox/mapbox-gl-js/pull/9202",
"render-tests/line-pattern/with-dasharray":"https://github.com/mapbox/mapbox-gl-js/pull/9189",
"render-tests/symbol-sort-key/placement-tile-boundary-right-then-left": "https://github.com/mapbox/mapbox-gl-js/pull/9054",
"render-tests/line-dasharray/zero-length-gap":"https://github.com/mapbox/mapbox-gl-js/pull/9246",
"render-tests/within/layout-text": "TODO: Fix by enabling `within` expreesion with layout property",
"render-tests/within/filter-with-inlined-geojson": "TODO: Fix by enabling `within` expreesion with filter expression",
"render-tests/within/paint-circle": "TODO: Fix by enabling `within` expreesion with paint property",
"render-tests/within/paint-icon": "TODO: Fix by enabling `within` expreesion with paint property",
"render-tests/within/paint-text": "TODO: Fix by enabling `within` expreesion with paint property"

}
6 changes: 4 additions & 2 deletions platform/darwin/src/MGLSymbolStyleLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,9 @@ MGL_EXPORT
If true, the symbols will not cross tile edges to avoid mutual collisions.
Recommended in layers that don't have enough padding in the vector tile to
prevent collisions, or if it is a point symbol layer placed after a line symbol
layer.
layer. When using a client that supports global collision detection, like
Mapbox GL JS version 0.42.0 or greater, enabling this property is not needed to
prevent clipped labels at tile boundaries.
The default value of this property is an expression that evaluates to `NO`. Set
this property to `nil` to reset it to the default value.
Expand Down Expand Up @@ -1629,7 +1631,7 @@ MGL_EXPORT

/**
To increase the chance of placing high-priority labels on the map, you can
provide an array of `textAnchor` locations: the render will attempt to place
provide an array of `textAnchor` locations: the renderer will attempt to place
the label at each location, in order, before moving onto the next label. Use
`textJustify: auto` to choose justification based on anchor position. To apply
an offset, use the `textRadialOffset` or the two-dimensional `textOffset`.
Expand Down
12 changes: 10 additions & 2 deletions src/mbgl/layout/symbol_projection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,16 @@ namespace mbgl {
const float pitchScaledFontSize = pitchWithMap ?
fontSize * perspectiveRatio :
fontSize / perspectiveRatio;

const Point<float> anchorPoint = project(placedSymbol.anchorPoint, labelPlaneMatrix).first;

const auto transformedTileAnchor = project(placedSymbol.anchorPoint, labelPlaneMatrix);

// Skip labels behind the camera
if (transformedTileAnchor.second <= 0.0) {
hideGlyphs(placedSymbol.glyphOffsets.size(), dynamicVertexArray);
continue;
}

const Point<float> anchorPoint = transformedTileAnchor.first;

PlacementResult placeUnflipped = placeGlyphsAlongLine(placedSymbol, pitchScaledFontSize, false /*unflipped*/, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix, dynamicVertexArray, anchorPoint, state.getSize().aspectRatio());

Expand Down
Loading

0 comments on commit 7424c4e

Please sign in to comment.