-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve rendering performance of symbols with symbol-sort-key #9751
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -236,7 +236,8 @@ function drawLayerSymbols(painter, sourceCache, layer, coords, isText, translate | |
// Unpitched point labels need to have their rotation applied after projection | ||
const rotateInShader = rotateWithMap && !pitchWithMap && !alongLine; | ||
|
||
const sortFeaturesByKey = layer.layout.get('symbol-sort-key').constantOr(1) !== undefined; | ||
const hasSortKey = layer.layout.get('symbol-sort-key').constantOr(1) !== undefined; | ||
let sortFeaturesByKey = false; | ||
|
||
const depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly); | ||
|
||
|
@@ -333,7 +334,8 @@ function drawLayerSymbols(painter, sourceCache, layer, coords, isText, translate | |
hasHalo | ||
}; | ||
|
||
if (sortFeaturesByKey) { | ||
if (hasSortKey && bucket.canOverlap) { | ||
sortFeaturesByKey = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm just not sure about this particular bit — we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this looks good. |
||
const oldSegments = buffers.segments.get(); | ||
for (const segment of oldSegments) { | ||
tileRenderState.push({ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -518,6 +518,7 @@ function addTextVertices(bucket: SymbolBucket, | |
textOffset, | ||
textAlongLine, | ||
feature, | ||
layer, | ||
writingMode, | ||
anchor, | ||
lineArray.lineStartIndex, | ||
|
@@ -646,6 +647,7 @@ function addSymbol(bucket: SymbolBucket, | |
iconOffset, | ||
iconAlongLine, | ||
feature, | ||
layer, | ||
false, | ||
anchor, | ||
lineArray.lineStartIndex, | ||
|
@@ -665,6 +667,7 @@ function addSymbol(bucket: SymbolBucket, | |
iconOffset, | ||
iconAlongLine, | ||
feature, | ||
layer, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
WritingMode.vertical, | ||
anchor, | ||
lineArray.lineStartIndex, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layer
is no longer used, so this is a leftover right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, didn't catch that! Fixed 🙂