mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 22:40:27 +02:00
Code review
This commit is contained in:
parent
4855e0f528
commit
b526ec0d93
6 changed files with 41 additions and 30 deletions
|
@ -334,8 +334,9 @@ CreatePalette = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
|
|
||||||
function setHand(hand) {
|
function setHand(hand) {
|
||||||
// Assumes UI is not displaying.
|
// Assumes UI is not displaying.
|
||||||
|
var NUMBER_OF_HANDS = 2;
|
||||||
side = hand;
|
side = hand;
|
||||||
otherSide = (side + 1) % 2;
|
otherSide = (side + 1) % NUMBER_OF_HANDS;
|
||||||
controlHand = side === LEFT_HAND ? rightInputs.hand() : leftInputs.hand();
|
controlHand = side === LEFT_HAND ? rightInputs.hand() : leftInputs.hand();
|
||||||
controlJointName = side === LEFT_HAND ? "LeftHand" : "RightHand";
|
controlJointName = side === LEFT_HAND ? "LeftHand" : "RightHand";
|
||||||
paletteLateralOffset = side === LEFT_HAND ? -UIT.dimensions.handLateralOffset : UIT.dimensions.handLateralOffset;
|
paletteLateralOffset = side === LEFT_HAND ? -UIT.dimensions.handLateralOffset : UIT.dimensions.handLateralOffset;
|
||||||
|
|
|
@ -168,14 +168,16 @@ SelectionManager = function (side) {
|
||||||
for (i = 1, length = selection.length; i < length; i++) {
|
for (i = 1, length = selection.length; i < length; i++) {
|
||||||
|
|
||||||
registration = selection[i].registrationPoint;
|
registration = selection[i].registrationPoint;
|
||||||
corners[0] = { x: -registration.x, y: -registration.y, z: -registration.z };
|
corners = [
|
||||||
corners[1] = { x: -registration.x, y: -registration.y, z: 1.0 - registration.z };
|
{ x: -registration.x, y: -registration.y, z: -registration.z },
|
||||||
corners[2] = { x: -registration.x, y: 1.0 - registration.y, z: -registration.z };
|
{ x: -registration.x, y: -registration.y, z: 1.0 - registration.z },
|
||||||
corners[3] = { x: -registration.x, y: 1.0 - registration.y, z: 1.0 - registration.z };
|
{ x: -registration.x, y: 1.0 - registration.y, z: -registration.z },
|
||||||
corners[4] = { x: 1.0 - registration.x, y: -registration.y, z: -registration.z };
|
{ x: -registration.x, y: 1.0 - registration.y, z: 1.0 - registration.z },
|
||||||
corners[5] = { x: 1.0 - registration.x, y: -registration.y, z: 1.0 - registration.z };
|
{ x: 1.0 - registration.x, y: -registration.y, z: -registration.z },
|
||||||
corners[6] = { x: 1.0 - registration.x, y: 1.0 - registration.y, z: -registration.z };
|
{ x: 1.0 - registration.x, y: -registration.y, z: 1.0 - registration.z },
|
||||||
corners[7] = { x: 1.0 - registration.x, y: 1.0 - registration.y, z: 1.0 - registration.z };
|
{ x: 1.0 - registration.x, y: 1.0 - registration.y, z: -registration.z },
|
||||||
|
{ x: 1.0 - registration.x, y: 1.0 - registration.y, z: 1.0 - registration.z }
|
||||||
|
];
|
||||||
|
|
||||||
position = selection[i].position;
|
position = selection[i].position;
|
||||||
rotation = selection[i].rotation;
|
rotation = selection[i].rotation;
|
||||||
|
|
|
@ -129,6 +129,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
},
|
},
|
||||||
|
|
||||||
MENU_HEADER_BACK_PROPERTIES = {
|
MENU_HEADER_BACK_PROPERTIES = {
|
||||||
|
// Magic numbers per UI design spec.
|
||||||
url: Script.resolvePath("../assets/tools/back-icon.svg"),
|
url: Script.resolvePath("../assets/tools/back-icon.svg"),
|
||||||
dimensions: { x: 0.0069, y: 0.0107 },
|
dimensions: { x: 0.0069, y: 0.0107 },
|
||||||
localPosition: {
|
localPosition: {
|
||||||
|
@ -200,7 +201,8 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
SWATCH_HIGHLIGHT_DELTA = 0.0020,
|
SWATCH_HIGHLIGHT_DELTA = 0.0020,
|
||||||
|
|
||||||
UI_ELEMENTS = {
|
UI_ELEMENTS = {
|
||||||
"menuButton": {
|
// Magic numbers per UI design spec.
|
||||||
|
menuButton: {
|
||||||
overlay: "cube", // Invisible cube for hit area.
|
overlay: "cube", // Invisible cube for hit area.
|
||||||
properties: {
|
properties: {
|
||||||
dimensions: UIT.dimensions.itemCollisionZone,
|
dimensions: UIT.dimensions.itemCollisionZone,
|
||||||
|
@ -268,7 +270,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"button": {
|
button: {
|
||||||
overlay: "cube",
|
overlay: "cube",
|
||||||
properties: {
|
properties: {
|
||||||
dimensions: UIT.dimensions.buttonDimensions,
|
dimensions: UIT.dimensions.buttonDimensions,
|
||||||
|
@ -289,7 +291,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
color: UIT.colors.white
|
color: UIT.colors.white
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"toggleButton": {
|
toggleButton: {
|
||||||
overlay: "cube",
|
overlay: "cube",
|
||||||
properties: {
|
properties: {
|
||||||
dimensions: UIT.dimensions.buttonDimensions,
|
dimensions: UIT.dimensions.buttonDimensions,
|
||||||
|
@ -327,7 +329,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
offSublabel: { } // Optional properties to update sublabel with.
|
offSublabel: { } // Optional properties to update sublabel with.
|
||||||
*/
|
*/
|
||||||
},
|
},
|
||||||
"swatch": {
|
swatch: {
|
||||||
overlay: "shape",
|
overlay: "shape",
|
||||||
properties: {
|
properties: {
|
||||||
shape: "Cylinder",
|
shape: "Cylinder",
|
||||||
|
@ -344,7 +346,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
// Setting property may optionally include a defaultValue.
|
// Setting property may optionally include a defaultValue.
|
||||||
// A setting value of "" means that the swatch is unpopulated.
|
// A setting value of "" means that the swatch is unpopulated.
|
||||||
},
|
},
|
||||||
"swatchHighlight": {
|
swatchHighlight: {
|
||||||
overlay: "shape",
|
overlay: "shape",
|
||||||
properties: {
|
properties: {
|
||||||
shape: "Cylinder",
|
shape: "Cylinder",
|
||||||
|
@ -364,7 +366,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"square": {
|
square: {
|
||||||
overlay: "cube", // Emulate a 2D square with a cube.
|
overlay: "cube", // Emulate a 2D square with a cube.
|
||||||
properties: {
|
properties: {
|
||||||
localRotation: Quat.ZERO,
|
localRotation: Quat.ZERO,
|
||||||
|
@ -375,7 +377,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"image": {
|
image: {
|
||||||
overlay: "image3d",
|
overlay: "image3d",
|
||||||
properties: {
|
properties: {
|
||||||
localPosition: { x: 0, y: 0, z: 0 },
|
localPosition: { x: 0, y: 0, z: 0 },
|
||||||
|
@ -387,7 +389,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"horizontalRule": {
|
horizontalRule: {
|
||||||
overlay: "image3d",
|
overlay: "image3d",
|
||||||
properties: {
|
properties: {
|
||||||
url: Script.resolvePath("../assets/horizontal-rule.svg"),
|
url: Script.resolvePath("../assets/horizontal-rule.svg"),
|
||||||
|
@ -401,7 +403,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sphere": {
|
sphere: {
|
||||||
overlay: "sphere",
|
overlay: "sphere",
|
||||||
properties: {
|
properties: {
|
||||||
dimensions: { x: 0.01, y: 0.01, z: 0.01 },
|
dimensions: { x: 0.01, y: 0.01, z: 0.01 },
|
||||||
|
@ -413,7 +415,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"barSlider": {
|
barSlider: {
|
||||||
// Invisible cube to catch laser intersections; value and remainder entities move inside.
|
// Invisible cube to catch laser intersections; value and remainder entities move inside.
|
||||||
// Values range between 0.0 and 1.0.
|
// Values range between 0.0 and 1.0.
|
||||||
overlay: "cube",
|
overlay: "cube",
|
||||||
|
@ -470,7 +472,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"imageSlider": { // Values range between 0.0 and 1.0.
|
imageSlider: { // Values range between 0.0 and 1.0.
|
||||||
overlay: "cube",
|
overlay: "cube",
|
||||||
properties: {
|
properties: {
|
||||||
dimensions: { x: 0.0160, y: 0.1229, z: UIT.dimensions.buttonDimensions.z },
|
dimensions: { x: 0.0160, y: 0.1229, z: UIT.dimensions.buttonDimensions.z },
|
||||||
|
@ -485,7 +487,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
imageURL: null,
|
imageURL: null,
|
||||||
imageOverlayURL: null
|
imageOverlayURL: null
|
||||||
},
|
},
|
||||||
"sliderPointer": {
|
sliderPointer: {
|
||||||
overlay: "shape",
|
overlay: "shape",
|
||||||
properties: {
|
properties: {
|
||||||
shape: "Cone",
|
shape: "Cone",
|
||||||
|
@ -498,7 +500,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"colorCircle": {
|
colorCircle: {
|
||||||
overlay: "shape",
|
overlay: "shape",
|
||||||
properties: {
|
properties: {
|
||||||
shape: "Cylinder",
|
shape: "Cylinder",
|
||||||
|
@ -513,7 +515,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
imageURL: null,
|
imageURL: null,
|
||||||
imageOverlayURL: null
|
imageOverlayURL: null
|
||||||
},
|
},
|
||||||
"circlePointer": {
|
circlePointer: {
|
||||||
overlay: "shape",
|
overlay: "shape",
|
||||||
properties: {
|
properties: {
|
||||||
shape: "Cone",
|
shape: "Cone",
|
||||||
|
@ -526,7 +528,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"picklist": {
|
picklist: {
|
||||||
overlay: "cube",
|
overlay: "cube",
|
||||||
properties: {
|
properties: {
|
||||||
dimensions: { x: 0.06, y: 0.02, z: 0.01 },
|
dimensions: { x: 0.06, y: 0.02, z: 0.01 },
|
||||||
|
@ -542,7 +544,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
color: UIT.colors.white
|
color: UIT.colors.white
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"picklistItem": { // Note: When using, declare before picklist item that it's being used in.
|
picklistItem: { // Note: When using, declare before picklist item that it's being used in.
|
||||||
overlay: "cube",
|
overlay: "cube",
|
||||||
properties: {
|
properties: {
|
||||||
dimensions: { x: 0.1416, y: 0.0280, z: UIT.dimensions.buttonDimensions.z },
|
dimensions: { x: 0.1416, y: 0.0280, z: UIT.dimensions.buttonDimensions.z },
|
||||||
|
@ -589,6 +591,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
},
|
},
|
||||||
|
|
||||||
OPTONS_PANELS = {
|
OPTONS_PANELS = {
|
||||||
|
// Magic numbers per UI design spec.
|
||||||
colorOptions: [
|
colorOptions: [
|
||||||
{
|
{
|
||||||
id: "colorSwatchesLabel",
|
id: "colorSwatchesLabel",
|
||||||
|
@ -1683,6 +1686,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
MENU_ITEM_YS = [0.086, 0.030, -0.026, -0.082],
|
MENU_ITEM_YS = [0.086, 0.030, -0.026, -0.082],
|
||||||
|
|
||||||
MENU_ITEMS = [
|
MENU_ITEMS = [
|
||||||
|
// Magic numbers per UI design spec.
|
||||||
{
|
{
|
||||||
id: "colorButton",
|
id: "colorButton",
|
||||||
type: "menuButton",
|
type: "menuButton",
|
||||||
|
@ -1921,6 +1925,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
DELETE_TOOL = 5,
|
DELETE_TOOL = 5,
|
||||||
|
|
||||||
FOOTER_ITEMS = [
|
FOOTER_ITEMS = [
|
||||||
|
// Magic numbers per UI design spec.
|
||||||
{
|
{
|
||||||
id: "footerRule",
|
id: "footerRule",
|
||||||
type: "horizontalRule",
|
type: "horizontalRule",
|
||||||
|
@ -2041,6 +2046,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
|
|
||||||
function setHand(hand) {
|
function setHand(hand) {
|
||||||
// Assumes UI is not displaying.
|
// Assumes UI is not displaying.
|
||||||
|
var NUMBER_OF_HANDS = 2;
|
||||||
side = hand;
|
side = hand;
|
||||||
if (side === LEFT_HAND) {
|
if (side === LEFT_HAND) {
|
||||||
controlHand = rightInputs.hand();
|
controlHand = rightInputs.hand();
|
||||||
|
@ -2055,7 +2061,7 @@ ToolsMenu = function (side, leftInputs, rightInputs, uiCommandCallback) {
|
||||||
menuOriginLocalPosition = PANEL_ORIGIN_POSITION_RIGHT_HAND;
|
menuOriginLocalPosition = PANEL_ORIGIN_POSITION_RIGHT_HAND;
|
||||||
menuOriginLocalRotation = PANEL_ORIGIN_ROTATION_RIGHT_HAND;
|
menuOriginLocalRotation = PANEL_ORIGIN_ROTATION_RIGHT_HAND;
|
||||||
}
|
}
|
||||||
otherSide = (side + 1) % 2;
|
otherSide = (side + 1) % NUMBER_OF_HANDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
setHand(side);
|
setHand(side);
|
||||||
|
|
|
@ -113,7 +113,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function otherHand(hand) {
|
function otherHand(hand) {
|
||||||
return (hand + 1) % 2;
|
var NUMBER_OF_HANDS = 2;
|
||||||
|
return (hand + 1) % NUMBER_OF_HANDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
App = {
|
App = {
|
||||||
|
@ -1989,7 +1990,8 @@
|
||||||
Entities.canRezChanged.disconnect(onCanRezChanged);
|
Entities.canRezChanged.disconnect(onCanRezChanged);
|
||||||
Entities.canRezTmpChanged.disconnect(onCanRezChanged);
|
Entities.canRezTmpChanged.disconnect(onCanRezChanged);
|
||||||
Messages.messageReceived.disconnect(onMessageReceived);
|
Messages.messageReceived.disconnect(onMessageReceived);
|
||||||
Messages.unsubscribe(DOMAIN_CHANGED_MESSAGE);
|
// Messages.unsubscribe(DOMAIN_CHANGED_MESSAGE); Do NOT unsubscribe because edit.js also subscribes and
|
||||||
|
// Messages.subscribe works client-wide.
|
||||||
MyAvatar.dominantHandChanged.disconnect(onDominantHandChanged);
|
MyAvatar.dominantHandChanged.disconnect(onDominantHandChanged);
|
||||||
MyAvatar.skeletonChanged.disconnect(onSkeletonChanged);
|
MyAvatar.skeletonChanged.disconnect(onSkeletonChanged);
|
||||||
|
|
||||||
|
|
|
@ -105,4 +105,4 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
disableDispatcherModule("RightHandInVREditMode");
|
disableDispatcherModule("RightHandInVREditMode");
|
||||||
};
|
};
|
||||||
Script.scriptEnding.connect(this.cleanup);
|
Script.scriptEnding.connect(this.cleanup);
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
// note: this constant is currently duplicated in edit.js and ambientSounds.js
|
// note: this constant is currently duplicated in edit.js and ambientSound.js
|
||||||
EDIT_SETTING = "io.highfidelity.isEditing";
|
EDIT_SETTING = "io.highfidelity.isEditing";
|
||||||
isInEditMode = function isInEditMode() {
|
isInEditMode = function isInEditMode() {
|
||||||
return Settings.getValue(EDIT_SETTING);
|
return Settings.getValue(EDIT_SETTING);
|
||||||
|
|
Loading…
Reference in a new issue