From 08d9eda7d7115a785fb8f72fd63039df91a5378d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 9 Nov 2018 17:08:10 -0800 Subject: [PATCH 1/3] fix property bugs / style issues --- scripts/system/html/css/edit-style.css | 55 +++++++++++----------- scripts/system/html/js/draggableNumber.js | 8 +++- scripts/system/html/js/entityProperties.js | 18 ++++--- 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/scripts/system/html/css/edit-style.css b/scripts/system/html/css/edit-style.css index 5107ad8a3d..cb8dd7bcbc 100644 --- a/scripts/system/html/css/edit-style.css +++ b/scripts/system/html/css/edit-style.css @@ -309,34 +309,6 @@ input[type=number].hover-down::-webkit-inner-spin-button:after { color: #ffffff; } -.draggable-number { - position: relative; - right: 10px; -} -.draggable-number span { - position: relative; - top: -2px; - display: inline-block; - font-family: hifi-glyphs; - font-size: 20px; - z-index: 2; -} -.draggable-number.left-arrow { - left: 18px; - transform: rotate(180deg); -} -.draggable-number.right-arrow { - right: 18px; -} -.draggable-number input { -} -.draggable-number input::selection { -} -.draggable-number input::-webkit-inner-spin-button { - -webkit-appearance: none; - visibility: hidden; -} - input[type=range] { -webkit-appearance: none; background: #2e2e2e; @@ -903,6 +875,33 @@ div.refresh input[type="button"] { clear: both; } +.draggable-number { + position: relative; + right: 10px; +} +.draggable-number span { + position: relative; + top: -2px; + display: inline-block; + font-family: hifi-glyphs; + font-size: 20px; + z-index: 2; +} +.draggable-number.left-arrow { + left: 17px; + transform: rotate(180deg); +} +.draggable-number.right-arrow { + right: 17px; +} +.draggable-number.fstuple span { + top: 0; +} +.draggable-number input::-webkit-inner-spin-button { + -webkit-appearance: none; + visibility: hidden; +} + .row .property { width: auto; display: inline-block; diff --git a/scripts/system/html/js/draggableNumber.js b/scripts/system/html/js/draggableNumber.js index 62fa02c6f9..30ad6f1b5c 100644 --- a/scripts/system/html/js/draggableNumber.js +++ b/scripts/system/html/js/draggableNumber.js @@ -15,6 +15,7 @@ function DraggableNumber(min, max, step) { this.max = max; this.step = step !== undefined ? step : 1; this.startEvent = null; + this.inputChangeFunction = null; this.initialize(); } @@ -41,7 +42,9 @@ DraggableNumber.prototype = { newValue = this.max; } this.elInput.value = newValue; - this.inputChangeFunction(); + if (this.inputChangeFunction) { + this.inputChangeFunction(); + } this.startEvent = event; } }, @@ -53,6 +56,9 @@ DraggableNumber.prototype = { }, setInputChangeFunction: function(inputChangeFunction) { + if (this.inputChangeFunction) { + this.elInput.removeEventListener('change', this.inputChangeFunction); + } this.inputChangeFunction = inputChangeFunction.bind(this.elInput); this.elInput.addEventListener('change', this.inputChangeFunction); }, diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 5ea810a069..204b97918e 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -254,7 +254,7 @@ const GROUPS = [ buttons: [ { id: "copy", label: "Copy from Skybox", className: "black", onClick: copySkyboxURLToAmbientURL } ], propertyID: "copyURLToAmbient", - showPropertyRule: { "skyboxMode": "enabled" }, + showPropertyRule: { "ambientLightMode": "enabled" }, }, { label: "Haze", @@ -1772,9 +1772,14 @@ function createNumberProperty(property, elProperty) { let elementID = property.elementID; let propertyData = property.data; - elProperty.className = "property draggable-number"; + elProperty.className = "draggable-number"; let elDraggableNumber = new DraggableNumber(propertyData.min, propertyData.max, propertyData.step); + + let defaultValue = propertyData.defaultValue; + if (defaultValue !== undefined) { + elDraggableNumber.elInput.value = defaultValue; + } let inputChangeFunction = createEmitNumberPropertyUpdateFunction(propertyName, propertyData.multiplier, propertyData.decimals, property.isParticleProperty); elDraggableNumber.setInputChangeFunction(inputChangeFunction); @@ -1839,7 +1844,7 @@ function createVec2Property(property, elProperty) { let elNumberY = createTupleNumberInput(elProperty, elementID, propertyData.subLabels[VECTOR_ELEMENTS.Y_INPUT], propertyData.min, propertyData.max, propertyData.step); - let inputChangeFunction = createEmitVec3PropertyUpdateFunction(propertyName, elNumberX.elInput, elNumberY.elInput, + let inputChangeFunction = createEmitVec2PropertyUpdateFunction(propertyName, elNumberX.elInput, elNumberY.elInput, propertyData.multiplier, property.isParticleProperty); elNumberX.setInputChangeFunction(inputChangeFunction); elNumberY.setInputChangeFunction(inputChangeFunction); @@ -1871,7 +1876,7 @@ function createColorProperty(property, elProperty) { let elNumberB = createTupleNumberInput(elTuple, elementID, "blue", COLOR_MIN, COLOR_MAX, COLOR_STEP); let inputChangeFunction = createEmitColorPropertyUpdateFunction(propertyName, elNumberR.elInput, elNumberG.elInput, - elNumberB.elInput, property.isParticleProperty); + elNumberB.elInput, property.isParticleProperty); elNumberR.setInputChangeFunction(inputChangeFunction); elNumberG.setInputChangeFunction(inputChangeFunction); elNumberB.setInputChangeFunction(inputChangeFunction); @@ -2055,6 +2060,7 @@ function createTupleNumberInput(elTuple, propertyElementID, subLabel, min, max, let elDraggableNumber = new DraggableNumber(min, max, step); elDraggableNumber.elInput.setAttribute("id", elementID); + elDraggableNumber.elDiv.className += " fstuple"; elDraggableNumber.elDiv.insertBefore(elLabel, elDraggableNumber.elLeftArrow); elTuple.appendChild(elDraggableNumber.elDiv); @@ -2766,10 +2772,10 @@ function loaded() { if (propertyData.indentedLabel || propertyData.showPropertyRule !== undefined) { let elSpan = document.createElement('span'); elSpan.className = 'indented'; - elSpan.innerText = propertyData.label; + elSpan.innerText = propertyData.label !== undefined ? propertyData.label : ""; elLabel.appendChild(elSpan); } else { - elLabel.innerText = propertyData.label; + elLabel.innerText = propertyData.label !== undefined ? propertyData.label : ""; } elContainer.appendChild(elLabel); } else { From 0160ab23ab2efd745238c582ddcf6b864b08a4cc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 9 Nov 2018 17:23:51 -0800 Subject: [PATCH 2/3] fix color pickers --- scripts/system/html/css/edit-style.css | 3 +++ scripts/system/html/js/entityProperties.js | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/system/html/css/edit-style.css b/scripts/system/html/css/edit-style.css index cb8dd7bcbc..7aa08b35cd 100644 --- a/scripts/system/html/css/edit-style.css +++ b/scripts/system/html/css/edit-style.css @@ -853,6 +853,9 @@ div.refresh input[type="button"] { border-color: #afafaf; } +.colpick { + z-index: 3; +} .colpick[disabled="disabled"] { display: none !important; } diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 204b97918e..c26d581ec3 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -1892,9 +1892,9 @@ function createColorProperty(property, elProperty) { // The original color preview within the picker needs to be updated on show because // prior to the picker being shown we don't have access to the selections' starting color. colorPickers[colorPickerID].colpickSetColor({ - "r": elInputR.value, - "g": elInputG.value, - "b": elInputB.value + "r": elNumberR.elInput.value, + "g": elNumberG.elInput.value, + "b": elNumberB.elInput.value }); }, onHide: function(colpick) { From 4eab623fd8a22484c0d833bc1272aca79a6b990e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 9 Nov 2018 17:25:48 -0800 Subject: [PATCH 3/3] remove debugPrint function --- scripts/system/html/js/draggableNumber.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/system/html/js/draggableNumber.js b/scripts/system/html/js/draggableNumber.js index 30ad6f1b5c..e961bbb4a7 100644 --- a/scripts/system/html/js/draggableNumber.js +++ b/scripts/system/html/js/draggableNumber.js @@ -6,10 +6,6 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -debugPrint = function (message) { - console.log(message); -}; - function DraggableNumber(min, max, step) { this.min = min; this.max = max;