Skip to content

Commit

Permalink
Add scrollWheelZoom.enable() and disable() (#1225)
Browse files Browse the repository at this point in the history
* Add scrollWheelZoom.enable() and disable()

* Enable and disable other types of zoom (double click, touch, box)
  • Loading branch information
lopezvoliver authored Oct 21, 2024
1 parent f635a68 commit 6903b7e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions python/jupyter_leaflet/src/Map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,38 @@ export class LeafletMapView extends LeafletDOMWidgetView {
this.obj.toggleFullscreen();
}
});
this.listenTo(this.model, 'change:scroll_wheel_zoom', () => {
const scrollWheelZoom = this.model.get('scroll_wheel_zoom');
if (scrollWheelZoom) {
this.obj.scrollWheelZoom.enable();
} else {
this.obj.scrollWheelZoom.disable();
}
});
this.listenTo(this.model, 'change:double_click_zoom', () => {
const doubleClickZoom = this.model.get('double_click_zoom');
if (doubleClickZoom) {
this.obj.doubleClickZoom.enable();
} else {
this.obj.doubleClickZoom.disable();
}
});
this.listenTo(this.model, 'change:touch_zoom', () => {
const touchZoom = this.model.get('touch_zoom');
if (touchZoom) {
this.obj.touchZoom.enable();
} else {
this.obj.touchZoom.disable();
}
});
this.listenTo(this.model, 'change:box_zoom', () => {
const boxZoom = this.model.get('box_zoom');
if (boxZoom) {
this.obj.boxZoom.enable();
} else {
this.obj.boxZoom.disable();
}
});
}

processPhosphorMessage(msg: Message) {
Expand Down

0 comments on commit 6903b7e

Please sign in to comment.