From e3e18d67405468daaa4fc24e5f487f678d985ea6 Mon Sep 17 00:00:00 2001 From: miroiu Date: Tue, 23 Jul 2024 20:25:51 +0300 Subject: [PATCH] Add minimap documentation --- .../Editor/NodifyEditorView.xaml | 4 +- Examples/Nodify.Shapes/Canvas/CanvasView.xaml | 2 +- docs/Connections-Overview.md | 20 +++-- docs/Minimap-Overview.md | 73 +++++++++++++++++++ docs/_Sidebar.md | 27 ++++++- 5 files changed, 114 insertions(+), 12 deletions(-) create mode 100644 docs/Minimap-Overview.md diff --git a/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml b/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml index 3cd96f7b..5873f9f4 100644 --- a/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml +++ b/Examples/Nodify.Playground/Editor/NodifyEditorView.xaml @@ -472,8 +472,8 @@ - - - [!TIP] +> For real-time movement of nodes inside the minimap, it's required to set `NodifyEditor.EnableDraggingContainersOptimizations` to `false`. + +The control also displays a viewport rectangle that represents the visible area in the editor and requires the `ViewportLocation` and `ViewportSize` properties to be set. + +```xml + + + + + +``` + +```csharp +private void OnMinimapZoom(object sender, ZoomEventArgs e) +{ + Editor.ZoomAtPosition(e.Zoom, e.Location); +} +``` + +> [!IMPORTANT] +> The `Width` and `Height` should be constrained by the parent container or set to constant values on the `Minimap` to prevent resizing to fit the content. + +## Panning + +Panning is done by holding click and dragging and can be disabled by setting the `IsReadOnly` property to `true`. The `ViewportLocation` is updated during panning, therefore it must be a two-way binding (binds two ways by default). + +The panning gesture can be configured by setting `EditorGestures.Mappings.Minimap.DragViewport` to the desired gesture. + +## Zooming + +Zooming is done by scrolling the mouse wheel and can be disabled by setting the `IsReadOnly` property to `true` or by not handling the `Zoom` event. + +The zooming modifier key can be configured by setting `EditorGestures.Mappings.Minimap.ZoomModifierKey` to the desired value. + +## Customization + +The `ViewportStyle` is used to customize the viewport rectangle. + +```xml + + + +``` + +The `MaxViewportOffset` property is used to restrict how far the viewport can be moved away from the items when [panning](#panning). + +The `ResizeToViewport` property changes the resizing behavior of the minimap. +If `true`, the minimap will resize to always display the viewport alongside the items. + +![scale-with-viewport](https://github.com/user-attachments/assets/7a8887bf-f3f4-44d7-8311-6d9ba7869d78) + +If `false`, the minimap will resize to only include the items, allowing the viewport to go out of bounds. + +![viewport-out-of-bounds](https://github.com/user-attachments/assets/5d3b388e-8e40-4bfe-af3b-4c12fb47548d) diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md index 97f40903..f170fcbc 100644 --- a/docs/_Sidebar.md +++ b/docs/_Sidebar.md @@ -1,9 +1,12 @@ -| [English](https://github.com/WYihei/nodify/wiki/Home) | [简体中文](https://github.com/WYihei/nodify/wiki/主页) -| --- | --- | -*** +| [English](https://github.com/WYihei/nodify/wiki/Home) | [简体中文](https://github.com/WYihei/nodify/wiki/主页) | +| ----------------------------------------------------- | ------------------------------------------------------ | + +--- + ## [Home](Home) [Getting Started](Getting-Started) + - [Hierarchy and terminology](Getting-Started#hierarchy-and-terminology) - [Content layers](Getting-Started#content-layers) - [Creating an editor](Getting-Started#creating-an-editor) @@ -12,6 +15,7 @@ - [Drawing a grid](Getting-Started#drawing-a-grid) [Editor overview](Editor-Overview) + - [Moving the viewport](Editor-Overview#panning) - [Zooming](Editor-Overview#zooming) - [Selecting items](Editor-Overview#selecting) @@ -19,21 +23,36 @@ - [Commands](Editor-Overview#commands) [ItemContainer overview](ItemContainer-Overview) + - [Selecting](ItemContainer-Overview#selecting) - [Moving](ItemContainer-Overview#moving-and-dragging) [Nodes overview](Nodes-Overview) + - [The node](Nodes-Overview#1-the-node-control) - [The grouping node](Nodes-Overview#2-the-groupingnode-control) - [The knot node](Nodes-Overview#3-the-knotnode-control) - [The state node](Nodes-Overview#4-the-statenode-control) [Connections overview](Connections-Overview) + - [Base connection](Connections-Overview#base-connection) +- [Bezier connection](Connections-Overview#connection) +- [Line connection](Connections-Overview#line-connection) +- [Circuit connection](Connections-Overview#circuit-connection) +- [Step connection](Connections-Overview#step-connection) - [Pending connection](Connections-Overview#pending-connection) [Connectors overview](Connectors-Overview) +- [NodeInput and NodeOutput](Connectors-Overview#nodeinput-and-nodeoutput) + +[Minimap overview](Minimap-Overview) + +- [Moving the viewport](Minimap-Overview#panning) +- [Zooming](Minimap-Overview#zooming) +- [Customization](Minimap-Overview#customization) + [API Reference](API-Reference) -[(FAQ) Frequently asked questions](FAQ) \ No newline at end of file +[(FAQ) Frequently asked questions](FAQ)