Conversation
| @@ -0,0 +1,133 @@ | |||
| <!DOCTYPE html> | |||
There was a problem hiding this comment.
Are you planning to commit this file? It would be more useful for the next developer if it was named more appropriately.
vakila
left a comment
There was a problem hiding this comment.
LGTM! Thanks for adding the render test @arindam1993 , both that & the debug page (on Linux Firefox/Chrome) look good 💚
One question below, and relatedly: do we need tests that this works also when combined with multi-line and/or vertical labels?
Some of those (currently ignored) tests are failing, for example text-writing-mode/point_label/mixed-multiline-vertical-horizontal-mode-icon-text-fit, and the failure doesn't look to me like it has to do with the 1px issue addressed in #8741. Thoughts?
| updateVariableAnchors(bucket, rotateWithMap, pitchWithMap, variableOffsets, symbolSize, | ||
| tr, labelPlaneMatrix, coord.posMatrix, tileScale, size); | ||
| } else if (isText && size && bucket.allowVerticalPlacement) { | ||
| } else if (isText && size && bucket.allowVerticalPlacement && !variablePlacement) { |
There was a problem hiding this comment.
Perhaps I'm missing something but why the && !variablePlacement here? IIRC we can have both vertical & variable placement enabled at the same time, are we accounting for that case?
There was a problem hiding this comment.
No, we're not. In the interest of time time this PR only handles icon-text-fit rendering for horizontal variable anchor labels.
| const variablePlacement = layer.layout.get('text-variable-anchor'); | ||
|
|
||
| //Compute variable-offsets before painting since icons and text data positioning | ||
| //depend on each other in this case. |
Yes, will address that and shifting of icon collision boxes in a separate PR. This was intended as a fix to the biggest visual glitch. |
vakila
left a comment
There was a problem hiding this comment.
👍 since we're not attempting to resolve the combo-vertical-variable-placement issue in this PR
asheemmamoowala
left a comment
There was a problem hiding this comment.
Just a few additional notes:
- This PR does not change the behavior for multi-line labels - that case remains broken.
- Works well with CJK characters
- Needs follow up issues for fixing icon-text-fit with vertical symbols and fixing collision boxes
| const verticalTextBoxStartIndex = verticalTextCollisionFeature ? verticalTextCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length; | ||
| const verticalTextBoxEndIndex = verticalTextCollisionFeature ? verticalTextCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length; | ||
|
|
||
| //Place icon first, so text can have a reference it its index in the placed symbol array. |
There was a problem hiding this comment.
nit: typo in reference it its index
| const size = symbolSize.evaluateSizeForZoom(sizeData, tr.zoom); | ||
|
|
||
| const s = pixelsToTileUnits(tile, 1, painter.transform.zoom); | ||
| const labelPlaneMatrix = symbolProjection.getLabelPlaneMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, s); |
There was a problem hiding this comment.
nit: Avoid temporary variable buffers and s
kkaefer
left a comment
There was a problem hiding this comment.
Is the intention to fix text-writing-mode/point_label/cjk-variable-anchors-vertical-horizontal-mode-icon-text-fit as well? Regardless of the icon-text-fit aspect, it seems like the
Here's the native version with collision boxes activated (which arguably seems wrong too):
And this is the JS version in this branch:
for reference, this is the JS version before this patch:
It looks like there are no tests that are unignored, which means there are render test cases missing that were broken in the old behavior, but work with this patch applied. Could you please add some?
No I didn't intend to fix that, this change only ensures that the offset thats calculated and applied to
I have added one(see original PR body), but its not fully representative of this fix since its doing collision. Updating so |
|
@asheemmamoowala
|
kkaefer
left a comment
There was a problem hiding this comment.
Thanks for looking at the vertical icons!










This is an attempt to isolate and cherry pick just the fix required for #8583 from #8737 .
The issue seems to be caused by the fact that
draw_symbol.js:#updateVariableAnchorsapplies an offset to the text glyphs , but never touches the icon buffer at all.This PR adds an attribute to the
placedSymbolbuffers, calledassociatedSymbolIndex, this lets the textplacedSymbolinstances know which icon they're associated with.So at render time the offsets can be applied in both buffers.
It also moves the offset calculation out of the paint loop, since icons and text need to share the same data.
This still leaves out making
icon-text-fitupdate the collision box (#8722) and making it work with vertical labels.UPDATE:

demo, 1 frame desynch fixed
Added a render test

Before (on master):
After:

Launch Checklist
document any changes to public APIstagged@mapbox/studioand/or@mapbox/maps-designif this PR includes style spec changestagged@mapbox/gl-nativeif this PR includes shader changes or needs a native port