Konva js | Transformer double call onDragMove

100 views Asked by At

I have "Transformer" and several closed "Line". For the Line onDragMove I got a function defined that manually changes the x and y of the Line. The function first get the matrix, then resets the Line x and y to its old state, which is saved in a useState, and finally sets the new x and y to the useState with the given matrix.

The Problem: If I select two "Line" by adding them to the "Transformer" nodes and starting to drag Line 1, then the onDragMove function of Line 1 gets called one extra times at the beginning. I gave both Lines an ID and logged it out on call of the onDragMove function.

The Problem with that behavior is that now Line 1 got dragged a little more than Line 2.

Thank you for your help !

ps: I added a sandbox to better understand the problem.

0

There are 0 answers