konvajs / konva

Konva.js is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.
http://konvajs.org/
Other
11.56k stars 925 forks source link

`mouseout`/`mouseleave` event not triggered while transforming #1810

Open ComfyFluffy opened 2 months ago

ComfyFluffy commented 2 months ago

In Transformer when we drag the rotator or other anchors the cursor will change. In the previous versions, the cursor will be reset immediately when the mouse leave the anchor. However, mouseout and mouseleave events are now not triggered, so the cursor will not be reset until mouse move. This could be resulted by https://github.com/konvajs/konva/commit/73d65cb7d3e8e1274913a3f604e081c0fab93f6d

You can reproduce the issue at: https://konvajs.org/docs/select_and_transform/Basic_demo.html

ComfyFluffy commented 2 months ago

In previous versions the cursor resets once the mouse leave the node, which is also not quite right as the cursor should be kept when dragging. I would like to open a PR to fix that. However, I don't know how can I fix it if we can not get when exactly the mouse leave the node.

lavrton commented 1 month ago

I think we can reset the cursor on when transform is finished. The PR is very welcome. If with the test, it is another level of awesomeness.

ComfyFluffy commented 1 month ago

Resetting the cursor is not sufficient, as the cursor may still stay on the cursor when the transformation is finished. We need the accurate hover information for a good implementation, which is why I opened the issue.

Actually I want to fully transform the cursor setting logic:

With this we can implement a rotator that has grab as its hovering cursor and grabbing as its dragging cursor. When rotating the cursor is always dragging, whether its being hovered or not.

lavrton commented 1 month ago

Maybe, but it sounds like an overkill for me.

as the cursor may still stay on the cursor when the transformation is finished

I don't see that is a large issue. We can enable hover back in that case.