Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/ui/marker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,13 @@ describe('marker', () => {
.togglePopup();

await sleep(100);
marker._pos = new Point(2999, 242);
marker._lngLat = map.unproject(marker._pos);
const newLngLat = map.unproject(new Point(2999, 242));
marker.setLngLat(newLngLat);
Copy link
Collaborator

@HarelM HarelM Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't equivalent to the previous behavior - setting lnglat is not the same as placing it in a screen position. lnglat are wrapped and therefore might be placed in a different part of the screen.
Can you please share a video of the linked PR you mentioned after this fix (i.e click on a marker, drag to pass world copy and click again to open the popup in the new location)?

marker.togglePopup();

expect(marker.getPopup()._pos.x).toBeCloseTo(marker._pos.x, 0);
const diff = Math.abs(marker.getPopup()._pos.x - marker._pos.x);
// Expecting a consistent world copy offset
expect(diff).toBeCloseTo(512, 0);
map.remove();
});

Expand Down
1 change: 0 additions & 1 deletion src/ui/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ export class Popup extends Evented {
setLngLat(lnglat: LngLatLike): this {
this._lngLat = LngLat.convert(lnglat);
this._pos = null;
this._flatPos = null;

this._trackPointer = false;

Expand Down