From bec0f4486910ca6c7a9f5f239c8365aa11c1c758 Mon Sep 17 00:00:00 2001 From: Ivan Hetman Date: Mon, 23 Nov 2020 10:47:30 +0200 Subject: [PATCH] JS: add missing mouseevent methods (#542) --- .../java/org/teavm/jso/dom/events/MouseEvent.java | 15 +++++++++++++++ .../teavm/jso/dom/events/MouseEventTarget.java | 10 +++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEvent.java b/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEvent.java index 76187622c..7b8efa2ef 100644 --- a/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEvent.java +++ b/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEvent.java @@ -41,6 +41,18 @@ public interface MouseEvent extends Event { @JSProperty int getClientY(); + @JSProperty + int getOffsetX(); + + @JSProperty + int getOffsetY(); + + @JSProperty + int getPageX(); + + @JSProperty + int getPageY(); + @JSProperty boolean getCtrlKey(); @@ -56,6 +68,9 @@ public interface MouseEvent extends Event { @JSProperty short getButton(); + @JSProperty + short getButtons(); + @JSProperty EventTarget getRelatedTarget(); diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEventTarget.java b/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEventTarget.java index c2c2c9475..7c296551e 100644 --- a/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEventTarget.java +++ b/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEventTarget.java @@ -48,6 +48,14 @@ public interface MouseEventTarget extends EventTarget { removeEventListener("mouseup", listener); } + default void listenMouseMove(EventListener listener) { + addEventListener("mousemove", listener); + } + + default void neglectMouseMove(EventListener listener) { + removeEventListener("mousemove", listener); + } + default void listenMouseOver(EventListener listener) { addEventListener("mouseover", listener); } @@ -64,7 +72,7 @@ public interface MouseEventTarget extends EventTarget { removeEventListener("mouseenter", listener); } - default void listenMouseLeaeve(EventListener listener) { + default void listenMouseLeave(EventListener listener) { addEventListener("mouseleave", listener); }