Skip to content

Commit

Permalink
Fix popup.trackPointer pointer cursor bug (#3434)
Browse files Browse the repository at this point in the history
* Fix popup.trackPointer pointer cursor bug

* Update CHANGELOG.md

* New pointer-tracked popup test

---------

Co-authored-by: Harel M <harel.mazor@gmail.com>
  • Loading branch information
simondriesen and HarelM authored Dec 3, 2023
1 parent 3c78f81 commit 47d7403
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

### 🐞 Bug fixes
- Fix zooming outside the central globe when terrain 3D is enabled ([#3425](https://github.com/maplibre/maplibre-gl-js/pull/3425))
- Fix cursor being shown indefinitely as a pointer when removing a popup with its `trackPointer` method active ([#3434](https://github.com/maplibre/maplibre-gl-js/pull/3434))
- Fix a bug in showing cooperative gestures when scroll zoom is disabled ([#2498](https://github.com/maplibre/maplibre-gl-js/pull/2498))
- Handle loading of empty raster tiles (204 No Content) ([#3428](https://github.com/maplibre/maplibre-gl-js/pull/3428))
- _...Add new stuff here..._
Expand Down
16 changes: 16 additions & 0 deletions src/ui/popup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,22 @@ describe('popup', () => {
expect(
popup._container.classList.value
).not.toContain('maplibregl-popup-track-pointer');
expect(
map._canvasContainer.classList.value
).not.toContain('maplibregl-track-pointer');
});

test('Pointer-tracked popup calling Popup#remove removes track-pointer class from map (#3434)', () => {
const map = createMap();
new Popup()
.setText('Test')
.trackPointer()
.addTo(map)
.remove();

expect(
map._canvasContainer.classList.value
).not.toContain('maplibregl-track-pointer');
});

test('Positioned popup lacks pointer-tracking class', () => {
Expand Down
1 change: 1 addition & 0 deletions src/ui/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export class Popup extends Evented {
this._map.off('mousemove', this._onMouseMove);
this._map.off('mouseup', this._onMouseUp);
this._map.off('drag', this._onDrag);
this._map._canvasContainer.classList.remove('maplibregl-track-pointer');
delete this._map;
}

Expand Down

0 comments on commit 47d7403

Please sign in to comment.