[editor only] Fix double delete action when DEL is pressed, close #87
This commit is contained in:
@@ -98,7 +98,7 @@ public class KeyBindingsLayout {
|
||||
defaultMapper.put(ALIGN_BOTTOM, new KeyMapper(ALIGN_BOTTOM, true, false, false, Input.Keys.NUMPAD_2));
|
||||
defaultMapper.put(ALIGN_RIGHT, new KeyMapper(ALIGN_RIGHT, true, false, false, Input.Keys.NUMPAD_6));
|
||||
|
||||
defaultMapper.put(DELETE, new KeyMapper(DELETE, false, false, false, Input.Keys.DEL));
|
||||
defaultMapper.put(DELETE, new KeyMapper(DELETE, false, false, false, Input.Keys.DEL, Input.Keys.FORWARD_DEL));
|
||||
|
||||
defaultMapper.put(HIDE_GUI, new KeyMapper(HIDE_GUI, false, false, false, Input.Keys.F12));
|
||||
defaultMapper.put(OPEN_CONSOLE, new KeyMapper(OPEN_CONSOLE, false, false, false, Input.Keys.F10));
|
||||
|
||||
@@ -347,16 +347,11 @@ public class SandboxMediator extends Mediator<Sandbox> {
|
||||
public boolean keyUp(int entity, int keycode) {
|
||||
facade.sendNotification(MsgAPI.ACTION_KEY_UP, keycode);
|
||||
|
||||
Sandbox sandbox = Sandbox.getInstance();
|
||||
switch (KeyBindingsLayout.mapAction(keycode)) {
|
||||
case KeyBindingsLayout.PAN_TOOL:
|
||||
// if pan mode is disabled set cursor back
|
||||
toolHotSwapBack();
|
||||
break;
|
||||
case KeyBindingsLayout.DELETE:
|
||||
// delete selected item
|
||||
sandbox.getSelector().removeCurrentSelectedItems();
|
||||
break;
|
||||
}
|
||||
|
||||
if(currentSelectedTool != null) {
|
||||
|
||||
@@ -26,6 +26,7 @@ import games.rednblack.editor.controller.commands.AddComponentToItemCommand;
|
||||
import games.rednblack.editor.controller.commands.RemoveComponentFromItemCommand;
|
||||
import games.rednblack.editor.controller.commands.component.UpdatePolygonVerticesCommand;
|
||||
import games.rednblack.editor.renderer.components.shape.PolygonShapeComponent;
|
||||
import games.rednblack.editor.utils.KeyBindingsLayout;
|
||||
import games.rednblack.editor.utils.poly.PolygonUtils;
|
||||
import games.rednblack.editor.utils.runtime.SandboxComponentRetriever;
|
||||
import games.rednblack.editor.view.stage.Sandbox;
|
||||
@@ -220,7 +221,7 @@ public class PolygonTool extends SelectionTool implements PolygonTransformationL
|
||||
|
||||
@Override
|
||||
public void keyDown(int entity, int keycode) {
|
||||
if(keycode == Input.Keys.DEL || keycode == Input.Keys.FORWARD_DEL) {
|
||||
if(KeyBindingsLayout.mapAction(keycode) == KeyBindingsLayout.DELETE) {
|
||||
if(!deleteSelectedAnchor()) {
|
||||
super.keyDown(entity, keycode);
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ public class SelectionTool extends SimpleTool {
|
||||
}
|
||||
|
||||
// Delete
|
||||
if (keycode == Input.Keys.DEL || keycode == Input.Keys.FORWARD_DEL) {
|
||||
if (KeyBindingsLayout.mapAction(keycode) == KeyBindingsLayout.DELETE) {
|
||||
Facade.getInstance().sendNotification(MsgAPI.ACTION_DELETE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user