|
| 1 | +# Scrollable viewport |
| 2 | + |
| 3 | +<img src="https://resources.gdevelop-app.com/assets/Icons/drag-variant.svg" class="extension-icon"></img> |
| 4 | +Move a camera by dragging or with the scroll wheel. |
| 5 | + |
| 6 | +**Authors and contributors** to this experimental extension: [D8H](https://gd.games/D8H), [ddabrahim](https://gd.games/ddabrahim), [VictrisGames](https://gd.games/VictrisGames). |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +Move a camera by dragging or with the scroll wheel. |
| 11 | + |
| 12 | +It can be used for |
| 13 | + |
| 14 | +- Making a scroll view ([open the project online](https://editor.gdevelop.io/?project=example://scrollbar)) |
| 15 | +- Dragging the camera on a top-down game |
| 16 | + |
| 17 | +!!! tip |
| 18 | + Learn [how to install new extensions](/gdevelop5/extensions/search) by following a step-by-step guide. |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +## Scrollable viewport |
| 23 | + |
| 24 | +Move a camera by dragging or with the scroll wheel. |
| 25 | + |
| 26 | +### Behavior properties |
| 27 | + |
| 28 | +- **Direction** (Choice, one of: "Vertical", "Horizontal", "Both"). |
| 29 | +- **InertiaDeceleration** (🔢 Number, Acceleration). Default value is `800`. |
| 30 | +- **Dragged layer** (🔤 String). The dragged layer must be different from this object layer. |
| 31 | +- **Wheel scrolling duration** (🔢 Number, Duration). Default value is `0.25`. |
| 32 | +- **Step size** (🔢 Number, Distance). Default value is `120`. |
| 33 | + |
| 34 | +??? quote "See internal technical details" |
| 35 | + |
| 36 | + |
| 37 | + - **Direction** is stored as `Direction` (Choice). Default value is ``. |
| 38 | + - **InertiaDeceleration** is stored as `InertiaDeceleration` (Number). Unit is PixelAcceleration. Default value is `800`. |
| 39 | + - **Dragged layer** is stored as `Layer` (String). Default value is ``. |
| 40 | + - **Wheel scrolling duration** is stored as `WheelScrollingDuration` (Number). Unit is Second. Default value is `0.25`. |
| 41 | + - **Step size** is stored as `WheelStepSize` (Number). Unit is Pixel. Default value is `120`. |
| 42 | + |
| 43 | +### Behavior conditions |
| 44 | + |
| 45 | +**Camera is being dragged** |
| 46 | +Check if camera is being dragged from this object. |
| 47 | + |
| 48 | +??? quote "See parameters & details" |
| 49 | + |
| 50 | + - Parameter 0: 👾 Object |
| 51 | + - Parameter 1: 🧩 Behavior |
| 52 | + |
| 53 | + > Technical note: parameter 2 is an internal parameter handled by GDevelop. |
| 54 | + |
| 55 | + > Technical note: this condition internal type (in GDevelop JSON) is `ScrollableViewport::ScrollableViewport::IsDragged`. |
| 56 | + |
| 57 | + |
| 58 | +_No expressions for this behavior._ |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +*This page is an auto-generated reference page about the **Scrollable viewport** extension for [GDevelop, the open-source, AI-powered, cross-platform game engine designed for everyone](https://gdevelop.io/).* Learn more about [all GDevelop extensions here](/gdevelop5/extensions). |
0 commit comments