Expected length "-Infinity"
Hello!
I looked into some of your source code, and realized that in case of using 'Straight' connector it is possible to get unhandled errors.
Here (https://github.com/jsplumb/jsPlumb/blob/master/src/connectors-straight.js#L28) in case when connector length is zero (for example while dragging new connection) due to this (https://github.com/jsplumb/jsPlumb/blob/master/src/defaults.js#L574) check, and because couple of lines above we have resetted (https://github.com/jsplumb/jsPlumb/blob/master/src/connection.js#L440) bounds into infinitives and then called calculate (https://github.com/jsplumb/jsPlumb/blob/master/src/defaults.js#L688) function, connector bounds will not be re-calculated during compute function call at all.
This cause to errors like this:
jsplumb.js:13036 Error: <svg> attribute width: Expected length, "-Infinity".
jsplumb.js:13036 Error: <svg> attribute height: Expected length, "-Infinity".
This issue occurs when you starting to drag a new connection and move cursor very close to source endpoint i.e. when connection length is zero.
I think I have a related warning, when connecting two nodes programmatically I get
"Unexpected value -Infinity parsing width attribute. "
Although only in some cases, I haven't figured out how to reproduce that.
I have the same issue, and also did Edward Wong a year ago: https://groups.google.com/forum/#!topic/jsplumb/PuDfP5QbQfc
I should provide a minimal code reproducing this bug, but I really can't right now, sorry
@Eugenitals @Lucas-C did you find any workarounds for this issue?
Speaking about reproduction you can use this demo https://jsplumbtoolkit.com/demos/wrapped/draggableConnectors/index.html for example, click on the green dot and try to slightly drag it to the top.
@andrewfan No i didn't. But actually it didn't break my code, just spam in console.
this issue hasn't been resolved yet, has it?
- The reason of the problem is because you addNode and addEdge before rendering, and those endpoint are overlapping.
- So you need to put those addNode, addEdge in toolkit.batch(...).
- batch() temporary stops rendering, do things in batch(), and refresh afterwards. Just search for batch() in jsplumb you will understand.
hmm but those method calls are in the Toolkit edition, @wuhduhren .
Yeah, I am using the Toolkit. But I saw batch in community edition's document too. https://jsplumbtoolkit.com/community/doc/home.html (search: batch
I'm using Community, and the batch() option doesn't not stop this error from happening in the console.
I fixed this in pull request jsplumb/jsplumb#788 for our connector configuration (StateMachine). I think it also works for other connector configurations.
Still facing this error.