mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-15 16:16:32 +02:00
Move hover haptic pulses to dominant hand
This commit is contained in:
parent
039ceed74c
commit
c93acbecaa
2 changed files with 15 additions and 14 deletions
|
@ -272,6 +272,7 @@ CreatePalette = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
NONE = -1,
|
||||
highlightedItem = NONE,
|
||||
wasTriggerClicked = false,
|
||||
otherSide,
|
||||
|
||||
// References.
|
||||
controlHand;
|
||||
|
@ -284,6 +285,7 @@ CreatePalette = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
function setHand(hand) {
|
||||
// Assumes UI is not displaying.
|
||||
side = hand;
|
||||
otherSide = (side + 1) % 2;
|
||||
controlHand = side === LEFT_HAND ? rightInputs.hand() : leftInputs.hand();
|
||||
controlJointName = side === LEFT_HAND ? "LeftHand" : "RightHand";
|
||||
paletteLateralOffset = side === LEFT_HAND ? -UIT.dimensions.handLateralOffset : UIT.dimensions.handLateralOffset;
|
||||
|
@ -291,10 +293,6 @@ CreatePalette = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
|
||||
setHand(side);
|
||||
|
||||
function otherHand(side) {
|
||||
return (side + 1) % 2;
|
||||
}
|
||||
|
||||
function getOverlayIDs() {
|
||||
return [palettePanelOverlay, paletteHeaderHeadingOverlay, paletteHeaderBarOverlay].concat(paletteItemOverlays);
|
||||
}
|
||||
|
@ -334,7 +332,7 @@ CreatePalette = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
|
||||
// Highlight and raise new item.
|
||||
if (itemIndex !== NONE && highlightedItem !== itemIndex) {
|
||||
Feedback.play(side, Feedback.HOVER_BUTTON);
|
||||
Feedback.play(otherSide, Feedback.HOVER_BUTTON);
|
||||
Overlays.editOverlay(paletteItemHoverOverlays[itemIndex], {
|
||||
localPosition: UIT.dimensions.paletteItemButtonHoveredOffset,
|
||||
visible: true
|
||||
|
@ -346,7 +344,7 @@ CreatePalette = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
isTriggerClicked = controlHand.triggerClicked();
|
||||
if (highlightedItem !== NONE && isTriggerClicked && !wasTriggerClicked) {
|
||||
// Create entity.
|
||||
Feedback.play(otherHand(side), Feedback.CREATE_ENTITY);
|
||||
Feedback.play(otherSide, Feedback.CREATE_ENTITY);
|
||||
properties = Object.clone(PALETTE_ITEMS[itemIndex].entity);
|
||||
properties.position = Vec3.sum(controlHand.palmPosition(),
|
||||
Vec3.multiplyQbyV(controlHand.orientation(),
|
||||
|
|
|
@ -1876,6 +1876,8 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
optionsHeadingURL,
|
||||
optionsHeadingScale,
|
||||
|
||||
otherSide,
|
||||
|
||||
// References.
|
||||
controlHand,
|
||||
|
||||
|
@ -1905,6 +1907,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
menuOriginLocalPosition = PANEL_ORIGIN_POSITION_RIGHT_HAND;
|
||||
menuOriginLocalRotation = PANEL_ORIGIN_ROTATION_RIGHT_HAND;
|
||||
}
|
||||
otherSide = (side + 1) % 2;
|
||||
}
|
||||
|
||||
setHand(side);
|
||||
|
@ -2803,7 +2806,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
doCommand("clearTool");
|
||||
} else if (!isOptionsHeadingRaised) {
|
||||
// Hover heading.
|
||||
Feedback.play(side, Feedback.HOVER_BUTTON);
|
||||
Feedback.play(otherSide, Feedback.HOVER_BUTTON);
|
||||
Overlays.editOverlay(menuHeaderHeadingOverlay, {
|
||||
localPosition: Vec3.sum(MENU_HEADER_HEADING_PROPERTIES.localPosition, MENU_HEADER_HOVER_OFFSET),
|
||||
color: UIT.colors.greenHighlight,
|
||||
|
@ -2959,7 +2962,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
// Hover new item.
|
||||
switch (highlightedElementType) {
|
||||
case "menuButton":
|
||||
Feedback.play(side, Feedback.HOVER_MENU_ITEM);
|
||||
Feedback.play(otherSide, Feedback.HOVER_MENU_ITEM);
|
||||
Overlays.editOverlay(menuHoverOverlays[highlightedItem], {
|
||||
localPosition: Vec3.sum(UI_ELEMENTS.menuButton.hoverButton.properties.localPosition, MENU_HOVER_DELTA),
|
||||
visible: true
|
||||
|
@ -2970,7 +2973,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
break;
|
||||
case "button":
|
||||
if (intersectionEnabled[highlightedItem]) {
|
||||
Feedback.play(side, Feedback.HOVER_BUTTON);
|
||||
Feedback.play(otherSide, Feedback.HOVER_BUTTON);
|
||||
localPosition = intersectionItems[highlightedItem].properties.localPosition;
|
||||
Overlays.editOverlay(intersectionOverlays[highlightedItem], {
|
||||
color: intersectionItems[highlightedItem].highlightColor !== undefined
|
||||
|
@ -2982,7 +2985,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
break;
|
||||
case "toggleButton":
|
||||
if (intersectionEnabled[highlightedItem]) {
|
||||
Feedback.play(side, Feedback.HOVER_BUTTON);
|
||||
Feedback.play(otherSide, Feedback.HOVER_BUTTON);
|
||||
localPosition = intersectionItems[highlightedItem].properties.localPosition;
|
||||
Overlays.editOverlay(intersectionOverlays[highlightedItem], {
|
||||
color: optionsToggles[intersectionItems[highlightedItem].id]
|
||||
|
@ -2993,7 +2996,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
}
|
||||
break;
|
||||
case "swatch":
|
||||
Feedback.play(side, Feedback.HOVER_BUTTON);
|
||||
Feedback.play(otherSide, Feedback.HOVER_BUTTON);
|
||||
localPosition = intersectionItems[highlightedItem].properties.localPosition;
|
||||
if (optionsSettings[intersectionItems[highlightedItem].id].value === "") {
|
||||
// Swatch is empty; highlight it with current color.
|
||||
|
@ -3018,14 +3021,14 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
case "barSlider":
|
||||
case "imageSlider":
|
||||
case "colorCircle":
|
||||
Feedback.play(side, Feedback.HOVER_BUTTON);
|
||||
Feedback.play(otherSide, Feedback.HOVER_BUTTON);
|
||||
localPosition = intersectionItems[highlightedItem].properties.localPosition;
|
||||
Overlays.editOverlay(intersectionOverlays[highlightedItem], {
|
||||
localPosition: Vec3.sum(localPosition, OPTION_HOVER_DELTA)
|
||||
});
|
||||
break;
|
||||
case "picklist":
|
||||
Feedback.play(side, Feedback.HOVER_BUTTON);
|
||||
Feedback.play(otherSide, Feedback.HOVER_BUTTON);
|
||||
if (!isPicklistOpen) {
|
||||
localPosition = intersectionItems[highlightedItem].properties.localPosition;
|
||||
Overlays.editOverlay(intersectionOverlays[highlightedItem], {
|
||||
|
@ -3039,7 +3042,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
|||
}
|
||||
break;
|
||||
case "picklistItem":
|
||||
Feedback.play(side, Feedback.HOVER_BUTTON);
|
||||
Feedback.play(otherSide, Feedback.HOVER_BUTTON);
|
||||
Overlays.editOverlay(intersectionOverlays[highlightedItem], {
|
||||
color: UIT.colors.greenHighlight
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue