mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-05 01:40:37 +02:00
Add icon for clone tool
This commit is contained in:
parent
18a9dad918
commit
48ee7a3b1a
3 changed files with 35 additions and 17 deletions
|
@ -15,12 +15,12 @@ ToolIcon = function (side) {
|
|||
|
||||
"use strict";
|
||||
|
||||
var NONE = 0,
|
||||
SCALE_HANDLES = 1,
|
||||
var SCALE_TOOL = 0,
|
||||
CLONE_TOOL = 1,
|
||||
|
||||
ICON_COLORS = [
|
||||
{ red: 0, green: 0, blue: 0 }, // Unused entry for NONE.
|
||||
{ red: 0, green: 240, blue: 240 }
|
||||
{ red: 0, green: 240, blue: 240 },
|
||||
{ red: 240, green: 0, blue: 240 }
|
||||
],
|
||||
|
||||
LEFT_HAND = 0,
|
||||
|
@ -98,8 +98,8 @@ ToolIcon = function (side) {
|
|||
}
|
||||
|
||||
return {
|
||||
NONE: NONE,
|
||||
SCALE_HANDLES: SCALE_HANDLES,
|
||||
SCALE_TOOL: SCALE_TOOL,
|
||||
CLONE_TOOL: CLONE_TOOL,
|
||||
setHand: setHand,
|
||||
update: update,
|
||||
display: display,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
/* global ToolMenu */
|
||||
|
||||
ToolMenu = function (side, leftInputs, rightInputs, setAppScaleWithHandlesCallback) {
|
||||
ToolMenu = function (side, leftInputs, rightInputs, setToolCallback) {
|
||||
// Tool menu displayed on top of forearm.
|
||||
|
||||
"use strict";
|
||||
|
@ -150,7 +150,7 @@ ToolMenu = function (side, leftInputs, rightInputs, setAppScaleWithHandlesCallba
|
|||
});
|
||||
}
|
||||
if (isButtonPressed) {
|
||||
setAppScaleWithHandlesCallback();
|
||||
setToolCallback(intersectionOverlayID === scaleButtonOverlay ? "scale" : "clone");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
// Application state
|
||||
isAppActive = false,
|
||||
isAppScaleWithHandles = false,
|
||||
isAppCloneEntities = false,
|
||||
dominantHand,
|
||||
|
||||
// Primary objects
|
||||
|
@ -165,7 +166,7 @@
|
|||
};
|
||||
|
||||
|
||||
UI = function (side, leftInputs, rightInputs, setAppScaleWithHandlesCallback) {
|
||||
UI = function (side, leftInputs, rightInputs, setToolCallback) {
|
||||
// Tool menu and Create palette.
|
||||
|
||||
var // Primary objects.
|
||||
|
@ -183,7 +184,7 @@
|
|||
}
|
||||
|
||||
toolIcon = new ToolIcon(otherHand(side));
|
||||
toolMenu = new ToolMenu(side, leftInputs, rightInputs, setAppScaleWithHandlesCallback);
|
||||
toolMenu = new ToolMenu(side, leftInputs, rightInputs, setToolCallback);
|
||||
createPalette = new CreatePalette(side, leftInputs, rightInputs);
|
||||
|
||||
getIntersection = side === LEFT_HAND ? rightInputs.intersection : leftInputs.intersection;
|
||||
|
@ -254,7 +255,8 @@
|
|||
setHand: setHand,
|
||||
setToolIcon: setToolIcon,
|
||||
clearToolIcon: clearToolIcon,
|
||||
SCALE_HANDLES: toolIcon.SCALE_HANDLES,
|
||||
SCALE_TOOL: toolIcon.SCALE_TOOL,
|
||||
CLONE_TOOL: toolIcon.CLONE_TOOL,
|
||||
display: display,
|
||||
update: update,
|
||||
clear: clear,
|
||||
|
@ -742,8 +744,9 @@
|
|||
|
||||
function updateTool() {
|
||||
var isGripClicked = hand.gripClicked();
|
||||
if (!wasGripClicked && isGripClicked && isAppScaleWithHandles) {
|
||||
if (!wasGripClicked && isGripClicked && (isAppScaleWithHandles || isAppCloneEntities)) {
|
||||
isAppScaleWithHandles = false;
|
||||
isAppCloneEntities = false;
|
||||
ui.clearToolIcon();
|
||||
}
|
||||
wasGripClicked = isGripClicked;
|
||||
|
@ -1010,9 +1013,21 @@
|
|||
Settings.setValue(VR_EDIT_SETTING, isAppActive);
|
||||
}
|
||||
|
||||
function setAppScaleWithHandles() {
|
||||
isAppScaleWithHandles = true;
|
||||
ui.setToolIcon(ui.SCALE_HANDLES);
|
||||
function setTool(tool) {
|
||||
switch (tool) {
|
||||
case "scale":
|
||||
isAppScaleWithHandles = true;
|
||||
isAppCloneEntities = false;
|
||||
ui.setToolIcon(ui.SCALE_TOOL);
|
||||
break;
|
||||
case "clone":
|
||||
isAppScaleWithHandles = false;
|
||||
isAppCloneEntities = true;
|
||||
ui.setToolIcon(ui.CLONE_TOOL);
|
||||
break;
|
||||
default:
|
||||
debug("ERROR: Unexpected condition in setTool()!");
|
||||
}
|
||||
}
|
||||
|
||||
function onAppButtonClicked() {
|
||||
|
@ -1052,7 +1067,10 @@
|
|||
// Swap UI hands.
|
||||
ui.setHand(otherHand(dominantHand));
|
||||
if (isAppScaleWithHandles) {
|
||||
ui.setToolIcon(ui.SCALE_HANDLES);
|
||||
ui.setToolIcon(ui.SCALE_TOOL);
|
||||
}
|
||||
if (isAppCloneEntities) {
|
||||
ui.setToolIcon(ui.CLONE_TOOL);
|
||||
}
|
||||
|
||||
if (isAppActive) {
|
||||
|
@ -1090,7 +1108,7 @@
|
|||
inputs[RIGHT_HAND] = new Inputs(RIGHT_HAND);
|
||||
|
||||
// UI object.
|
||||
ui = new UI(otherHand(dominantHand), inputs[LEFT_HAND], inputs[RIGHT_HAND], setAppScaleWithHandles);
|
||||
ui = new UI(otherHand(dominantHand), inputs[LEFT_HAND], inputs[RIGHT_HAND], setTool);
|
||||
|
||||
// Editor objects.
|
||||
editors[LEFT_HAND] = new Editor(LEFT_HAND);
|
||||
|
|
Loading…
Reference in a new issue