mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 03:38:28 +02:00
Fix app toggling and hand swapping issues
This commit is contained in:
parent
37c1060080
commit
c4eac1660c
2 changed files with 54 additions and 36 deletions
|
@ -44,7 +44,7 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
alpha: 1.0,
|
||||
parentID: AVATAR_SELF_ID,
|
||||
ignoreRayIntersection: true,
|
||||
visible: true
|
||||
visible: false
|
||||
},
|
||||
|
||||
MENU_PANEL_PROPERTIES = {
|
||||
|
@ -177,12 +177,12 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
intersectionOverlays,
|
||||
intersectionCallbacks,
|
||||
intersectionProperties,
|
||||
highlightedItem = NONE,
|
||||
highlightedSource = null,
|
||||
isHighlightingButton = false,
|
||||
pressedItem = NONE,
|
||||
pressedSource = null,
|
||||
isButtonPressed = false,
|
||||
highlightedItem,
|
||||
highlightedSource,
|
||||
isHighlightingButton,
|
||||
pressedItem,
|
||||
pressedSource,
|
||||
isButtonPressed,
|
||||
|
||||
isDisplaying = false,
|
||||
|
||||
|
@ -238,6 +238,9 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
}
|
||||
}
|
||||
|
||||
function clearTool() {
|
||||
openOptions();
|
||||
}
|
||||
|
||||
function update(intersectionOverlayID) {
|
||||
var intersectedItem,
|
||||
|
@ -372,6 +375,17 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
properties.parentID = menuOriginOverlay;
|
||||
highlightOverlay = Overlays.addOverlay("cube", properties);
|
||||
|
||||
// Initial values.
|
||||
intersectionOverlays = null;
|
||||
intersectionCallbacks = null;
|
||||
intersectionProperties = null;
|
||||
highlightedItem = NONE;
|
||||
highlightedSource = null;
|
||||
isHighlightingButton = false;
|
||||
pressedItem = NONE;
|
||||
pressedSource = null;
|
||||
isButtonPressed = false;
|
||||
|
||||
isDisplaying = true;
|
||||
}
|
||||
|
||||
|
@ -385,11 +399,21 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
}
|
||||
|
||||
Overlays.deleteOverlay(highlightOverlay);
|
||||
for (i = 0, length = optionsOverlays.length; i < length; i += 1) {
|
||||
Overlays.deleteOverlay(optionsOverlays[i]);
|
||||
}
|
||||
optionsOverlays = [];
|
||||
optionsCallbacks = [];
|
||||
|
||||
for (i = 0, length = menuOverlays.length; i < length; i += 1) {
|
||||
Overlays.deleteOverlay(menuOverlays[i]);
|
||||
}
|
||||
menuOverlays = [];
|
||||
menuCallbacks = [];
|
||||
|
||||
Overlays.deleteOverlay(menuPanelOverlay);
|
||||
Overlays.deleteOverlay(menuOriginOverlay);
|
||||
|
||||
isDisplaying = false;
|
||||
}
|
||||
|
||||
|
@ -400,6 +424,7 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
|||
return {
|
||||
setHand: setHand,
|
||||
entityIDs: getEntityIDs,
|
||||
clearTool: clearTool,
|
||||
update: update,
|
||||
display: display,
|
||||
clear: clear,
|
||||
|
|
|
@ -212,6 +212,7 @@
|
|||
|
||||
function clearToolIcon() {
|
||||
toolIcon.clear();
|
||||
toolMenu.clearTool();
|
||||
}
|
||||
|
||||
function setUIEntities() {
|
||||
|
@ -1240,6 +1241,23 @@
|
|||
}
|
||||
}
|
||||
|
||||
function startApp() {
|
||||
ui.display();
|
||||
update();
|
||||
}
|
||||
|
||||
function stopApp() {
|
||||
Script.clearTimeout(updateTimer);
|
||||
updateTimer = null;
|
||||
inputs[LEFT_HAND].clear();
|
||||
inputs[RIGHT_HAND].clear();
|
||||
ui.clear();
|
||||
grouping.clear();
|
||||
editors[LEFT_HAND].clear();
|
||||
editors[RIGHT_HAND].clear();
|
||||
toolSelected = TOOL_NONE;
|
||||
}
|
||||
|
||||
function onAppButtonClicked() {
|
||||
// Application tablet/toolbar button clicked.
|
||||
isAppActive = !isAppActive;
|
||||
|
@ -1247,16 +1265,9 @@
|
|||
button.editProperties({ isActive: isAppActive });
|
||||
|
||||
if (isAppActive) {
|
||||
ui.display();
|
||||
update();
|
||||
startApp();
|
||||
} else {
|
||||
Script.clearTimeout(updateTimer);
|
||||
updateTimer = null;
|
||||
inputs[LEFT_HAND].clear();
|
||||
inputs[RIGHT_HAND].clear();
|
||||
ui.clear();
|
||||
editors[LEFT_HAND].clear();
|
||||
editors[RIGHT_HAND].clear();
|
||||
stopApp();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1265,33 +1276,15 @@
|
|||
|
||||
if (isAppActive) {
|
||||
// Stop operations.
|
||||
Script.clearTimeout(updateTimer);
|
||||
updateTimer = null;
|
||||
inputs[LEFT_HAND].clear();
|
||||
inputs[RIGHT_HAND].clear();
|
||||
ui.clear();
|
||||
editors[LEFT_HAND].clear();
|
||||
editors[RIGHT_HAND].clear();
|
||||
stopApp();
|
||||
}
|
||||
|
||||
// Swap UI hands.
|
||||
ui.setHand(otherHand(dominantHand));
|
||||
switch (toolSelected) {
|
||||
case TOOL_SCALE:
|
||||
ui.setToolIcon(ui.SCALE_TOOL);
|
||||
break;
|
||||
case TOOL_CLONE:
|
||||
ui.setToolIcon(ui.CLONE_TOOL);
|
||||
break;
|
||||
case TOOL_GROUP:
|
||||
ui.setToolIcon(ui.GROUP_TOOL);
|
||||
break;
|
||||
}
|
||||
|
||||
if (isAppActive) {
|
||||
// Resume operations.
|
||||
ui.display();
|
||||
update();
|
||||
startApp();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue