From 11d1ea69495632c7269c71133c231ddebb57a5d0 Mon Sep 17 00:00:00 2001 From: vatsashah45 Date: Thu, 20 Feb 2025 12:36:11 -0500 Subject: [PATCH 1/5] chore: Update docs with ZCC usage --- doc/controls/ZoomContentControl.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/doc/controls/ZoomContentControl.md b/doc/controls/ZoomContentControl.md index b8c95813e..94c150ae1 100644 --- a/doc/controls/ZoomContentControl.md +++ b/doc/controls/ZoomContentControl.md @@ -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 (Mouse Wheel + Ctrl) +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). \ No newline at end of file From 7d5aecbb42d03eaf64862d427b7cd77939584e1e Mon Sep 17 00:00:00 2001 From: vatsashah45 Date: Thu, 20 Feb 2025 12:49:19 -0500 Subject: [PATCH 2/5] chore: change title --- doc/controls/ZoomContentControl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/controls/ZoomContentControl.md b/doc/controls/ZoomContentControl.md index 94c150ae1..2e75154ff 100644 --- a/doc/controls/ZoomContentControl.md +++ b/doc/controls/ZoomContentControl.md @@ -75,7 +75,7 @@ Below are the built-in interactions for ZoomContentControl usage. For these inte 2. Active (`IsActive` = true). 3. Zooming and/or panning is allowed (`IsZoomAllowed`/`IsPanAllowed` = true). -#### Zooming (Mouse Wheel + Ctrl) +#### 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. From 5bcf9d2df4f2b6efe23cd21b6ea28c5e0dd33a7d Mon Sep 17 00:00:00 2001 From: vatsashah45 Date: Thu, 20 Feb 2025 17:26:54 -0500 Subject: [PATCH 3/5] chore: Added advanced usage section in the docs --- doc/controls/ZoomContentControl.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/controls/ZoomContentControl.md b/doc/controls/ZoomContentControl.md index 2e75154ff..f29b7dceb 100644 --- a/doc/controls/ZoomContentControl.md +++ b/doc/controls/ZoomContentControl.md @@ -93,4 +93,23 @@ Release the mouse button to stop panning. 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). \ No newline at end of file +`ResetViewport()`: Resets both zoom level and offset to their defaults (zoom = 1, scroll offsets = 0). + +### Advanced Usage: Overriding Pointer Methods + +ZoomContentControl does not subscribe to pointer events directly. Instead, it overrides the base OnPointer methods. This lets you derive from ZoomContentControl and fully customize pointer handling in your subclass. For example: + +```csharp +public class MyCustomZoomControl : ZoomContentControl +{ + protected override void OnPointerPressed(PointerRoutedEventArgs e) + { + // Skip or extend default behavior: + // base.OnPointerPressed(e); + + // Implement your own pointer logic here... + } +} +``` + +If you do not call `base.OnPointerPressed(e)`, you bypass the built-in pan/zoom logic entirely. This approach lets you disable or alter parts of the default pointer behavior without modifying the original code. \ No newline at end of file From 059a16bf25a39bea8622ad87a6de24fe52e4dd0f Mon Sep 17 00:00:00 2001 From: vatsashah45 Date: Thu, 20 Feb 2025 17:43:44 -0500 Subject: [PATCH 4/5] fix: linter issues --- doc/controls/ZoomContentControl.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/controls/ZoomContentControl.md b/doc/controls/ZoomContentControl.md index f29b7dceb..2d93404ca 100644 --- a/doc/controls/ZoomContentControl.md +++ b/doc/controls/ZoomContentControl.md @@ -76,20 +76,24 @@ Below are the built-in interactions for ZoomContentControl usage. For these inte 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. From 9c095caafb9da8b43c3e33e76eda7f498801b53b Mon Sep 17 00:00:00 2001 From: vatsashah45 Date: Fri, 21 Feb 2025 10:23:16 -0500 Subject: [PATCH 5/5] fix: linter issues --- doc/controls/ZoomContentControl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/controls/ZoomContentControl.md b/doc/controls/ZoomContentControl.md index 2d93404ca..51cf9d205 100644 --- a/doc/controls/ZoomContentControl.md +++ b/doc/controls/ZoomContentControl.md @@ -116,4 +116,4 @@ public class MyCustomZoomControl : ZoomContentControl } ``` -If you do not call `base.OnPointerPressed(e)`, you bypass the built-in pan/zoom logic entirely. This approach lets you disable or alter parts of the default pointer behavior without modifying the original code. \ No newline at end of file +If you do not call `base.OnPointerPressed(e)`, you bypass the built-in pan/zoom logic entirely. This approach lets you disable or alter parts of the default pointer behavior without modifying the original code.