First attempt of patching Gnoga.Gui.Base for touchscreen events.
To simplify things I concentrate events onto mouse events.
Here are the changes and additions
Touch_Event_Script : constant String :=
"(e.touches[0].clientX - e.target.getBoundingClientRect().left) + '|' + " &
"(e.touches[0].clientY - e.target.getBoundingClientRect().top) + '|'";
procedure On_Mouse_Down_Handler (Object : in out Base_Type;
Handler : in Mouse_Event)
is
begin
if Object.On_Mouse_Down_Event /= null then
Object.Unbind_Event ("mousedown");
Object.Unbind_Event ("touchstart");
end if;
Object.On_Mouse_Down_Event := Handler;
if Handler /= null then
Object.Bind_Event (Event => "mousedown",
Message => "",
Script => Mouse_Event_Script);
Object.Bind_Event (Event => "touchstart",
Message => "",
Script => Touch_Event_Script);
end if;
end On_Mouse_Down_Handler;
...
elsif Event = "mousedown" or else Event = "touchstart" then
Object.Fire_On_Mouse_Down (Parse_Mouse_Event (Message, Mouse_Down));
Now the problems are:
The script Touch_Event_Script seems to crash - at least the event is not sent
to GNOGA.
If I use the Mouse_Event_Script instead, I get this:
Error Parse_Mouse_Event converting to Integer (forced to 0).
2017-05-11 09:22:38.12 : raised CONSTRAINT_ERROR : bad input for 'Value: "NaN"
2017-05-11 09:22:38.13 : Full message =
[NaN|NaN|undefined|undefined|0|false|false|false|false|]
It seems that the e.clientX etc. are undefined (if I understand well, the idea
is to track cases where several fingers are touching the screen, with
e.touches[0]. e.touches[1], ...)
Any clue how to make the Touch_Event_Script work ?
TIA
Gautier
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list