diff --git a/bindings/pydeck/examples/01 - Introduction.ipynb b/bindings/pydeck/examples/01 - Introduction.ipynb index 02323f5b115..ab630309186 100644 --- a/bindings/pydeck/examples/01 - Introduction.ipynb +++ b/bindings/pydeck/examples/01 - Introduction.ipynb @@ -133,6 +133,18 @@ "r.show()" ] }, + { + "cell_type": "code", + "source": "# Create a custom view with scroll zoom disabled\nview = pdk.View(type='MapView', controller={'scrollZoom': False})\n\n# Render with the custom view\nr_no_scroll = pdk.Deck(\n layers=[layer],\n initial_view_state=view_state,\n views=[view],\n widgets=[compass_widget, zoom_widget]\n)\nr_no_scroll.show()", + "metadata": {}, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": "## Controlling map interactions\n\nBy default, the map captures scroll wheel events for zooming. In a notebook environment, this can be annoying when you're trying to scroll the page. You can disable scroll zoom while keeping other interactions enabled by passing a controller configuration to the View:\n\n```python\nview = pdk.View(type='MapView', controller={'scrollZoom': False})\n```\n\nThis allows you to:\n- Still zoom with double-click\n- Still pan by dragging\n- Still rotate by holding Ctrl/Cmd and dragging\n- Scroll the notebook page without accidentally zooming the map", + "metadata": {} + }, { "cell_type": "markdown", "metadata": {}, diff --git a/bindings/pydeck/pydeck/bindings/view.py b/bindings/pydeck/pydeck/bindings/view.py index 766ecceed5d..6a8520efc5d 100644 --- a/bindings/pydeck/pydeck/bindings/view.py +++ b/bindings/pydeck/pydeck/bindings/view.py @@ -11,8 +11,23 @@ class View(JSONMixin): --------- type : str, default None deck.gl view to display, e.g., MapView - controller : bool, default None - If enabled, camera becomes interactive. + controller : bool or dict, default None + If True, camera becomes interactive with default settings. + If False, camera is not interactive. + If dict, camera becomes interactive with specified settings. + Supported settings include: + - scrollZoom : bool or dict, enable/disable scroll zoom + - doubleClickZoom : bool, enable/disable double click zoom + - touchZoom : bool, enable/disable touch zoom + - dragPan : bool, enable/disable drag pan + - dragRotate : bool, enable/disable drag rotate + - keyboard : bool or dict, enable/disable keyboard controls + + Example to disable scroll zoom:: + + view = pdk.View('MapView', {'scrollZoom': False}) # or + view = pdk.View(type='MapView', controller={'scrollZoom': False}) + **kwargs Any of the parameters passable to a deck.gl View """