roipeker / graphx

GraphX package for Flutter.

Home Page:https://pub.dev/packages/graphx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ScenePainter._detectMouseMove() should be optional

tlvenn opened this issue · comments

There are many situations where you simply don't need to detect mouseover mouseout events when the mouse is still but objects are moving or being hidden / displayed.

The issue is that I soon as you have a ticker, this will feed the system with still events every 16ms where the system will traverse the whole graph of object and proceed to do some hit test on them. This is expensive and should be avoided when you actually don't need it.

We should have a flag in the stage to turn this off.

I think we do no? stage.mouseEnabled=false

But I want mouse events 😄
This flag stage.mouseEnabled=false completely turns off mouse events handling.

Do you have any proposal for the flag name at stage level?
Basically to not compute mouse events on each tick, but only when the Signals arrives ?

ha naming things.... 😅

mouseEnableStillEvents maybe ? This is probably the most straightforward name even though it does not convey ultimately what it actually achieve...

I tried to come up with a concise name that would explain what this is achieving but failed..

With proper comment on the flag this should be relatively ok I believe.

Maybe stage.trackMouseHitTest ?

The problem is even if this is false, we still do track mousehit mouseover mouseout when the mouse actually move so this would end up being pretty misleading.

So maybe stage.trackStillMouseHitTest ? 🤔

stage.trackMouseOnTick ?
Anyhow, do you feel comfortable to implement it, test it on ur project (+ some repo examples/) and push a PR?

Sure thing i will push a PR no worry about that.

Submitted a tiny PR to add the flag.

Thanks for the contributions @tlvenn !