Skip to content

Commit 6903b7e

Browse files
authored
Add scrollWheelZoom.enable() and disable() (#1225)
* Add scrollWheelZoom.enable() and disable() * Enable and disable other types of zoom (double click, touch, box)
1 parent f635a68 commit 6903b7e

File tree

1 file changed

+32
-0
lines changed
  • python/jupyter_leaflet/src

1 file changed

+32
-0
lines changed

python/jupyter_leaflet/src/Map.ts

+32
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,38 @@ export class LeafletMapView extends LeafletDOMWidgetView {
423423
this.obj.toggleFullscreen();
424424
}
425425
});
426+
this.listenTo(this.model, 'change:scroll_wheel_zoom', () => {
427+
const scrollWheelZoom = this.model.get('scroll_wheel_zoom');
428+
if (scrollWheelZoom) {
429+
this.obj.scrollWheelZoom.enable();
430+
} else {
431+
this.obj.scrollWheelZoom.disable();
432+
}
433+
});
434+
this.listenTo(this.model, 'change:double_click_zoom', () => {
435+
const doubleClickZoom = this.model.get('double_click_zoom');
436+
if (doubleClickZoom) {
437+
this.obj.doubleClickZoom.enable();
438+
} else {
439+
this.obj.doubleClickZoom.disable();
440+
}
441+
});
442+
this.listenTo(this.model, 'change:touch_zoom', () => {
443+
const touchZoom = this.model.get('touch_zoom');
444+
if (touchZoom) {
445+
this.obj.touchZoom.enable();
446+
} else {
447+
this.obj.touchZoom.disable();
448+
}
449+
});
450+
this.listenTo(this.model, 'change:box_zoom', () => {
451+
const boxZoom = this.model.get('box_zoom');
452+
if (boxZoom) {
453+
this.obj.boxZoom.enable();
454+
} else {
455+
this.obj.boxZoom.disable();
456+
}
457+
});
426458
}
427459

428460
processPhosphorMessage(msg: Message) {

0 commit comments

Comments
 (0)