Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions bindings/pydeck/examples/01 - Introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down
19 changes: 17 additions & 2 deletions bindings/pydeck/pydeck/bindings/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
Loading