-
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
Markers update on terrain change #10985
Changes from 4 commits
7669177
0a57830
ba40d7e
5f9128c
c54e1a8
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 |
---|---|---|
|
@@ -2764,6 +2764,10 @@ class Map extends Camera { | |
this.painter._updateFog(this.style); | ||
this._updateTerrain(); // Terrain DEM source updates here and skips update in style._updateSources. | ||
this.style._updateSources(this.transform); | ||
// Update positions of markers on enabling/disabling terrain | ||
for (const marker of this._markers) { | ||
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. TBH I don't immediately see why this is the correct location at which to update judiciously in order to fix the bug, but it looks reasonable, and if it fixes the issue, then it seems correct. 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. could you put these three lines into 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. @arindam1993 Done! |
||
marker._update(); | ||
} | ||
} | ||
|
||
this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, fadeDuration, this._crossSourceCollisions); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1380,10 +1380,28 @@ test('Marker interaction and raycast', (t) => { | |
const bottomLngLat = tr.pointLocation3D(new Point(terrainTop.x, tr.height)); | ||
// Raycast returns distance to closer point evaluates to occluded marker. | ||
t.stub(tr, 'pointLocation3D').returns(bottomLngLat); | ||
setTimeout(() => { | ||
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.
|
||
map.once('render', () => { | ||
t.deepEqual(marker.getElement().style.opacity, 0.2); | ||
t.end(); | ||
}, 100); | ||
}); | ||
}); | ||
|
||
t.test(`Marker updates position on removing terrain (#10982)`, (t) => { | ||
const update = t.spy(marker, "_update"); | ||
map.setTerrain(null); | ||
map.once('render', () => { | ||
t.same(update.callCount, 1); | ||
t.end(); | ||
}); | ||
}); | ||
|
||
t.test(`Marker updates position on adding terrain (#10982)`, (t) => { | ||
const update = t.spy(marker, "_update"); | ||
map.setTerrain({"source": "mapbox-dem"}); | ||
map.once('render', () => { | ||
t.same(update.callCount, 1); | ||
t.end(); | ||
}); | ||
}); | ||
|
||
t.end(); | ||
|
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.
Higher terrain exaggeration makes the bug more visible.