jerosoler / Drawflow

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

Adding classes to container with id #drawflow breaks panning on this container #469

Open zezard opened 2 years ago

zezard commented 2 years ago

On row 202 in drawflow.js the code assumes that the class with index 0 will be related to the library:

switch (this.ele_selected.classList[0]) {
...

This fails if a user add other classes to the parent container eg. <div id="drawflow" class="some-class" />

This, in turn, breaks the panning outside the generated container with class .drawflow.

Could you consider looking for any of the relevant classes in a different way?

jerosoler commented 2 years ago

Hello, Yes I know the problem. It has an easy solution if you want more classes. It is to add the manual class.

<div id="drawflow" class="parent-drawflow some-class otherclass" />

I'll look to fix it.