Merge pull request #4743 from huffman/sphere-color

Add support for changing sphere color in edit.js
This commit is contained in:
Seth Alves 2015-05-01 13:17:46 -07:00
commit 5390630497

View file

@ -147,11 +147,10 @@
var elScriptURL = document.getElementById("property-script-url"); var elScriptURL = document.getElementById("property-script-url");
var elUserData = document.getElementById("property-user-data"); var elUserData = document.getElementById("property-user-data");
var elBoxSections = document.querySelectorAll(".box-section"); var elColorSection = document.getElementById("color-section");
allSections.push(elBoxSections); var elColorRed = document.getElementById("property-color-red");
var elBoxColorRed = document.getElementById("property-box-red"); var elColorGreen = document.getElementById("property-color-green");
var elBoxColorGreen = document.getElementById("property-box-green"); var elColorBlue = document.getElementById("property-color-blue");
var elBoxColorBlue = document.getElementById("property-box-blue");
var elLightSections = document.querySelectorAll(".light-section"); var elLightSections = document.querySelectorAll(".light-section");
allSections.push(elLightSections); allSections.push(elLightSections);
@ -314,15 +313,16 @@
} }
} }
if (properties.type == "Box") { if (properties.type == "Box" || properties.type == "Sphere") {
for (var i = 0; i < elBoxSections.length; i++) { elColorSection.style.display = 'block';
elBoxSections[i].style.display = 'block'; elColorRed.value = properties.color.red;
} elColorGreen.value = properties.color.green;
elColorBlue.value = properties.color.blue;
} else {
elColorSection.style.display = 'none';
}
elBoxColorRed.value = properties.color.red; if (properties.type == "Model") {
elBoxColorGreen.value = properties.color.green;
elBoxColorBlue.value = properties.color.blue;
} else if (properties.type == "Model") {
for (var i = 0; i < elModelSections.length; i++) { for (var i = 0; i < elModelSections.length; i++) {
elModelSections[i].style.display = 'block'; elModelSections[i].style.display = 'block';
} }
@ -458,11 +458,11 @@
elScriptURL.addEventListener('change', createEmitTextPropertyUpdateFunction('script')); elScriptURL.addEventListener('change', createEmitTextPropertyUpdateFunction('script'));
elUserData.addEventListener('change', createEmitTextPropertyUpdateFunction('userData')); elUserData.addEventListener('change', createEmitTextPropertyUpdateFunction('userData'));
var boxColorChangeFunction = createEmitColorPropertyUpdateFunction( var colorChangeFunction = createEmitColorPropertyUpdateFunction(
'color', elBoxColorRed, elBoxColorGreen, elBoxColorBlue); 'color', elColorRed, elColorGreen, elColorBlue);
elBoxColorRed.addEventListener('change', boxColorChangeFunction); elColorRed.addEventListener('change', colorChangeFunction);
elBoxColorGreen.addEventListener('change', boxColorChangeFunction); elColorGreen.addEventListener('change', colorChangeFunction);
elBoxColorBlue.addEventListener('change', boxColorChangeFunction); elColorBlue.addEventListener('change', colorChangeFunction);
elLightSpotLight.addEventListener('change', createEmitCheckedPropertyUpdateFunction('isSpotlight')); elLightSpotLight.addEventListener('change', createEmitCheckedPropertyUpdateFunction('isSpotlight'));
@ -753,12 +753,12 @@
</div> </div>
<div class="box-section property"> <div id="color-section" class="property">
<div class="label">Color</div> <div class="label">Color</div>
<div class="value"> <div class="value">
<div class="input-area">R <input class="coord" type='number' id="property-box-red"></input></div> <div class="input-area">R <input class="coord" type='number' id="property-color-red"></input></div>
<div class="input-area">G <input class="coord" type='number' id="property-box-green"></input></div> <div class="input-area">G <input class="coord" type='number' id="property-color-green"></input></div>
<div class="input-area">B <input class="coord" type='number' id="property-box-blue"></input></div> <div class="input-area">B <input class="coord" type='number' id="property-color-blue"></input></div>
</div> </div>
</div> </div>