jerosoler / Drawflow

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

Only drag mode #164

Closed f-r3d closed 3 years ago

f-r3d commented 3 years ago

Hi', there is a way to only allow dragging elements and not editing? So that a user can move items to view them as he prefers without having the permission to remove/editing blocks?

jerosoler commented 3 years ago

Hey @f-r3d

Existing 3 methods.

editor.editor_mode = 'edit'; // Default
editor.editor_mode = 'fixed'; // Only scroll edit inputs
editor.editor_mode = 'view' // Only scroll not edit inputs

You can also combine it with something like: https://github.com/jerosoler/Drawflow/issues/142#issuecomment-802957642

Jero

f-r3d commented 3 years ago

Thanks, I prevent the default on box clicking in editing mode! It seems to work:

const allDnodes=document.querySelectorAll(".drawflow-node"); for(let i=0; i<allDnodes.length; i++) { allDnodes[i].onclick=function() { ... something } }