From 7f84b27880094d08cd3b9bef553eeaaa62844f4e Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 1 May 2015 11:59:39 -0700 Subject: [PATCH] Add support for changing sphere color in edit.js --- examples/html/entityProperties.html | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index c01b2a6d10..5d220788e8 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -146,11 +146,10 @@ var elScriptURL = document.getElementById("property-script-url"); var elUserData = document.getElementById("property-user-data"); - var elBoxSections = document.querySelectorAll(".box-section"); - allSections.push(elBoxSections); - var elBoxColorRed = document.getElementById("property-box-red"); - var elBoxColorGreen = document.getElementById("property-box-green"); - var elBoxColorBlue = document.getElementById("property-box-blue"); + var elColorSection = document.getElementById("color-section"); + var elColorRed = document.getElementById("property-color-red"); + var elColorGreen = document.getElementById("property-color-green"); + var elColorBlue = document.getElementById("property-color-blue"); var elLightSections = document.querySelectorAll(".light-section"); allSections.push(elLightSections); @@ -310,16 +309,17 @@ allSections[i][j].style.display = 'none'; } } - - if (properties.type == "Box") { - for (var i = 0; i < elBoxSections.length; i++) { - elBoxSections[i].style.display = 'block'; - } - elBoxColorRed.value = properties.color.red; - elBoxColorGreen.value = properties.color.green; - elBoxColorBlue.value = properties.color.blue; - } else if (properties.type == "Model") { + if (properties.type == "Box" || properties.type == "Sphere") { + elColorSection.style.display = 'block'; + elColorRed.value = properties.color.red; + elColorGreen.value = properties.color.green; + elColorBlue.value = properties.color.blue; + } else { + elColorSection.style.display = 'none'; + } + + if (properties.type == "Model") { for (var i = 0; i < elModelSections.length; i++) { elModelSections[i].style.display = 'block'; } @@ -454,11 +454,11 @@ elScriptURL.addEventListener('change', createEmitTextPropertyUpdateFunction('script')); elUserData.addEventListener('change', createEmitTextPropertyUpdateFunction('userData')); - var boxColorChangeFunction = createEmitColorPropertyUpdateFunction( - 'color', elBoxColorRed, elBoxColorGreen, elBoxColorBlue); - elBoxColorRed.addEventListener('change', boxColorChangeFunction); - elBoxColorGreen.addEventListener('change', boxColorChangeFunction); - elBoxColorBlue.addEventListener('change', boxColorChangeFunction); + var colorChangeFunction = createEmitColorPropertyUpdateFunction( + 'color', elColorRed, elColorGreen, elColorBlue); + elColorRed.addEventListener('change', colorChangeFunction); + elColorGreen.addEventListener('change', colorChangeFunction); + elColorBlue.addEventListener('change', colorChangeFunction); elLightSpotLight.addEventListener('change', createEmitCheckedPropertyUpdateFunction('isSpotlight')); @@ -743,12 +743,12 @@ -
+
Color
-
R
-
G
-
B
+
R
+
G
+
B