mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:29:32 +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";
|
"use strict";
|
||||||
|
|
||||||
var NONE = 0,
|
var SCALE_TOOL = 0,
|
||||||
SCALE_HANDLES = 1,
|
CLONE_TOOL = 1,
|
||||||
|
|
||||||
ICON_COLORS = [
|
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,
|
LEFT_HAND = 0,
|
||||||
|
@ -98,8 +98,8 @@ ToolIcon = function (side) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
NONE: NONE,
|
SCALE_TOOL: SCALE_TOOL,
|
||||||
SCALE_HANDLES: SCALE_HANDLES,
|
CLONE_TOOL: CLONE_TOOL,
|
||||||
setHand: setHand,
|
setHand: setHand,
|
||||||
update: update,
|
update: update,
|
||||||
display: display,
|
display: display,
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
/* global ToolMenu */
|
/* global ToolMenu */
|
||||||
|
|
||||||
ToolMenu = function (side, leftInputs, rightInputs, setAppScaleWithHandlesCallback) {
|
ToolMenu = function (side, leftInputs, rightInputs, setToolCallback) {
|
||||||
// Tool menu displayed on top of forearm.
|
// Tool menu displayed on top of forearm.
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -150,7 +150,7 @@ ToolMenu = function (side, leftInputs, rightInputs, setAppScaleWithHandlesCallba
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (isButtonPressed) {
|
if (isButtonPressed) {
|
||||||
setAppScaleWithHandlesCallback();
|
setToolCallback(intersectionOverlayID === scaleButtonOverlay ? "scale" : "clone");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
// Application state
|
// Application state
|
||||||
isAppActive = false,
|
isAppActive = false,
|
||||||
isAppScaleWithHandles = false,
|
isAppScaleWithHandles = false,
|
||||||
|
isAppCloneEntities = false,
|
||||||
dominantHand,
|
dominantHand,
|
||||||
|
|
||||||
// Primary objects
|
// Primary objects
|
||||||
|
@ -165,7 +166,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
UI = function (side, leftInputs, rightInputs, setAppScaleWithHandlesCallback) {
|
UI = function (side, leftInputs, rightInputs, setToolCallback) {
|
||||||
// Tool menu and Create palette.
|
// Tool menu and Create palette.
|
||||||
|
|
||||||
var // Primary objects.
|
var // Primary objects.
|
||||||
|
@ -183,7 +184,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
toolIcon = new ToolIcon(otherHand(side));
|
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);
|
createPalette = new CreatePalette(side, leftInputs, rightInputs);
|
||||||
|
|
||||||
getIntersection = side === LEFT_HAND ? rightInputs.intersection : leftInputs.intersection;
|
getIntersection = side === LEFT_HAND ? rightInputs.intersection : leftInputs.intersection;
|
||||||
|
@ -254,7 +255,8 @@
|
||||||
setHand: setHand,
|
setHand: setHand,
|
||||||
setToolIcon: setToolIcon,
|
setToolIcon: setToolIcon,
|
||||||
clearToolIcon: clearToolIcon,
|
clearToolIcon: clearToolIcon,
|
||||||
SCALE_HANDLES: toolIcon.SCALE_HANDLES,
|
SCALE_TOOL: toolIcon.SCALE_TOOL,
|
||||||
|
CLONE_TOOL: toolIcon.CLONE_TOOL,
|
||||||
display: display,
|
display: display,
|
||||||
update: update,
|
update: update,
|
||||||
clear: clear,
|
clear: clear,
|
||||||
|
@ -742,8 +744,9 @@
|
||||||
|
|
||||||
function updateTool() {
|
function updateTool() {
|
||||||
var isGripClicked = hand.gripClicked();
|
var isGripClicked = hand.gripClicked();
|
||||||
if (!wasGripClicked && isGripClicked && isAppScaleWithHandles) {
|
if (!wasGripClicked && isGripClicked && (isAppScaleWithHandles || isAppCloneEntities)) {
|
||||||
isAppScaleWithHandles = false;
|
isAppScaleWithHandles = false;
|
||||||
|
isAppCloneEntities = false;
|
||||||
ui.clearToolIcon();
|
ui.clearToolIcon();
|
||||||
}
|
}
|
||||||
wasGripClicked = isGripClicked;
|
wasGripClicked = isGripClicked;
|
||||||
|
@ -1010,9 +1013,21 @@
|
||||||
Settings.setValue(VR_EDIT_SETTING, isAppActive);
|
Settings.setValue(VR_EDIT_SETTING, isAppActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAppScaleWithHandles() {
|
function setTool(tool) {
|
||||||
isAppScaleWithHandles = true;
|
switch (tool) {
|
||||||
ui.setToolIcon(ui.SCALE_HANDLES);
|
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() {
|
function onAppButtonClicked() {
|
||||||
|
@ -1052,7 +1067,10 @@
|
||||||
// Swap UI hands.
|
// Swap UI hands.
|
||||||
ui.setHand(otherHand(dominantHand));
|
ui.setHand(otherHand(dominantHand));
|
||||||
if (isAppScaleWithHandles) {
|
if (isAppScaleWithHandles) {
|
||||||
ui.setToolIcon(ui.SCALE_HANDLES);
|
ui.setToolIcon(ui.SCALE_TOOL);
|
||||||
|
}
|
||||||
|
if (isAppCloneEntities) {
|
||||||
|
ui.setToolIcon(ui.CLONE_TOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAppActive) {
|
if (isAppActive) {
|
||||||
|
@ -1090,7 +1108,7 @@
|
||||||
inputs[RIGHT_HAND] = new Inputs(RIGHT_HAND);
|
inputs[RIGHT_HAND] = new Inputs(RIGHT_HAND);
|
||||||
|
|
||||||
// UI object.
|
// 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.
|
// Editor objects.
|
||||||
editors[LEFT_HAND] = new Editor(LEFT_HAND);
|
editors[LEFT_HAND] = new Editor(LEFT_HAND);
|
||||||
|
|
Loading…
Reference in a new issue