html: override rightclick contextmenu
This commit is contained in:
parent
6dfd180cb9
commit
6247cf00a3
@ -382,10 +382,10 @@ public class GwtInput implements Input {
|
|||||||
.addEventListener(
|
.addEventListener(
|
||||||
name,
|
name,
|
||||||
function(e) {
|
function(e) {
|
||||||
if (capture){
|
//if (capture){
|
||||||
e.preventDefault();
|
// e.preventDefault();
|
||||||
e.stopPropagation();
|
// e.stopPropagation();
|
||||||
}
|
//}
|
||||||
handler.@com.badlogic.gdx.backends.gwt.GwtInput::handleEvent(Lcom/google/gwt/dom/client/NativeEvent;)(e);
|
handler.@com.badlogic.gdx.backends.gwt.GwtInput::handleEvent(Lcom/google/gwt/dom/client/NativeEvent;)(e);
|
||||||
}, capture);
|
}, capture);
|
||||||
}-*/;
|
}-*/;
|
||||||
@ -451,9 +451,13 @@ public class GwtInput implements Input {
|
|||||||
addEventListener(canvas, "mousemove", this, true);
|
addEventListener(canvas, "mousemove", this, true);
|
||||||
addEventListener(Document.get(), "mousemove", this, true);
|
addEventListener(Document.get(), "mousemove", this, true);
|
||||||
addEventListener(canvas, getMouseWheelEvent(), this, true);
|
addEventListener(canvas, getMouseWheelEvent(), this, true);
|
||||||
addEventListener(Document.get(), "keydown", this, false);
|
|
||||||
addEventListener(Document.get(), "keyup", this, false);
|
// addEventListener(Document.get(), "keydown", this, false);
|
||||||
addEventListener(Document.get(), "keypress", this, false);
|
// addEventListener(Document.get(), "keyup", this, false);
|
||||||
|
// addEventListener(Document.get(), "keypress", this, false);
|
||||||
|
addEventListener(canvas, "keydown", this, false);
|
||||||
|
addEventListener(canvas, "keyup", this, false);
|
||||||
|
addEventListener(canvas, "keypress", this, false);
|
||||||
|
|
||||||
addEventListener(canvas, "touchstart", this, true);
|
addEventListener(canvas, "touchstart", this, true);
|
||||||
addEventListener(canvas, "touchmove", this, true);
|
addEventListener(canvas, "touchmove", this, true);
|
||||||
@ -474,6 +478,12 @@ public class GwtInput implements Input {
|
|||||||
|
|
||||||
private void handleEvent(NativeEvent e) {
|
private void handleEvent(NativeEvent e) {
|
||||||
|
|
||||||
|
if (e.getType().equals("contextmenu")) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.getType().equals("mousedown")) {
|
if (e.getType().equals("mousedown")) {
|
||||||
if (!e.getEventTarget().equals(canvas) || touched[0]) {
|
if (!e.getEventTarget().equals(canvas) || touched[0]) {
|
||||||
float mouseX = (int) getRelativeX(e, canvas);
|
float mouseX = (int) getRelativeX(e, canvas);
|
||||||
@ -499,7 +509,10 @@ public class GwtInput implements Input {
|
|||||||
}
|
}
|
||||||
this.currentEventTimeStamp = TimeUtils.nanoTime();
|
this.currentEventTimeStamp = TimeUtils.nanoTime();
|
||||||
if (processor != null)
|
if (processor != null)
|
||||||
processor.touchDown(touchX[0], touchY[0], 0, getButton(e.getButton()));
|
if (processor.touchDown(touchX[0], touchY[0], 0, getButton(e.getButton()))){
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.getType().equals("mousemove")) {
|
if (e.getType().equals("mousemove")) {
|
||||||
@ -546,7 +559,7 @@ public class GwtInput implements Input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.getType().equals("keydown") && hasFocus) {
|
if (e.getType().equals("keydown") && hasFocus) {
|
||||||
System.out.println("keydown");
|
//System.out.println("keydown");
|
||||||
int code = keyForCode(e.getKeyCode());
|
int code = keyForCode(e.getKeyCode());
|
||||||
if (code == 67) {
|
if (code == 67) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -562,14 +575,14 @@ public class GwtInput implements Input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.getType().equals("keypress") && hasFocus) {
|
if (e.getType().equals("keypress") && hasFocus) {
|
||||||
System.out.println("keypress");
|
//System.out.println("keypress");
|
||||||
char c = (char) e.getCharCode();
|
char c = (char) e.getCharCode();
|
||||||
if (processor != null)
|
if (processor != null)
|
||||||
processor.keyTyped(c);
|
processor.keyTyped(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.getType().equals("keyup") && hasFocus) {
|
if (e.getType().equals("keyup") && hasFocus) {
|
||||||
System.out.println("keyup");
|
//System.out.println("keyup");
|
||||||
int code = keyForCode(e.getKeyCode());
|
int code = keyForCode(e.getKeyCode());
|
||||||
this.pressedKeys.remove(code);
|
this.pressedKeys.remove(code);
|
||||||
if (processor != null)
|
if (processor != null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user