About the issue
I'm working on a graphics editor built with konva.js
After hours of research, I cannot get the transformer to adjust to the clipped size of a group
Details
I have a group that defines a simple clip area, and within this there are 2 rectangles of the exact same size and position, stacked on top of each other.
- the bottom rectangle is filled with an image
- the top rectangle is filled with rgba colour
The clipped group works well; however, this application is dynamic, so, it takes input from the user to set a clip area. When I call group.clip()
and layer.batchDraw()
it does the clipping, but the bounding rectangle (transformer) does not update, even after I call transformer.forceUpdate()
on it, no luck.
What I've tried
When I destroy
the transformer and re-create it, it still indicates the full-size (not the clipped size) and the clipped-off region still remains.
Here's a screen-shot for clarity: Screenshot-20191008-153503.png
Some code
I doubt if this would even help, the code is in separate files and the values come from user-input as mentioned. For what it's worth, this is for you:
let grp = new Konva.Group({x:o.x,y:o.y,draggable:o.draggable,clip:{x:0,y:0,width:o.width,height:o.height}});
Any other code I paste here will just confuse the hect out of us all, it's A LOT, and I know people run when they see that, so, if I should add more code, please let me know in the comments?
I will appreciate any help, thanks.