Transforming polygons on a draggable layer

115 views Asked by At

I'm looking at this past demo that was put together for using the Transformer component on a polygon. It all works well and adapted to my use case, but I'm running into issues when the scale is adjusted or the layer is dragged. When it happens, the Transformer will either keep making the transformed poly larger or smaller depending on the scale. I want the ability to zoom in and out while also being able to transform.

Here is a demo if anyone can provide some guidance.

https://codesandbox.io/s/intelligent-pond-zsygcz?file=/src/App.tsx

I tried transforming the polygon after I had adjusted the scale of the Stage/Layer component. I would expect after dragging the Layer component or adjusting scale the transform of a shape would work the same.

1

There are 1 answers

0
Trevor Thompson On

I was able to resolve this by using getTransform() instead of getAbsoluteTransform() so it wasn't taking the ancestors scale and transforms into account.