konvajs/konva

Feature Request: Transformer support custom create anchor

leecz opened this issue · 3 comments

to solve the problem: arrow transform like excalidraw's arrow

I wish to have a function createCustomAnchor in Transformer class like _createAnchor, and this function will return the created anchor,so i can bind event handlers to them 。

Thank you for this great library!

@leecz
You can use anchorStyleFunc.
That function receives 1 Shape as argument

Another way to do that, you can use .findOne to get each of the corners by name and add the event listeners on them. Transformer is just a Group, so you can use multiple ways to get the elements inside

leecz commented

@bogdan-nourescu
Thanks!
I tried。
It can barely achieve the requirements, but the effect is not good and it is a bit complicated because it needs to switch between two types of transformers。

It would be better if Tansformer could open an interface for creating custom anchors, and these anchors could automatically listen to built-in transform events (such as _handleMouseMove)。