Pan with the middle button, select several nodes, and fit properly
Three things the graph view did differently from the scene view, or not at all: Panning moves to the middle button, which works from anywhere – a node under the pointer included, since NodeView now lets that one button bubble up. Shift-drag on empty canvas pans too. The left button pulls a rubber band instead and no longer pans. Nodes can be selected several at a time: by band, by ctrl/shift-click, moved together, deleted together, each as one undo step. The selection model gains `nodeIds` alongside the objects' `objectIds`. Fit really fits. It used to pin the zoom at 1 and merely centre, so a graph larger than the view always left nodes hanging out, and it sized every node with one guessed height although real ones vary with their port count. Both sums now live in editor/graph/framing.ts as pure functions, which is what made the defect testable at all. The band selects any node it overlaps rather than one whose position it contains, unlike the scene view: nodes are large rectangles, and a band drawn visibly across one has to catch it.
This commit is contained in:
1 parent
ed1fe31c77
commit
e0d43e12aa
12 files changed
+656
-61
No files matched your search
@@ -155,6 +155,10 @@ export function installDebugHook(app: Application, state: EditorState, editor: E
|
||||
portAt: (nodeId: string, port: string, isOutput: boolean) =>
|
||||
graphEditor.canvas.portGlobal(nodeId, port, isOutput),
|
||||
nodeAt: (nodeId: string) => graphEditor.canvas.nodeGlobal(nodeId),
|
||||
/** Drawn rectangles on screen: what "fit" has to keep inside `canvasRect`. */
|
||||
nodeRect: (nodeId: string) => graphEditor.canvas.nodeRect(nodeId),
|
||||
canvasRect: () => graphEditor.canvas.canvasRect(),
|
||||
selected: () => state.selectedNodeIds,
|
||||
dropTarget: () => graphEditor.canvas.pendingDropTarget(),
|
||||
danglingEdge: () => graphEditor.canvas.danglingEdgeVisible(),
|
||||
// The canvas, not the whole tab: a centre measured through the header sits above the
|
||||
|
||||
Reference in new issue
Block a user