konva icon indicating copy to clipboard operation
konva copied to clipboard

Transformer Maximum Call Stack Exceeded

Open bhamlefty opened this issue 2 years ago • 2 comments

I am getting this error when I mouse up after transforming elements. Any idea why I am getting this range error?

Screen Shot 2022-04-22 at 10 57 33 AM Screen Shot 2022-04-22 at 10 57 11 AM

bhamlefty avatar Apr 22 '22 18:04 bhamlefty

Demo?

lavrton avatar Apr 22 '22 18:04 lavrton

That is a full app. I am not interested to debug it. Instead, just make a minimal demo with jsbin or codesandbox or something similar. With only code required to reproduce the bug. Nothing else.

lavrton avatar Apr 22 '22 19:04 lavrton

I think I can help. and I guess you want to draw some rects on a image, and select one rect for resizing. @bhamlefty

There is a demo from konvajs website. https://konvajs.org/docs/select_and_transform/Basic_demo.html. in this demo, this line of code is important to prevent Maximum Call Stack Exceeded.

image

when click on the transformer to resize a rect, we click on one of the rect of a transformer, and then drag.

In my situation, without the line of code in the picture, transformer.nodes contains a rect which is a child of the transformer. and Maximum Call Stack Exceeded came out.

I add the line of code, it works well. I hope this will help you.

it is interesting to find out the reason of this problem. and I do not think it is a bug of konva. when click and resize a rect, do it carefaully.

chbinghu avatar Jul 27 '23 03:07 chbinghu