diff --git a/src/ui/marker.test.ts b/src/ui/marker.test.ts index ce0dc326f07..186805f89cd 100644 --- a/src/ui/marker.test.ts +++ b/src/ui/marker.test.ts @@ -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); 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(); }); diff --git a/src/ui/popup.ts b/src/ui/popup.ts index 52f359e4f1e..1b577fed050 100644 --- a/src/ui/popup.ts +++ b/src/ui/popup.ts @@ -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;