litegraph.js icon indicating copy to clipboard operation
litegraph.js copied to clipboard

Can we generate a minimap?

Open iyobo opened this issue 5 years ago • 4 comments

See title. A minimap is a way to show the birdseye view of a graph in a small box. Very useful with lots of nodes.

iyobo avatar May 09 '20 07:05 iyobo

The editor demo includes a button "Multiview" that shows how to deal with multi-canvas for the same graph (amazing), the minimap is almost done, if the second canvas is inside a dialog or docked and has a some point of zoom out you have it.

atlasan avatar Oct 15 '21 08:10 atlasan

hey @atlasan, I saw the implementation of the miniwindow for the editor. What was your use case for that functionality? Did you ever think about showing a rectangle in the miniwindow canvas that, when dragged, moves around the viewport in the primary canvas)? I mean something like the one in rete: https://codepen.io/Ni55aN/details/EqdVad when dragging the yellow rectangle, the viewport offset changes. This would allow to easily move the viewport to the desired part of the graph.

alessiapacca avatar Nov 15 '22 08:11 alessiapacca

Hi @alessiapacca! That was not me, I think @jagenjo properly made separated classes for the canvas object and graph allowing so to have multiple canvas for the same graph. If I would need the minimap functionality, I would look at the zoom and drag functionality to implement a small canvas linked with the main one applying the scaling factor to archive it.

atlasan avatar Nov 15 '22 21:11 atlasan

this should be quite easy, just copy the minimap offset from minimap canvas to maincanvas when user drags the minimap. I havent tested it though.

jagenjo avatar Nov 16 '22 08:11 jagenjo