Jemt / Fit.UI

Fit.UI is a JavaScript based UI framework built on Object Oriented principles
http://fitui.org
GNU Lesser General Public License v3.0
19 stars 7 forks source link

Fit.Events.GetPointerState() not usable between event targets #114

Open FlowIT-JIT opened 3 years ago

FlowIT-JIT commented 3 years ago

Fit.Events.GetPointerState().Buttons.Primary will reveal true OnMouseDown, but will return false OnMouseLeave even when button is kept down, because the event state is reset between event targets.

image

Looking at the code above, it seems wrong. It does not reveal the current state of the mouse buttons, it is just reset. And the Target property is not updated, meaning we won't be able to user GetPointerState() in e.g. OnMouseLeave to get the target we are leaving. Perhaps the intention was to reset the state when leaving the document (moving the pointer outside of the viewport area) where we won't be able to detect the release of a mouse button.

In any case, event handlers should query the current state via the event argument. Introduce overload?: Fit.Events.GetPointerState(evArgs)