Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scrollWheelZoom.enable() and disable() #1225

Merged
Merged
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
32 changes: 32 additions & 0 deletions python/jupyter_leaflet/src/Map.ts
Original file line number Diff line number Diff line change
@@ -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) {

Unchanged files with check annotations Beta

{

Check failure on line 1 in examples/BaseMap.ipynb

GitHub Actions / run (ubuntu-latest, 3.8)

Ruff (F403)

examples/BaseMap.ipynb:1:1: F403 `from ipyleaflet import *` used; unable to detect undefined names

Check failure on line 1 in examples/BaseMap.ipynb

GitHub Actions / run (macos-latest, 3.8)

Ruff (F403)

examples/BaseMap.ipynb:1:1: F403 `from ipyleaflet import *` used; unable to detect undefined names
"cells": [

Check failure on line 2 in examples/BaseMap.ipynb

GitHub Actions / run (ubuntu-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `Map` may be undefined, or defined from star imports

Check failure on line 2 in examples/BaseMap.ipynb

GitHub Actions / run (ubuntu-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `basemaps` may be undefined, or defined from star imports

Check failure on line 2 in examples/BaseMap.ipynb

GitHub Actions / run (macos-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `Map` may be undefined, or defined from star imports

Check failure on line 2 in examples/BaseMap.ipynb

GitHub Actions / run (macos-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `basemaps` may be undefined, or defined from star imports
{

Check failure on line 3 in examples/BaseMap.ipynb

GitHub Actions / run (ubuntu-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `basemap_to_tiles` may be undefined, or defined from star imports

Check failure on line 3 in examples/BaseMap.ipynb

GitHub Actions / run (ubuntu-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `basemaps` may be undefined, or defined from star imports

Check failure on line 3 in examples/BaseMap.ipynb

GitHub Actions / run (macos-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `basemap_to_tiles` may be undefined, or defined from star imports

Check failure on line 3 in examples/BaseMap.ipynb

GitHub Actions / run (macos-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `basemaps` may be undefined, or defined from star imports
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {

Check failure on line 19 in examples/BaseMap.ipynb

GitHub Actions / run (ubuntu-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `basemap_to_tiles` may be undefined, or defined from star imports

Check failure on line 19 in examples/BaseMap.ipynb

GitHub Actions / run (ubuntu-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `basemaps` may be undefined, or defined from star imports

Check failure on line 19 in examples/BaseMap.ipynb

GitHub Actions / run (macos-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `basemap_to_tiles` may be undefined, or defined from star imports

Check failure on line 19 in examples/BaseMap.ipynb

GitHub Actions / run (macos-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `basemaps` may be undefined, or defined from star imports
"model_id": "2395000484b445ca8a84934119bd192f",
"version_major": 2,
"version_minor": 0
}
],
"source": [
"m = Map(center=(52, 10), zoom=8, basemap=basemaps.OpenStreetMap.Mapnik)"

Check failure on line 33 in examples/BaseMap.ipynb

GitHub Actions / run (ubuntu-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `GeoJSON` may be undefined, or defined from star imports

Check failure on line 33 in examples/BaseMap.ipynb

GitHub Actions / run (macos-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `GeoJSON` may be undefined, or defined from star imports
]
},
{

Check failure on line 36 in examples/BaseMap.ipynb

GitHub Actions / run (ubuntu-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `LayersControl` may be undefined, or defined from star imports

Check failure on line 36 in examples/BaseMap.ipynb

GitHub Actions / run (macos-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `LayersControl` may be undefined, or defined from star imports
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [

Check failure on line 40 in examples/BaseMap.ipynb

GitHub Actions / run (ubuntu-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `Map` may be undefined, or defined from star imports

Check failure on line 40 in examples/BaseMap.ipynb

GitHub Actions / run (macos-latest, 3.8)

Ruff (F405)

examples/BaseMap.ipynb:1:1: F405 `Map` may be undefined, or defined from star imports
{
"data": {
"application/vnd.jupyter.widget-view+json": {
await page.notebook.save();
for (let c = 0; c < numCellImages; ++c) {
expect(results[c]).toMatchSnapshot(

Check failure on line 74 in ui-tests/tests/ipyleaflet.test.ts

GitHub Actions / Visual Regression (3.8)

tests/ipyleaflet.test.ts:92:7 › ipyleaflet Visual Regression › Light theme: Check ipyleaflet renders

1) tests/ipyleaflet.test.ts:92:7 › ipyleaflet Visual Regression › Light theme: Check ipyleaflet renders Error: Screenshot comparison failed: 1 pixels (ratio 0.01 of all image pixels) are different. Expected: /home/runner/work/ipyleaflet/ipyleaflet/ui-tests/tests/ipyleaflet.test.ts-snapshots/light--LayerIndex-ipynb-cell-0-linux.png Received: /home/runner/work/ipyleaflet/ipyleaflet/ui-tests/test-results/tests-ipyleaflet-ipyleaflet-Visual-Regression-Light-theme-Check-ipyleaflet-renders/light--LayerIndex-ipynb-cell-0-actual.png Diff: /home/runner/work/ipyleaflet/ipyleaflet/ui-tests/test-results/tests-ipyleaflet-ipyleaflet-Visual-Regression-Light-theme-Check-ipyleaflet-renders/light--LayerIndex-ipynb-cell-0-diff.png 72 | 73 | for (let c = 0; c < numCellImages; ++c) { > 74 | expect(results[c]).toMatchSnapshot( | ^ 75 | getCaptureImageName(contextPrefix, notebook, c) 76 | ); 77 | } at testCellOutputs (/home/runner/work/ipyleaflet/ipyleaflet/ui-tests/tests/ipyleaflet.test.ts:74:26) at /home/runner/work/ipyleaflet/ipyleaflet/ui-tests/tests/ipyleaflet.test.ts:93:5

Check failure on line 74 in ui-tests/tests/ipyleaflet.test.ts

GitHub Actions / Visual Regression (3.8)

tests/ipyleaflet.test.ts:96:7 › ipyleaflet Visual Regression › Dark theme: Check ipyleaflet renders

2) tests/ipyleaflet.test.ts:96:7 › ipyleaflet Visual Regression › Dark theme: Check ipyleaflet renders Error: Screenshot comparison failed: 1 pixels (ratio 0.01 of all image pixels) are different. Expected: /home/runner/work/ipyleaflet/ipyleaflet/ui-tests/tests/ipyleaflet.test.ts-snapshots/dark--LayerIndex-ipynb-cell-0-linux.png Received: /home/runner/work/ipyleaflet/ipyleaflet/ui-tests/test-results/tests-ipyleaflet-ipyleaflet-Visual-Regression-Dark-theme-Check-ipyleaflet-renders/dark--LayerIndex-ipynb-cell-0-actual.png Diff: /home/runner/work/ipyleaflet/ipyleaflet/ui-tests/test-results/tests-ipyleaflet-ipyleaflet-Visual-Regression-Dark-theme-Check-ipyleaflet-renders/dark--LayerIndex-ipynb-cell-0-diff.png 72 | 73 | for (let c = 0; c < numCellImages; ++c) { > 74 | expect(results[c]).toMatchSnapshot( | ^ 75 | getCaptureImageName(contextPrefix, notebook, c) 76 | ); 77 | } at testCellOutputs (/home/runner/work/ipyleaflet/ipyleaflet/ui-tests/tests/ipyleaflet.test.ts:74:26) at /home/runner/work/ipyleaflet/ipyleaflet/ui-tests/tests/ipyleaflet.test.ts:97:5
getCaptureImageName(contextPrefix, notebook, c)
);
}