Closed tlvenn closed 1 year ago
I experienced that before I think, sucks... try to apply some small delay? I think it might be a race condition on the ticker, flutter capturing the mouse, and the native method call to change cursors.
Ya tried different things with no luck... In some ways, I wonder if this is not a flutter bug as it should ensure to restore the default cursor when the mouse leave the app.
Maybe the target platform should have to take care of that? Is a native method call (c++ backend) to change cursor after all. I think web will behave differently than macOS, and windows.
In any case, originally (when i wrote it) was working as expected on web and macos.
What I am using now (still untested on Windows) is delaying the call to restore the mouse. Is very nasty indeed. But a few ms worked for me (dragging in graphx change to precise cursor, leaving the stage, in the macos window, return to basic cursor... reactivates on mouseEnter on last state saved cursor state, OR using some event like mouseOver or mouseMove to force the cursor to refrssh while interacting with the object). So yeah, nasty, but works for me.
Im using tween calls instead of Timers for the callback.
GTween.delayCall( 0.2, activate) If u need to "stop it" GTween.killTweensOf(activate)
As i have to change many cursors according to the UI, is a little tedious in my case. But Im always making sure that "basic" (which is a clearCursor delayed callback) gets called after 2x time than my delayed setCursor, so setCustom cursor takes always priority in time and kills the clearCursor (if that makes any sense)
If you keep a very low number (> 16ms) is not even noticeable the jump of cursors. Just be sure to track properly which active cursor u have and avoid that "basic" delay hits while u change cursors.
I think thats all i can offer as input regarding this issue @tlvenn , 🫤 sorry.
Thanks a lot for the guidance @roipeker , very helpful !
Hi @roipeker,
Depending on where the cursor is on my stage, I customize it and sometimes, i hide it so I can draw something myself. The issue I have is that when the user is moving the mouse outside the stage, i can't seem to be able to restore the default cursor.
I have tried to use
stage!.onMouseLeave((event) => GMouse.basic());
but it does not work.Any idea how to do this ? Thanks !