Add delete tool

This commit is contained in:
David Rowe 2017-08-04 08:55:43 +12:00
parent e2dccc1420
commit 110355796c
3 changed files with 28 additions and 1 deletions

View file

@ -18,11 +18,13 @@ ToolIcon = function (side) {
var SCALE_TOOL = 0,
CLONE_TOOL = 1,
GROUP_TOOL = 2,
DELETE_TOOL = 3,
ICON_COLORS = [
{ red: 0, green: 240, blue: 240 },
{ red: 240, green: 240, blue: 0 },
{ red: 220, green: 60, blue: 220 }
{ red: 220, green: 60, blue: 220 },
{ red: 240, green: 60, blue: 60 }
],
LEFT_HAND = 0,
@ -103,6 +105,7 @@ ToolIcon = function (side) {
SCALE_TOOL: SCALE_TOOL,
CLONE_TOOL: CLONE_TOOL,
GROUP_TOOL: GROUP_TOOL,
DELETE_TOOL: DELETE_TOOL,
setHand: setHand,
update: update,
display: display,

View file

@ -158,6 +158,15 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
},
toolOptions: "groupOptions",
callback: "groupTool"
},
{
id: "deleteButton",
type: "button",
properties: {
localPosition: { x: 0.022, y: 0.04, z: -0.005 },
color: { red: 240, green: 60, blue: 60 }
},
callback: "deleteTool"
}
],

View file

@ -26,6 +26,7 @@
TOOL_SCALE = 1,
TOOL_CLONE = 2,
TOOL_GROUP = 3,
TOOL_DELETE = 4,
toolSelected = TOOL_NONE,
// Primary objects
@ -268,6 +269,7 @@
SCALE_TOOL: toolIcon.SCALE_TOOL,
CLONE_TOOL: toolIcon.CLONE_TOOL,
GROUP_TOOL: toolIcon.GROUP_TOOL,
DELETE_TOOL: toolIcon.DELETE_TOOL,
display: display,
updateUIEntities: setUIEntities,
update: update,
@ -844,6 +846,10 @@
setState(EDITOR_CLONING);
} else if (toolSelected === TOOL_GROUP) {
setState(EDITOR_GROUPING);
} else if (toolSelected === TOOL_DELETE) {
setState(EDITOR_HIGHLIGHTING);
selection.deleteEntities();
setState(EDITOR_SEARCHING);
} else {
setState(EDITOR_GRABBING);
}
@ -895,6 +901,9 @@
setState(EDITOR_CLONING);
} else if (toolSelected === TOOL_GROUP) {
setState(EDITOR_GROUPING);
} else if (toolSelected === TOOL_DELETE) {
selection.deleteEntities();
setState(EDITOR_SEARCHING);
} else {
setState(EDITOR_GRABBING);
}
@ -1237,6 +1246,12 @@
ui.setToolIcon(ui.GROUP_TOOL);
ui.updateUIEntities();
break;
case "deleteTool":
grouping.clear();
toolSelected = TOOL_DELETE;
ui.setToolIcon(ui.DELETE_TOOL);
ui.updateUIEntities();
break;
case "groupButton":
grouping.group();
break;