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

Mouse/touch target available on Fit.Events.GetPointerState().Target but typings says Fit.Events.GetPointerState().Buttons.Target #178

Closed Jemt closed 1 year ago

Jemt commented 1 year ago

Title says it all: Mouse/touch target is available on Fit.Events.GetPointerState().Target but typings declares it on Fit.Events.GetPointerState().Buttons.Target which is wrong.

Jemt commented 1 year ago

Fixed with commit https://github.com/Jemt/Fit.UI/commit/fca144f9d6fca2c23de43bcab8e4cc53a4abd16e. Snippet useful for testing on touch devices without Developer Tools:

var sl = new Fit.Controls.SoftLog();
sl.CatchUncaughtExceptions(true);
sl.InterceptConsoleLog(true);
sl.Height(400, "px");
sl.Render(document.body);

Fit.Array.ForEach(["mousedown", "mouseup", "click", "touchstart", "touchend", "touchcancel"], function(type)
{
    Fit.Events.AddHandler(document, type, function(e)
    {
        console.log(e.type, Fit.Events.GetPointerState().Target);
    });
});

Fit.Events.AddHandler(sl.GetDomElement(), "dblclick", function() { sl.Clear(); });