From 9005efb639fb0281709a74a3f98fed1e62b83c47 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Fri, 9 Nov 2018 01:22:59 +0100 Subject: [PATCH] style fixes --- scripts/system/edit.js | 24 ++++----- scripts/system/html/css/edit-style.css | 15 +++--- scripts/system/html/css/hifi-style.css | 8 +-- scripts/system/html/js/entityList.js | 50 +++++++++++++------ .../system/libraries/entitySelectionTool.js | 18 ++----- 5 files changed, 63 insertions(+), 52 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 38f9c5ea34..d3e9a475ac 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -494,9 +494,9 @@ var toolBar = (function () { applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.All); var type = requestedProperties.type; - if (type == "Box" || type == "Sphere") { + if (type === "Box" || type === "Sphere") { applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Shape); - } else if (type == "Image") { + } else if (type === "Image") { requestedProperties.type = "Model"; applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Image); } else { @@ -1218,7 +1218,7 @@ function mouseClickEvent(event) { var result, properties, tabletClicked; if (isActive && event.isLeftButton) { result = findClickedEntity(event); - tabletOrEditHandleClicked = wasTabletOrEditHandleClicked(event); + var tabletOrEditHandleClicked = wasTabletOrEditHandleClicked(event); if (tabletOrEditHandleClicked) { return; } @@ -1541,7 +1541,7 @@ function insideBox(center, dimensions, point) { (Math.abs(point.z - center.z) <= (dimensions.z / 2.0)); } -function selectAllEtitiesInCurrentSelectionBox(keepIfTouching) { +function selectAllEntitiesInCurrentSelectionBox(keepIfTouching) { if (selectionManager.hasSelection()) { // Get all entities touching the bounding box of the current selection var boundingBoxCorner = Vec3.subtract(selectionManager.worldPosition, @@ -1820,9 +1820,9 @@ function handleMenuEvent(menuItem) { Window.promptAsync("URL of SVO to import", ""); } } else if (menuItem === "Select All Entities In Box") { - selectAllEtitiesInCurrentSelectionBox(false); + selectAllEntitiesInCurrentSelectionBox(false); } else if (menuItem === "Select All Entities Touching Box") { - selectAllEtitiesInCurrentSelectionBox(true); + selectAllEntitiesInCurrentSelectionBox(true); } else if (menuItem === MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE) { entityIconOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE)); } else if (menuItem === MENU_SHOW_ZONES_IN_EDIT_MODE) { @@ -2108,14 +2108,14 @@ var DELETED_ENTITY_MAP = {}; function applyEntityProperties(data) { var editEntities = data.editEntities; var selectedEntityIDs = []; - var selectEdits = data.createEntities.length == 0 || !data.selectCreated; - var i, entityID; + var selectEdits = data.createEntities.length === 0 || !data.selectCreated; + var i, entityID, entityProperties; for (i = 0; i < editEntities.length; i++) { - var entityID = editEntities[i].entityID; + entityID = editEntities[i].entityID; if (DELETED_ENTITY_MAP[entityID] !== undefined) { entityID = DELETED_ENTITY_MAP[entityID]; } - var entityProperties = editEntities[i].properties; + entityProperties = editEntities[i].properties; if (entityProperties !== null) { Entities.editEntity(entityID, entityProperties); } @@ -2125,7 +2125,7 @@ function applyEntityProperties(data) { } for (i = 0; i < data.createEntities.length; i++) { entityID = data.createEntities[i].entityID; - var entityProperties = data.createEntities[i].properties; + entityProperties = data.createEntities[i].properties; var newEntityID = Entities.addEntity(entityProperties); recursiveAdd(newEntityID, data.createEntities[i]); DELETED_ENTITY_MAP[entityID] = newEntityID; @@ -2597,7 +2597,7 @@ var PopupMenu = function () { y: event.y }); if (!pressingOverlay) { - if (hoveringOverlay !== null && hoveringOverlay !== null && overlay !== hoveringOverlay) { + if (hoveringOverlay !== null && overlay !== hoveringOverlay) { Overlays.editOverlay(hoveringOverlay, { backgroundColor: upColor }); diff --git a/scripts/system/html/css/edit-style.css b/scripts/system/html/css/edit-style.css index 941a9ec171..e4b33414ab 100644 --- a/scripts/system/html/css/edit-style.css +++ b/scripts/system/html/css/edit-style.css @@ -103,7 +103,7 @@ thead { font-size: 12px; text-transform: uppercase; background-color: #1c1c1c; - padding: 1px 0px; + padding: 1px 0; border-bottom: 1px solid #575757; width: 100%; } @@ -283,7 +283,7 @@ input[type=number]::-webkit-inner-spin-button { width: 10px; height: 90%; overflow: hidden; - font-family: hifi-glyphs; + font-family: HiFi-Glyphs; font-size: 32px; color: #afafaf; cursor: pointer; @@ -347,7 +347,7 @@ input[type=button], button.hifi-edit-button { vertical-align: top; height: 28px; min-width: 120px; - padding: 0px 18px; + padding: 0 18px; margin-right: 6px; border-radius: 5px; border: none; @@ -447,7 +447,7 @@ input[type=checkbox]:checked + label:hover { position: absolute; left: 6px; top: -2px; - font-family: hifi-glyphs; + font-family: HiFi-Glyphs; font-size: 30px; color: #afafaf; } @@ -1100,7 +1100,6 @@ body#entity-list-body { float: right; margin-right: 0; background-color: #ff0000; - min-width: 90px; } #entity-list { @@ -1129,7 +1128,7 @@ body#entity-list-body { #filter-type-checkboxes span { position: relative; top: 3px; - font-family: hifi-glyphs; + font-family: HiFi-Glyphs; font-size: 13px; color: #000000; padding-left: 6px; @@ -1173,7 +1172,7 @@ body#entity-list-body { #filter-in-view { position: absolute; - top: 0px; + top: 0; right: 126px; } @@ -1453,7 +1452,7 @@ th#entity-hasScript { } #properties-base #property-type-icon { - font-family: hifi-glyphs; + font-family: HiFi-Glyphs; font-size: 31px; color: #00b4ef; margin: -4px 12px -4px -2px; diff --git a/scripts/system/html/css/hifi-style.css b/scripts/system/html/css/hifi-style.css index e1e4f67723..90a5b366c2 100644 --- a/scripts/system/html/css/hifi-style.css +++ b/scripts/system/html/css/hifi-style.css @@ -139,9 +139,9 @@ input[type=radio]:active + label > span > span{ font-family: Raleway-Bold; font-size: 13px; color: black; - padding: 0px 10px; + padding: 0 10px; border-radius: 3px; - border-width: 0px; + border-width: 0; background-image: linear-gradient(#FFFFFF, #AFAFAF); min-height: 30px; } @@ -158,9 +158,9 @@ input[type=radio]:active + label > span > span{ font-family: Raleway-Bold; font-size: 13px; color: white; - padding: 0px 10px; + padding: 0 10px; border-radius: 3px; - border-width: 0px; + border-width: 0; background-image: linear-gradient(#00B4EF, #1080B8); min-height: 30px; } diff --git a/scripts/system/html/js/entityList.js b/scripts/system/html/js/entityList.js index 315e313ae6..0204f0c349 100644 --- a/scripts/system/html/js/entityList.js +++ b/scripts/system/html/js/entityList.js @@ -23,7 +23,6 @@ const FILTER_IN_VIEW_ATTRIBUTE = "pressed"; const WINDOW_NONVARIABLE_HEIGHT = 227; const NUM_COLUMNS = 12; const EMPTY_ENTITY_ID = "0"; -const MAX_LENGTH_RADIUS = 9; const DELETE = 46; // Key code for the delete key. const KEY_P = 80; // Key code for letter p used for Parenting hotkey. @@ -85,29 +84,52 @@ const ICON_FOR_TYPE = { }; // List of all entities -var entities = []; +let entities = []; // List of all entities, indexed by Entity ID -var entitiesByID = {}; +let entitiesByID = {}; // The filtered and sorted list of entities passed to ListView -var visibleEntities = []; +let visibleEntities = []; // List of all entities that are currently selected -var selectedEntities = []; +let selectedEntities = []; -var entityList = null; // The ListView +let entityList = null; // The ListView /** * @type EntityListContextMenu */ -var entityListContextMenu = null; +let entityListContextMenu = null; -var currentSortColumn = 'type'; -var currentSortOrder = ASCENDING_SORT; -var typeFilters = []; -var isFilterInView = false; -var showExtraInfo = false; +let currentSortColumn = 'type'; +let currentSortOrder = ASCENDING_SORT; +let typeFilters = []; +let isFilterInView = false; +let showExtraInfo = false; + +let elEntityTable, + elEntityTableBody, + elEntityTableScroll, + elEntityTableHeaderRow, + elRefresh, + elToggleLocked, + elToggleVisible, + elDelete, + elFilterTypeSelectBox, + elFilterTypeText, + elFilterTypeCheckboxes, + elFilterSearch, + elFilterInView, + elFilterRadius, + elExport, + elPal, + elInfoToggle, + elInfoToggleGlyph, + elSelectedEntitiesCount, + elVisibleEntitiesCount, + elNoEntitiesMessage, + elToggleSpaceMode; const ENABLE_PROFILING = false; -var profileIndent = ''; +let profileIndent = ''; const PROFILE_NOOP = function(_name, fn, args) { fn.apply(this, args); } ; @@ -140,7 +162,7 @@ function loaded() { elFilterTypeText = document.getElementById("filter-type-text"); elFilterTypeCheckboxes = document.getElementById("filter-type-checkboxes"); elFilterSearch = document.getElementById("filter-search"); - elFilterInView = document.getElementById("filter-in-view") + elFilterInView = document.getElementById("filter-in-view"); elFilterRadius = document.getElementById("filter-radius"); elExport = document.getElementById("export"); elPal = document.getElementById("pal"); diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index b0b1740821..51a677b7b6 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -281,7 +281,7 @@ SelectionManager = (function() { var actionArguments = Entities.getActionArguments(properties.id, actionID); if (actionArguments) { var type = actionArguments.type; - if (type == 'hold' || type == 'far-grab') { + if (type === 'hold' || type === 'far-grab') { continue; } delete actionArguments.ttl; @@ -501,6 +501,7 @@ SelectionManager = (function() { if (selectionUpdated) { SelectionDisplay.useDesiredSpaceMode(); + //SelectionDisplay.setSpaceMode(SPACE_LOCAL, false); } } else { properties = Entities.getEntityProperties(that.selections[0], ['type', 'boundingBox']); @@ -633,17 +634,6 @@ SelectionDisplay = (function() { ALL: 3 }; - const SCALE_DIRECTION = { - LBN: 0, - RBN: 1, - LBF: 2, - RBF: 3, - LTN: 4, - RTN: 5, - LTF: 6, - RTF: 7 - }; - const ROTATE_DIRECTION = { PITCH: 0, YAW: 1, @@ -1342,7 +1332,7 @@ SelectionDisplay = (function() { } }; - function controllerComputePickRay(hand) { + function controllerComputePickRay() { var hand = that.triggered() ? that.triggeredHand : that.pressedHand; var controllerPose = getControllerWorldLocation(hand, true); if (controllerPose.valid) { @@ -1832,7 +1822,7 @@ SelectionDisplay = (function() { !isActiveTool(handleRotateYawRing) && !isActiveTool(handleRotateRollRing))); - // keep duplicator always hidden for now since you can hold Alt to duplciate while + // keep duplicator always hidden for now since you can hold Alt to duplicate while // translating an entity - we may bring duplicator back for HMD only later // that.setHandleDuplicatorVisible(!activeTool || isActiveTool(handleDuplicator));