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

chore: Update docs with ZoomContentControl usage #1353

Merged
merged 5 commits into from
Feb 21, 2025
Merged
Changes from 2 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
28 changes: 28 additions & 0 deletions doc/controls/ZoomContentControl.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,31 @@ xmlns:utu="using:Uno.Toolkit.UI"
| ----------------- | ----------- | ----------------------------------------------------------------------------------------- |
| `FitToCanvas()` | `void` | Adjust the zoom level so that the content fits within the available space. |
| `ResetViewport()` | `void` | Resets the zoom level and panning offset to their default values and centers the content. |

### Usage

Below are the built-in interactions for ZoomContentControl usage. For these interactions to work, ensure the control is:

1. Visible and loaded (`IsLoaded` is true).
2. Active (`IsActive` = true).
3. Zooming and/or panning is allowed (`IsZoomAllowed`/`IsPanAllowed` = true).

#### Zooming (Ctrl + Mouse Wheel)
Ctrl + Mouse Wheel: Zoom in/out around the current cursor position.
The `ScaleWheelRatio` property controls how quickly the zoom factor changes per mouse wheel tick.

#### Scrolling (Mouse Wheel)
Mouse Wheel by itself scrolls vertically.
Shift + Mouse Wheel scrolls horizontally.
The `PanWheelRatio` property determines how many pixels to move per mouse wheel tick.

#### Panning (Middle-Click + Drag)
Press and hold the middle button.
Drag to move the content.
Release the mouse button to stop panning.

#### Programmatic Control
Beyond user interactions, you can control zoom and pan directly:

`FitToCanvas()`: Automatically sizes the content so it fits the entire available space.
`ResetViewport()`: Resets both zoom level and offset to their defaults (zoom = 1, scroll offsets = 0).
Loading