Deleting a block in the editor by right-clicking (#2021)

* Deleting a block in the editor by right-clicking

* Small fix

Co-authored-by: Anuken <arnukren@gmail.com>

Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
Summet
2020-05-10 10:44:54 -04:00
committed by GitHub
co-authored by Anuken
parent dabc891791
commit c62a87e81a
+8 -3
View File
@@ -72,9 +72,14 @@ public class MapView extends Element implements GestureListener{
return false; return false;
} }
if(!mobile && button != KeyCode.mouseLeft && button != KeyCode.mouseMiddle){ if(!mobile && button != KeyCode.mouseLeft && button != KeyCode.mouseMiddle && button != KeyCode.mouseRight){
return true; return true;
} }
if(button == KeyCode.mouseRight){
lastTool = tool;
tool = EditorTool.eraser;
}
if(button == KeyCode.mouseMiddle){ if(button == KeyCode.mouseMiddle){
lastTool = tool; lastTool = tool;
@@ -102,7 +107,7 @@ public class MapView extends Element implements GestureListener{
@Override @Override
public void touchUp(InputEvent event, float x, float y, int pointer, KeyCode button){ public void touchUp(InputEvent event, float x, float y, int pointer, KeyCode button){
if(!mobile && button != KeyCode.mouseLeft && button != KeyCode.mouseMiddle){ if(!mobile && button != KeyCode.mouseLeft && button != KeyCode.mouseMiddle && button != KeyCode.mouseRight){
return; return;
} }
@@ -117,7 +122,7 @@ public class MapView extends Element implements GestureListener{
editor.flushOp(); editor.flushOp();
if(button == KeyCode.mouseMiddle && lastTool != null){ if((button == KeyCode.mouseMiddle || button == KeyCode.mouseRight) && lastTool != null){
tool = lastTool; tool = lastTool;
lastTool = null; lastTool = null;
} }