Search code examples
javascriptkonvajsreact-konvakonvakonvajs-reactjs

Konva js | Line Polygons x, y changes if Transformer changes size


I made an Rectangle with Line so that later progress I can edit its form. Also I wanted to be able to resize this Polygon. If I select it it gets added to a Transformers nodes. The Issue now is that if I scale the Polygon up the x and y of the Polygon also slightly go up. Does anyone know why this is happening?

Thank you for your help !

I have made to pictures so that the Problem is more obvious.

This is the Picture before scaling and the x, y

This is the Picture after scaling and the x, y


Solution

  • It may happen because of stroke scaling. You can set ignoreStroke: true for transformer to avoid that.

    Also, scaleStrokeEnabled: false for your Konva.Line may work better.