jerosoler / Drawflow

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

Editor 'View' mode causes JS error when zooming in / out #480

Closed gpack closed 2 years ago

gpack commented 2 years ago

If the editor is set to "view" mode, and you try to zoom in / out, it throws an error, see below error:

Uncaught TypeError: Cannot read properties of null (reading 'classList') at i.click (drawflow.min.js?v=8:1:5524)

jerosoler commented 2 years ago

The problem is not in the zoom.

It is the element you are clicking on. Surely the element you are clicking is inside the drawflow container.

Add a class or remove the element from the parent container.

gpack commented 2 years ago

I don't click on any element. I just set the editor to editor.editor_mode = 'view' and load the page, then I click on the the "zoom out" button and it throws an error.

I tried it with your demo page too and it shows the same error. Try it at your end with the demo page, change the lock mode to "view" instead of "fixed" and then try zoom in or zoom out.

Using "fixed" or "edit mode works fine with the zoom-in and zoom-out, but for some reason, "view" mode causes this Javascript error

jerosoler commented 2 years ago

I don't click on any element. !== I click on the the "zoom out" button ??? I think this is a click.

The demo is a simple demonstration.

Try adding the buttons outside the drawflow container.

gpack commented 2 years ago

Ahh that was it! Moving the buttons outside the drawflow container fixed it.

Thanks Jero.