v1.2.0: implemented event/button functionality for right/middle click

This commit is contained in:
Evan Debenham
2022-02-11 15:18:02 -05:00
parent cf638965a4
commit a1a5ff3de8
3 changed files with 43 additions and 7 deletions

View File

@@ -62,7 +62,19 @@ public class Button extends Component {
@Override
protected void onClick( PointerEvent event ) {
if (!processed) {
Button.this.onClick();
killTooltip();
switch (event.button){
case PointerEvent.LEFT: default:
Button.this.onClick();
break;
case PointerEvent.RIGHT:
Button.this.onRightClick();
break;
case PointerEvent.MIDDLE:
Button.this.onMiddleClick();
break;
}
}
}
@@ -131,7 +143,13 @@ public class Button extends Component {
protected void onPointerDown() {}
protected void onPointerUp() {}
protected void onClick() {}
protected void onClick() {} //left click, default key type
protected void onRightClick() {
onClick();
}
protected void onMiddleClick() {
onClick();
}
protected boolean onLongClick() {
return false;
}