summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Fabrice Leal <fabrice.leal.ch@gmail.com>2018-07-09 22:34:11 +0100
committerGravatar Fabrice Leal <fabrice.leal.ch@gmail.com>2018-07-09 22:43:43 +0100
commitb95811e4dab26d770c6d972a456ac0b31b39ca53 (patch)
tree96a49c4d42271ddaa5940c75dd13573ca97aa332
parentc98f27c7821f6d8f3add303da692630bba268d1d (diff)
offsetX, offsetY
-rw-r--r--lib/js/urweb.js2
-rw-r--r--lib/ur/basis.urs2
-rw-r--r--tests/mouseEvent.ur2
3 files changed, 5 insertions, 1 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 99b45ec9..ff4c7b7e 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -553,6 +553,8 @@ function uw_mouseEvent() {
_ScreenY : firstGood(ev.screenY, 0),
_ClientX : firstGood(ev.clientX, 0),
_ClientY : firstGood(ev.clientY, 0),
+ _OffsetX : firstGood(ev.offsetX, 0),
+ _OffsetY : firstGood(ev.offsetY, 0),
_CtrlKey : firstGood(ev.ctrlKey, false),
_ShiftKey : firstGood(ev.shiftKey, false),
_AltKey : firstGood(ev.altKey, false),
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 66cc0e50..3b67946f 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -830,7 +830,7 @@ val meta : unit -> tag [Nam = meta, Content = string, Id = id] head [] [] []
datatype mouseButton = Left | Right | Middle
-type mouseEvent = { ScreenX : int, ScreenY : int, ClientX : int, ClientY : int,
+type mouseEvent = { ScreenX : int, ScreenY : int, ClientX : int, ClientY : int, OffsetX : int, OffsetY : int,
CtrlKey : bool, ShiftKey : bool, AltKey : bool, MetaKey : bool,
Button : mouseButton }
diff --git a/tests/mouseEvent.ur b/tests/mouseEvent.ur
index 2192e0b0..32a67806 100644
--- a/tests/mouseEvent.ur
+++ b/tests/mouseEvent.ur
@@ -8,6 +8,8 @@ fun main () : transaction page = return <xml><body>
^ "\nScreenY = " ^ show ev.ScreenY
^ "\nClientX = " ^ show ev.ClientX
^ "\nClientY = " ^ show ev.ClientY
+ ^ "\nOffsetX = " ^ show ev.OffsetX
+ ^ "\nOffsetY = " ^ show ev.OffsetY
^ "\nCtrlKey = " ^ show ev.CtrlKey
^ "\nShiftKey = " ^ show ev.ShiftKey
^ "\nAltKey = " ^ show ev.AltKey