jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.7k stars 728 forks source link

How to disable drag-and-drop of nodes? #728

Closed a-kuzina closed 1 year ago

a-kuzina commented 1 year ago

Hello, is there any way to disable moving\drag-and-drop of nodes? I want to generate a diagram and show it to users with the ability to click on nodes and open a special popup. And they have to move arount diagram (wich is looks like drag-and-drop on background). But I don't want them to be able to move nodes around. So I can't just disable all events. What should I do?

I am using drawflow in angular html: <div id="drawflow"></div> ts: this.editor = new Drawflow(drawFlowHtmlElement); I create nodes as html strings and then use this.editor.addNode(...) to add them

jerosoler commented 1 year ago

Try

editor.editor_mode = 'fixed';

View other modes in readme

a-kuzina commented 1 year ago

Thank you! In this mode this.editor.on('nodeSelected' ... do not work because nodes can't be selected, but I worked it out with this.editor.on('click' ... event, so it works great!