jerosoler / Drawflow

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

Navigating along the drawflow swiping with the mouse instead of dragging with click #701

Open javierherreromajorel opened 1 year ago

javierherreromajorel commented 1 year ago

Hello,

Thanks a lot for the amazing job you've made with this library. I have a quick suggestion. Is there a way to change the movement control for the dragflow panel by swiping with the mouse instead of grabbing the entire screen in order to navigate through all the space?

Thank you!

jerosoler commented 1 year ago

Hello,

Thanks!

Prevent drag option.

And implement your drag option.

    editor.on("clickEnd", (e) => {
      if(editor.editor_selected  === true) {
          editor.editor_selected = false;
          //Your code to translate;
      }
    })

You can see how the canvas moves in: https://github.com/jerosoler/Drawflow/blob/300c9efda3bf8820131b3e93ea50cd9b76c892d3/src/drawflow.js#LL352C10-L352C10

javierherreromajorel commented 1 year ago

Great, I will try to implement it during these days and post it here. Thanks a lot!