JS: add missing mouseevent methods (#542)

This commit is contained in:
Ivan Hetman 2020-11-23 10:47:30 +02:00 committed by GitHub
parent b718e7852f
commit bec0f44869
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -41,6 +41,18 @@ public interface MouseEvent extends Event {
@JSProperty @JSProperty
int getClientY(); int getClientY();
@JSProperty
int getOffsetX();
@JSProperty
int getOffsetY();
@JSProperty
int getPageX();
@JSProperty
int getPageY();
@JSProperty @JSProperty
boolean getCtrlKey(); boolean getCtrlKey();
@ -56,6 +68,9 @@ public interface MouseEvent extends Event {
@JSProperty @JSProperty
short getButton(); short getButton();
@JSProperty
short getButtons();
@JSProperty @JSProperty
EventTarget getRelatedTarget(); EventTarget getRelatedTarget();

View File

@ -48,6 +48,14 @@ public interface MouseEventTarget extends EventTarget {
removeEventListener("mouseup", listener); removeEventListener("mouseup", listener);
} }
default void listenMouseMove(EventListener<MouseEvent> listener) {
addEventListener("mousemove", listener);
}
default void neglectMouseMove(EventListener<MouseEvent> listener) {
removeEventListener("mousemove", listener);
}
default void listenMouseOver(EventListener<MouseEvent> listener) { default void listenMouseOver(EventListener<MouseEvent> listener) {
addEventListener("mouseover", listener); addEventListener("mouseover", listener);
} }
@ -64,7 +72,7 @@ public interface MouseEventTarget extends EventTarget {
removeEventListener("mouseenter", listener); removeEventListener("mouseenter", listener);
} }
default void listenMouseLeaeve(EventListener<MouseEvent> listener) { default void listenMouseLeave(EventListener<MouseEvent> listener) {
addEventListener("mouseleave", listener); addEventListener("mouseleave", listener);
} }