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(): Mouse button state and mouse target is lost OnMouseOut #153

Open FlowIT-JIT opened 2 years ago

FlowIT-JIT commented 2 years ago

See https://github.com/Jemt/Fit.UI/blob/23ce04121c17f56660c64d469602cd3e26eb0adc/Core/Events.js#L796

image

This does not seem right. Why would we reset the state of the mouse buttons or the target on which a mouse event occurred when the mouse leaves that particular element? We do not do this for the OnTouchMove event: https://github.com/Jemt/Fit.UI/blob/23ce04121c17f56660c64d469602cd3e26eb0adc/Core/Events.js#L863

This design means that we will not be able to reliably obtain button state from outside of mouse events (e.g. from something that happens via a timer or otherwise async.) using Fit.Events.GetPointerState().

This seems like a bug or at least poor design. See if we can get rid of it.

IMPORTANT: Make sure this works properly if mouse/finger is moved outside of viewport at some point.

FlowIT-JIT commented 2 years ago

Actual use case for a fix can be found here: https://github.com/Jemt/Fit.UI/blob/223fc46148d08fe9309ec3370386c4c63cbe8059/Controls/Dialog/Dialog.js#L1081