diff --git a/scripts/vr-edit/assets/tools/redo-icon.svg b/scripts/vr-edit/assets/tools/redo-icon.svg new file mode 100644 index 0000000000..bd0cea1330 --- /dev/null +++ b/scripts/vr-edit/assets/tools/redo-icon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/scripts/vr-edit/assets/tools/redo-label.svg b/scripts/vr-edit/assets/tools/redo-label.svg new file mode 100644 index 0000000000..19ae558bb9 --- /dev/null +++ b/scripts/vr-edit/assets/tools/redo-label.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/scripts/vr-edit/assets/tools/undo-icon.svg b/scripts/vr-edit/assets/tools/undo-icon.svg new file mode 100644 index 0000000000..566de28906 --- /dev/null +++ b/scripts/vr-edit/assets/tools/undo-icon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/scripts/vr-edit/assets/tools/undo-label.svg b/scripts/vr-edit/assets/tools/undo-label.svg new file mode 100644 index 0000000000..ca749f2765 --- /dev/null +++ b/scripts/vr-edit/assets/tools/undo-label.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/scripts/vr-edit/modules/toolsMenu.js b/scripts/vr-edit/modules/toolsMenu.js index 43056954e4..240dbfcfbc 100644 --- a/scripts/vr-edit/modules/toolsMenu.js +++ b/scripts/vr-edit/modules/toolsMenu.js @@ -252,8 +252,6 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { // Relative to menuButton. type: "image", properties: { - url: "../assets/tools/tool-label.svg", - scale: 0.0152, localPosition: { x: 0, y: UIT.dimensions.menuButtonSublabelYOffset, @@ -1660,6 +1658,12 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { scale: 0.0241 } }, + sublabel: { + properties: { + url: "../assets/tools/tool-label.svg", + scale: 0.0152 + } + }, title: { url: "../assets/tools/color-tool-heading.svg", scale: 0.0631 @@ -1693,6 +1697,12 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { scale: 0.0311 } }, + sublabel: { + properties: { + url: "../assets/tools/tool-label.svg", + scale: 0.0152 + } + }, title: { url: "../assets/tools/stretch-tool-heading.svg", scale: 0.0737 @@ -1725,6 +1735,12 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { scale: 0.0231 } }, + sublabel: { + properties: { + url: "../assets/tools/tool-label.svg", + scale: 0.0152 + } + }, title: { url: "../assets/tools/clone-tool-heading.svg", scale: 0.0621 @@ -1757,6 +1773,12 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { scale: 0.0250 } }, + sublabel: { + properties: { + url: "../assets/tools/tool-label.svg", + scale: 0.0152 + } + }, title: { url: "../assets/tools/group-tool-heading.svg", scale: 0.0647 @@ -1789,6 +1811,12 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { scale: 0.0297 } }, + sublabel: { + properties: { + url: "../assets/tools/tool-label.svg", + scale: 0.0152 + } + }, title: { url: "../assets/tools/physics-tool-heading.svg", scale: 0.0712 @@ -1821,6 +1849,12 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { scale: 0.0254 } }, + sublabel: { + properties: { + url: "../assets/tools/tool-label.svg", + scale: 0.0152 + } + }, title: { url: "../assets/tools/delete-tool-heading.svg", scale: 0.0653 @@ -1829,6 +1863,58 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { callback: { method: "deleteTool" } + }, + { + id: "undoButton", + type: "menuButton", + properties: { + localPosition: { + x: MENU_ITEM_XS[2], + y: MENU_ITEM_YS[2], + z: UIT.dimensions.panel.z / 2 + UI_ELEMENTS.menuButton.properties.dimensions.z / 2 + } + }, + icon: { + properties: { + url: "../assets/tools/undo-icon.svg", + dimensions: { x: 0.0180, y: 0.0186 } + } + }, + label: { + properties: { + url: "../assets/tools/undo-label.svg", + scale: 0.0205 + } + }, + callback: { + method: "undoAction" + } + }, + { + id: "redoButton", + type: "menuButton", + properties: { + localPosition: { + x: MENU_ITEM_XS[3], + y: MENU_ITEM_YS[2], + z: UIT.dimensions.panel.z / 2 + UI_ELEMENTS.menuButton.properties.dimensions.z / 2 + } + }, + icon: { + properties: { + url: "../assets/tools/redo-icon.svg", + dimensions: { x: 0.0180, y: 0.0186 } + } + }, + label: { + properties: { + url: "../assets/tools/redo-label.svg", + scale: 0.0192 + } + }, + callback: { + method: "redoAction" + } } ], COLOR_TOOL = 0, // Indexes of corresponding MENU_ITEMS item. @@ -1917,10 +2003,14 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { function getIconInfo(tool) { // Provides details of tool icon, label, and sublabel images for the specified tool. + var sublabelProperties; + + sublabelProperties = Object.clone(UI_ELEMENTS.menuButton.sublabel); + sublabelProperties = Object.merge(sublabelProperties, MENU_ITEMS[tool].sublabel); return { icon: MENU_ITEMS[tool].icon, label: MENU_ITEMS[tool].label, - sublabel: UI_ELEMENTS.menuButton.sublabel + sublabel: sublabelProperties }; } @@ -1977,13 +2067,16 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { menuLabelOverlays.push(overlayID); // Sublabel. - properties = Object.clone(UI_ELEMENTS[UI_ELEMENTS.menuButton.sublabel.type].properties); - properties = Object.merge(properties, UI_ELEMENTS.menuButton.sublabel.properties); - properties.url = Script.resolvePath(properties.url); - properties.visible = isVisible; - properties.parentID = itemID; - overlayID = Overlays.addOverlay(UI_ELEMENTS[UI_ELEMENTS.menuButton.sublabel.type].overlay, properties); - menuLabelOverlays.push(overlayID); + if (MENU_ITEMS[i].sublabel) { + properties = Object.clone(UI_ELEMENTS[UI_ELEMENTS.menuButton.sublabel.type].properties); + properties = Object.merge(properties, UI_ELEMENTS.menuButton.sublabel.properties); + properties = Object.merge(properties, MENU_ITEMS[i].sublabel.properties); + properties.url = Script.resolvePath(properties.url); + properties.visible = isVisible; + properties.parentID = itemID; + overlayID = Overlays.addOverlay(UI_ELEMENTS[UI_ELEMENTS.menuButton.sublabel.type].overlay, properties); + menuLabelOverlays.push(overlayID); + } } } @@ -3086,7 +3179,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { }; // Button press actions. - if (intersectionOverlays === menuOverlays) { + if (intersectionOverlays === menuOverlays && intersectionItems[intersectedItem].toolOptions) { openOptions(intersectionItems[intersectedItem]); } if (intersectionItems[intersectedItem].command) {