Viewport Transitions
Every viewport helper has an async twin that eases over a duration - SetCenterAsync, FitViewAsync, FitBoundsAsync, ZoomToAsync and SetViewportAsync. Jumping between two far-apart parts of a graph loses the reader; a short eased transition tells them which way they travelled.
Drag the pane mid-flight: the drag wins.
Press Tab to move between the nodes and edges of the diagram.
Press Enter or Space to select it, Shift with Enter to add it to the selection, the arrow keys to move the selected nodes, Delete to remove them and Escape to clear the selection. Press C to start a connection from it.
Press Enter or Space to select it, Delete to remove it and Escape to clear the selection. Press C to move its end to another node.
bit BlowTry it
- Drag Duration to choose how long each move takes; at instant every button jumps.
- Fly to Start and Fly to Finish glide to the two ends of the graph and zoom to 120%; Frame the fan-out fits the two middle nodes, and Fit all the whole graph.
- Zoom to 200% zooms about the middle of the pane without panning.
- Bookmark this view remembers where you are; pan away, then Back to bookmark glides back to it.
- Watch the readout at the end of the toolbar: it says moving with the zoom of every frame while a transition runs, and settled once it ends.
- Start a long transition, then drag the pane before it lands: the transition stops where it got to and the drag takes over. Pressing another button mid-flight starts the new move from there.
- Set Motion to Reduce: every button jumps whatever the duration, and the animated edges keep their dashes but stop marching. Always animate ignores the operating system's setting.
How it works
SetCenterAsync(x, y, zoom, durationMs)centres a flow point, here the middle of a node fromGetNode(id).GetRect().FitBoundsAsync(rect, padding, durationMs)fits any flow-spaceBlowRect- the box round the two middle nodes - andFitViewAsync(options)fits nodes, taking its duration fromBlowFitViewOptions.Duration.ZoomToAsync(zoom, durationMs)sets an absolute zoom about the pane centre. Every helper clamps toMinZoomandMaxZoom- lowered to 0.1 here so the whole graph fits.GetViewport()reads the currentBlowViewport, andSetViewportAsync(viewport, durationMs)eases back to a saved one.- Each has a synchronous twin -
SetCenter,FitBounds,FitView,ZoomTo,SetViewport- that never animates; a duration of 0 makes the async ones apply at once too. - A new request cancels the one in flight, so the last one wins; a user pan, pinch or scroll abandons it, since a transition still easing to its old target would fight the pointer.
OnMoveStartandOnMoveEndbracket a transition as they do a gesture, andOnMovereports every frame in between.ReducedMotion(defaultBlowReducedMotion.System) follows the operating system's reduce-motion setting;AlwaysandNeveroverride it, andReducesMotionsays which is in force.