mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 17:24:24 +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,
|
alpha: 1.0,
|
||||||
parentID: AVATAR_SELF_ID,
|
parentID: AVATAR_SELF_ID,
|
||||||
ignoreRayIntersection: true,
|
ignoreRayIntersection: true,
|
||||||
visible: true
|
visible: false
|
||||||
},
|
},
|
||||||
|
|
||||||
MENU_PANEL_PROPERTIES = {
|
MENU_PANEL_PROPERTIES = {
|
||||||
|
@ -177,12 +177,12 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
||||||
intersectionOverlays,
|
intersectionOverlays,
|
||||||
intersectionCallbacks,
|
intersectionCallbacks,
|
||||||
intersectionProperties,
|
intersectionProperties,
|
||||||
highlightedItem = NONE,
|
highlightedItem,
|
||||||
highlightedSource = null,
|
highlightedSource,
|
||||||
isHighlightingButton = false,
|
isHighlightingButton,
|
||||||
pressedItem = NONE,
|
pressedItem,
|
||||||
pressedSource = null,
|
pressedSource,
|
||||||
isButtonPressed = false,
|
isButtonPressed,
|
||||||
|
|
||||||
isDisplaying = false,
|
isDisplaying = false,
|
||||||
|
|
||||||
|
@ -238,6 +238,9 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearTool() {
|
||||||
|
openOptions();
|
||||||
|
}
|
||||||
|
|
||||||
function update(intersectionOverlayID) {
|
function update(intersectionOverlayID) {
|
||||||
var intersectedItem,
|
var intersectedItem,
|
||||||
|
@ -372,6 +375,17 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
||||||
properties.parentID = menuOriginOverlay;
|
properties.parentID = menuOriginOverlay;
|
||||||
highlightOverlay = Overlays.addOverlay("cube", properties);
|
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;
|
isDisplaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,11 +399,21 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Overlays.deleteOverlay(highlightOverlay);
|
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) {
|
for (i = 0, length = menuOverlays.length; i < length; i += 1) {
|
||||||
Overlays.deleteOverlay(menuOverlays[i]);
|
Overlays.deleteOverlay(menuOverlays[i]);
|
||||||
}
|
}
|
||||||
|
menuOverlays = [];
|
||||||
|
menuCallbacks = [];
|
||||||
|
|
||||||
Overlays.deleteOverlay(menuPanelOverlay);
|
Overlays.deleteOverlay(menuPanelOverlay);
|
||||||
Overlays.deleteOverlay(menuOriginOverlay);
|
Overlays.deleteOverlay(menuOriginOverlay);
|
||||||
|
|
||||||
isDisplaying = false;
|
isDisplaying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,6 +424,7 @@ ToolMenu = function (side, leftInputs, rightInputs, commandCallback) {
|
||||||
return {
|
return {
|
||||||
setHand: setHand,
|
setHand: setHand,
|
||||||
entityIDs: getEntityIDs,
|
entityIDs: getEntityIDs,
|
||||||
|
clearTool: clearTool,
|
||||||
update: update,
|
update: update,
|
||||||
display: display,
|
display: display,
|
||||||
clear: clear,
|
clear: clear,
|
||||||
|
|
|
@ -212,6 +212,7 @@
|
||||||
|
|
||||||
function clearToolIcon() {
|
function clearToolIcon() {
|
||||||
toolIcon.clear();
|
toolIcon.clear();
|
||||||
|
toolMenu.clearTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUIEntities() {
|
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() {
|
function onAppButtonClicked() {
|
||||||
// Application tablet/toolbar button clicked.
|
// Application tablet/toolbar button clicked.
|
||||||
isAppActive = !isAppActive;
|
isAppActive = !isAppActive;
|
||||||
|
@ -1247,16 +1265,9 @@
|
||||||
button.editProperties({ isActive: isAppActive });
|
button.editProperties({ isActive: isAppActive });
|
||||||
|
|
||||||
if (isAppActive) {
|
if (isAppActive) {
|
||||||
ui.display();
|
startApp();
|
||||||
update();
|
|
||||||
} else {
|
} else {
|
||||||
Script.clearTimeout(updateTimer);
|
stopApp();
|
||||||
updateTimer = null;
|
|
||||||
inputs[LEFT_HAND].clear();
|
|
||||||
inputs[RIGHT_HAND].clear();
|
|
||||||
ui.clear();
|
|
||||||
editors[LEFT_HAND].clear();
|
|
||||||
editors[RIGHT_HAND].clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1265,33 +1276,15 @@
|
||||||
|
|
||||||
if (isAppActive) {
|
if (isAppActive) {
|
||||||
// Stop operations.
|
// Stop operations.
|
||||||
Script.clearTimeout(updateTimer);
|
stopApp();
|
||||||
updateTimer = null;
|
|
||||||
inputs[LEFT_HAND].clear();
|
|
||||||
inputs[RIGHT_HAND].clear();
|
|
||||||
ui.clear();
|
|
||||||
editors[LEFT_HAND].clear();
|
|
||||||
editors[RIGHT_HAND].clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Swap UI hands.
|
// Swap UI hands.
|
||||||
ui.setHand(otherHand(dominantHand));
|
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) {
|
if (isAppActive) {
|
||||||
// Resume operations.
|
// Resume operations.
|
||||||
ui.display();
|
startApp();
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue