diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index e9d65eff1d..1d0001a592 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -59,10 +59,8 @@ SelectionManager = (function() { for (var i = 0; i < entityIDs.length; i++) { var entityID = entityIDs[i]; if (entityID.isKnownID) { - print('known!'); that.selections.push(entityID); } else { - print('not known!'); that.pendingSelections.push(entityID); if (pendingSelectionTimer == null) { pendingSelectionTimer = Script.setInterval(that._checkPendingSelections, PENDING_SELECTION_CHECK_INTERVAL); @@ -74,12 +72,10 @@ SelectionManager = (function() { }; that._checkPendingSelections = function() { - print("CHECKING PENDING SELCTIONS"); for (var i = 0; i < that.pendingSelections.length; i++) { var entityID = that.pendingSelections[i]; var newEntityID = Entities.identifyEntity(entityID); if (newEntityID.isKnownID) { - print("is known!"); that.pendingSelections.splice(i, 1); that.addEntity(newEntityID); i--; @@ -94,13 +90,11 @@ SelectionManager = (function() { that.addEntity = function(entityID) { if (entityID.isKnownID) { - print('known: ' + entityID.id); var idx = that.selections.indexOf(entityID); if (idx == -1) { that.selections.push(entityID); } } else { - print('not known!'); var idx = that.pendingSelections.indexOf(entityID); if (idx == -1) { that.pendingSelections.push(entityID); diff --git a/examples/newEditEntities.js b/examples/newEditEntities.js index d9b2f95b3d..68d5965b1a 100644 --- a/examples/newEditEntities.js +++ b/examples/newEditEntities.js @@ -1,4 +1,4 @@ -// + // newEditEntities.js // examples // @@ -272,7 +272,7 @@ var toolBar = (function () { toggleNewModelButton(false); file = Window.browse("Select your model file ...", - Settings.getValue("LastModelUploadLocation").path(), + Settings.getValue("LastModelUploadLocation").path(), "Model files (*.fst *.fbx)"); //"Model files (*.fst *.fbx *.svo)"); if (file !== null) { @@ -295,7 +295,7 @@ var toolBar = (function () { var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE)); if (position.x > 0 && position.y > 0 && position.z > 0) { - Entities.addEntity({ + Entities.addEntity({ type: "Box", position: position, dimensions: { x: DEFAULT_DIMENSION, y: DEFAULT_DIMENSION, z: DEFAULT_DIMENSION }, @@ -312,7 +312,7 @@ var toolBar = (function () { var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE)); if (position.x > 0 && position.y > 0 && position.z > 0) { - Entities.addEntity({ + Entities.addEntity({ type: "Sphere", position: position, dimensions: { x: DEFAULT_DIMENSION, y: DEFAULT_DIMENSION, z: DEFAULT_DIMENSION }, @@ -433,7 +433,7 @@ function mousePressEvent(event) { var angularSize = 2 * Math.atan(halfDiagonal / Vec3.distance(Camera.getPosition(), properties.position)) * 180 / 3.14; - var sizeOK = (allowLargeModels || angularSize < MAX_ANGULAR_SIZE) + var sizeOK = (allowLargeModels || angularSize < MAX_ANGULAR_SIZE) && (allowSmallModels || angularSize > MIN_ANGULAR_SIZE); if (0 < x && sizeOK) { @@ -467,7 +467,7 @@ function mousePressEvent(event) { w: selectedEntityProperties.rotation.w, }; selectedEntityProperties.glowLevel = 0.0; - + print("Clicked on " + selectedEntityID.id + " " + entitySelected); tooltip.updateText(selectedEntityProperties); tooltip.show(true); @@ -481,7 +481,7 @@ function mouseMoveEvent(event) { if (!isActive) { return; } - + // allow the selectionDisplay and cameraManager to handle the event first, if it doesn't handle it, then do our own thing if (selectionDisplay.mouseMoveEvent(event) || cameraManager.mouseMoveEvent(event)) { return; @@ -496,11 +496,11 @@ function mouseMoveEvent(event) { } var halfDiagonal = Vec3.length(entityIntersection.properties.dimensions) / 2.0; - - var angularSize = 2 * Math.atan(halfDiagonal / Vec3.distance(Camera.getPosition(), + + var angularSize = 2 * Math.atan(halfDiagonal / Vec3.distance(Camera.getPosition(), entityIntersection.properties.position)) * 180 / 3.14; - var sizeOK = (allowLargeModels || angularSize < MAX_ANGULAR_SIZE) + var sizeOK = (allowLargeModels || angularSize < MAX_ANGULAR_SIZE) && (allowSmallModels || angularSize > MIN_ANGULAR_SIZE); if (entityIntersection.entityID.isKnownID && sizeOK) { @@ -510,7 +510,7 @@ function mouseMoveEvent(event) { highlightedEntityID = entityIntersection.entityID; selectionDisplay.highlightSelectable(entityIntersection.entityID); } - + } } @@ -550,9 +550,9 @@ function setupModelMenus() { } Menu.addMenuItem({ menuName: "Edit", menuItemName: "Paste Models", shortcutKey: "CTRL+META+V", afterItem: "Edit Properties..." }); - Menu.addMenuItem({ menuName: "Edit", menuItemName: "Allow Select Large Models", shortcutKey: "CTRL+META+L", + Menu.addMenuItem({ menuName: "Edit", menuItemName: "Allow Select Large Models", shortcutKey: "CTRL+META+L", afterItem: "Paste Models", isCheckable: true }); - Menu.addMenuItem({ menuName: "Edit", menuItemName: "Allow Select Small Models", shortcutKey: "CTRL+META+S", + Menu.addMenuItem({ menuName: "Edit", menuItemName: "Allow Select Small Models", shortcutKey: "CTRL+META+S", afterItem: "Allow Select Large Models", isCheckable: true }); Menu.addMenuItem({ menuName: "File", menuItemName: "Models", isSeparator: true, beforeItem: "Settings" });