v1.2.0: adjusted default functionality for right and middle clicks

This commit is contained in:
Evan Debenham
2022-02-17 11:46:34 -05:00
parent 36987fbdc9
commit aa43adf833
2 changed files with 7 additions and 15 deletions
@@ -144,12 +144,8 @@ public class Button extends Component {
protected void onPointerDown() {} protected void onPointerDown() {}
protected void onPointerUp() {} protected void onPointerUp() {}
protected void onClick() {} //left click, default key type protected void onClick() {} //left click, default key type
protected void onRightClick() { protected void onRightClick() {}
onClick(); protected void onMiddleClick() {}
}
protected void onMiddleClick() {
onClick();
}
protected boolean onLongClick() { protected boolean onLongClick() {
return false; return false;
} }
@@ -498,9 +498,8 @@ public class InventoryPane extends Component {
if (targeting){ if (targeting){
if (targetingSlot == this){ if (targetingSlot == this){
onClick(); onClick();
} else{
cancelTargeting();
} }
return;
} }
if (selector == null && item.defaultAction != null){ if (selector == null && item.defaultAction != null){
@@ -510,7 +509,7 @@ public class InventoryPane extends Component {
InventoryPane.useTargeting(); InventoryPane.useTargeting();
} }
} else { } else {
super.onMiddleClick(); onClick();
} }
} }
@@ -522,11 +521,8 @@ public class InventoryPane extends Component {
} }
if (targeting){ if (targeting){
if (targetingSlot == this){ //do nothing
onClick(); return;
} else{
cancelTargeting();
}
} }
if (selector == null){ if (selector == null){
@@ -537,7 +533,7 @@ public class InventoryPane extends Component {
mousePos = camera.screenToCamera((int)mousePos.x, (int)mousePos.y); mousePos = camera.screenToCamera((int)mousePos.x, (int)mousePos.y);
r.setPos(mousePos.x-3, mousePos.y-3); r.setPos(mousePos.x-3, mousePos.y-3);
} else { } else {
super.onRightClick(); //do nothing
} }
} }
} }