From 0edb763dac65201583e5e2c3e6688eddea35f0f1 Mon Sep 17 00:00:00 2001 From: Menithal Date: Tue, 13 Jun 2017 19:04:43 +0300 Subject: [PATCH] 21324: Formatting and PR Feedback Changes --- .../particle_explorer/hifi-entity-ui.js | 325 +++++++++--------- .../particle_explorer/particleExplorer.js | 175 +++++++--- 2 files changed, 288 insertions(+), 212 deletions(-) diff --git a/scripts/system/particle_explorer/hifi-entity-ui.js b/scripts/system/particle_explorer/hifi-entity-ui.js index 66f8e74b1c..7f3beb3b77 100644 --- a/scripts/system/particle_explorer/hifi-entity-ui.js +++ b/scripts/system/particle_explorer/hifi-entity-ui.js @@ -43,18 +43,24 @@ and If there is any changes to either the Entities or properties of **/ -var RADIAN = Math.PI / 180; +var RADIANS_PER_DEGREE = Math.PI / 180; var roundFloat = function (input, round) { - round = round ? round: 1000; - return Math.round(parseFloat(input) * round)/round; + round = round ? round : 1000; + var sanitizedInput; + if (typeof input === "string") { + sanitizedInput = parseFloat(input); + } else { + sanitizedInput = input; + } + return Math.round(sanitizedInput * round) / round; }; function HifiEntityUI(parent) { this.parent = parent; var self = this; - this.webBridgeSync = _.debounce(function(id, val) { + this.webBridgeSync = _.debounce(function (id, val) { if (self.EventBridge) { var sendPackage = {}; sendPackage[id] = val; @@ -64,7 +70,7 @@ function HifiEntityUI(parent) { } HifiEntityUI.prototype = { - setOnSelect: function (callback){ + setOnSelect: function (callback) { this.onSelect = callback; }, submitChanges: function (structure) { @@ -77,7 +83,7 @@ HifiEntityUI.prototype = { setUI: function (structure) { this.structure = structure; }, - disableFields: function() { + disableFields: function () { var fields = document.getElementsByTagName("input"); for (var i = 0; i < fields.length; i++) { if (fields[i].getAttribute("type") !== "button") { @@ -93,7 +99,8 @@ HifiEntityUI.prototype = { textures = document.getElementsByClassName("with-texture"); for (i = 0; i < textures.length; i++) { - textures[i].className = textures[i].className.replace("with-texture", "no-texture"); + textures[i].classList.remove("with-textures"); + textures[i].classList.add("no-texture"); } var textareas = document.getElementsByTagName("textarea"); @@ -101,7 +108,7 @@ HifiEntityUI.prototype = { textareas[x].remove(); } }, - getSettings: function() { + getSettings: function () { var self = this; var json = {}; var keys = Object.keys(self.builtRows); @@ -110,7 +117,8 @@ HifiEntityUI.prototype = { var key = keys[i]; var el = self.builtRows[key]; if (el.className.indexOf("checkbox") !== -1) { - json[key] = document.getElementById(key).checked ? true: false; + json[key] = document.getElementById(key) + .checked ? true : false; } else if (el.className.indexOf("vector-section") !== -1) { var vector = {}; if (el.className.indexOf("rgb") !== -1) { @@ -136,14 +144,15 @@ HifiEntityUI.prototype = { vector.z = z.value; } json[key] = vector; - } else if (el.className.length > 0){ - json[key] = document.getElementById(key).value; + } else if (el.className.length > 0) { + json[key] = document.getElementById(key) + .value; } } return json; }, - fillFields: function(currentProperties) { + fillFields: function (currentProperties) { var self = this; var fields = document.getElementsByTagName("input"); @@ -159,64 +168,66 @@ HifiEntityUI.prototype = { for (var e in keys) { - var value = keys[e]; + if (keys.hasOwnProperty[e]) { + var value = keys[e]; - var property = currentProperties[value]; - var field = self.builtRows[value]; - if (field) { - var el = document.getElementById(value); + var property = currentProperties[value]; + var field = self.builtRows[value]; + if (field) { + var el = document.getElementById(value); - if (field.className.indexOf("radian") !== -1) { - el.value = property / RADIAN; - el.onchange({ - target: el - }); - } else if (field.className.indexOf("range") !== -1 || field.className.indexOf("texture") !== -1) { - el.value = property; - el.onchange({ - target: el - }); - } else if (field.className.indexOf("checkbox") !== -1) { - if (property) { - el.setAttribute("checked", property); - } else { - el.removeAttribute("checked"); - } - } else if (field.className.indexOf("vector-section") !== -1) { - if (field.className.indexOf("rgb") !== -1) { - var red = document.getElementById(value + "-red"); - var blue = document.getElementById(value + "-blue"); - var green = document.getElementById(value + "-green"); - red.value = parseInt(property.red); - blue.value = parseInt(property.blue); - green.value = parseInt(property.green); - - red.oninput({ - target: red + if (field.className.indexOf("radian") !== -1) { + el.value = property / RADIANS_PER_DEGREE; + el.onchange({ + target: el }); - } else if (field.className.indexOf("xyz") !== -1) { - var x = document.getElementById(value + "-x"); - var y = document.getElementById(value + "-y"); - var z = document.getElementById(value + "-z"); + } else if (field.className.indexOf("range") !== -1 || field.className.indexOf("texture") !== -1) { + el.value = property; + el.onchange({ + target: el + }); + } else if (field.className.indexOf("checkbox") !== -1) { + if (property) { + el.setAttribute("checked", property); + } else { + el.removeAttribute("checked"); + } + } else if (field.className.indexOf("vector-section") !== -1) { + if (field.className.indexOf("rgb") !== -1) { + var red = document.getElementById(value + "-red"); + var blue = document.getElementById(value + "-blue"); + var green = document.getElementById(value + "-green"); + red.value = parseInt(property.red); + blue.value = parseInt(property.blue); + green.value = parseInt(property.green); - x.value = roundFloat(property.x, 100); - y.value = roundFloat(property.y, 100); - z.value = roundFloat(property.z, 100); - } else if (field.className.indexOf("pyr") !== -1) { - var pitch = document.getElementById(value + "-Pitch"); - var yaw = document.getElementById(value + "-Yaw"); - var roll = document.getElementById(value + "-Roll"); + red.oninput({ + target: red + }); + } else if (field.className.indexOf("xyz") !== -1) { + var x = document.getElementById(value + "-x"); + var y = document.getElementById(value + "-y"); + var z = document.getElementById(value + "-z"); - pitch.value = roundFloat(property.x, 100); - yaw.value = roundFloat(property.y, 100); - roll.value = roundFloat(property.z, 100); + x.value = roundFloat(property.x, 100); + y.value = roundFloat(property.y, 100); + z.value = roundFloat(property.z, 100); + } else if (field.className.indexOf("pyr") !== -1) { + var pitch = document.getElementById(value + "-Pitch"); + var yaw = document.getElementById(value + "-Yaw"); + var roll = document.getElementById(value + "-Roll"); + pitch.value = roundFloat(property.x, 100); + yaw.value = roundFloat(property.y, 100); + roll.value = roundFloat(property.z, 100); + + } } } } } }, - connect: function(EventBridge) { + connect: function (EventBridge) { this.EventBridge = EventBridge; var self = this; @@ -225,7 +236,7 @@ HifiEntityUI.prototype = { messageType: 'page_loaded' })); - EventBridge.scriptEventReceived.connect(function(data) { + EventBridge.scriptEventReceived.connect(function (data) { data = JSON.parse(data); if (data.messageType === 'particle_settings') { @@ -238,16 +249,16 @@ HifiEntityUI.prototype = { } }); }, - build: function() { + build: function () { var self = this; var sections = Object.keys(this.structure); this.builtRows = {}; - sections.forEach(function(section, index) { + sections.forEach(function (section, index) { var properties = self.structure[section]; self.addSection(self.parent, section, properties, index); }); }, - addSection: function(parent, section, properties, index) { + addSection: function (parent, section, properties, index) { var self = this; var sectionDivHeader = document.createElement("div"); @@ -272,37 +283,33 @@ HifiEntityUI.prototype = { animationWrapper.className = "section-wrap"; for (var property in properties) { - - var builtRow = self.addElement(animationWrapper, properties[property]); - var id = properties[property].id; - if (id) { - self.builtRows[id] = builtRow; + if (properties.hasOwnProperty[property]) { + var builtRow = self.addElement(animationWrapper, properties[property]); + var id = properties[property].id; + if (id) { + self.builtRows[id] = builtRow; + } } } sectionDivBody.appendChild(animationWrapper); parent.appendChild(sectionDivBody); - _.defer(function() { + _.defer(function () { var height = (animationWrapper.clientHeight) + "px"; if (collapsed) { - sectionDivBody.className = sectionDivBody.className - .replace("visible", "") - .replace(/\s{2,}/g, " "); - + sectionDivBody.classList.remove("visible"); sectionDivBody.style.maxHeight = "0px"; } else { - sectionDivBody.className += " visible"; + sectionDivBody.classList.add("visible"); sectionDivBody.style.maxHeight = height; } - sectionDivHeader.onclick = function() { + sectionDivHeader.onclick = function () { collapsed = !collapsed; if (collapsed) { - sectionDivBody.className = sectionDivBody.className - .replace("visible", "") - .replace(/\s{2,}/g, " "); + sectionDivBody.classList.remove("visible"); sectionDivBody.style.maxHeight = "0px"; } else { - sectionDivBody.className += " visible"; + sectionDivBody.classList.add("visible"); sectionDivBody.style.maxHeight = (animationWrapper.clientHeight) + "px"; } // sectionDivBody.style.display = collapsed ? "none": "block"; @@ -311,7 +318,7 @@ HifiEntityUI.prototype = { }; }); }, - addLabel: function(parent, group) { + addLabel: function (parent, group) { var label = document.createElement("label"); label.innerHTML = group.name; parent.appendChild(label); @@ -323,10 +330,10 @@ HifiEntityUI.prototype = { } return label; }, - addVector: function(parent, group, labels, domArray) { + addVector: function (parent, group, labels, domArray) { var self = this; var inputs = labels ? labels : ["x", "y", "z"]; - domArray = domArray ? domArray: []; + domArray = domArray ? domArray : []; parent.id = group.id; for (var index in inputs) { var element = document.createElement("input"); @@ -349,7 +356,7 @@ HifiEntityUI.prototype = { if (group.oninput) { element.oninput = group.oninput; } else { - element.oninput = function(event) { + element.oninput = function (event) { self.webBridgeSync(group.id, { x: domArray[0].value, y: domArray[1].value, @@ -364,7 +371,8 @@ HifiEntityUI.prototype = { this.addLabel(parent, group); var className = ""; for (var i = 0; i < inputs.length; i++) { - className += inputs[i].charAt(0).toLowerCase(); + className += inputs[i].charAt(0) + .toLowerCase(); } parent.className += " property vector-section " + className; @@ -383,16 +391,16 @@ HifiEntityUI.prototype = { } parent.appendChild(tupleContainer); }, - addVectorQuaternion: function(parent, group) { + addVectorQuaternion: function (parent, group) { this.addVector(parent, group, ["Pitch", "Yaw", "Roll"]); }, - addColorPicker: function(parent, group) { + addColorPicker: function (parent, group) { var self = this; var $colPickContainer = $('
', { id: group.id, class: "color-picker" }); - var updateColors = function(red, green, blue) { + var updateColors = function (red, green, blue) { $colPickContainer.css('background-color', "rgb(" + red + "," + green + "," + @@ -401,7 +409,7 @@ HifiEntityUI.prototype = { var inputs = ["red", "green", "blue"]; var domArray = []; - group.oninput = function(event) { + group.oninput = function (event) { $colPickContainer.colpickSetColor( { r: domArray[0].value, @@ -435,7 +443,7 @@ HifiEntityUI.prototype = { g: domArray[1].value, b: domArray[2].value }, - onChange: function(hsb, hex, rgb, el) { + onChange: function (hsb, hex, rgb, el) { updateColors(rgb.r, rgb.g, rgb.b); domArray[0].value = rgb.r; @@ -447,9 +455,11 @@ HifiEntityUI.prototype = { blue: rgb.b }); }, - onSubmit: function(hsb, hex, rgb, el) { - $(el).css('background-color', '#' + hex); - $(el).colpickHide(); + onSubmit: function (hsb, hex, rgb, el) { + $(el) + .css('background-color', '#' + hex); + $(el) + .colpickHide(); domArray[0].value = rgb.r; domArray[1].value = rgb.g; domArray[2].value = rgb.b; @@ -461,7 +471,7 @@ HifiEntityUI.prototype = { } }); }, - addTextureField: function(parent, group) { + addTextureField: function (parent, group) { var self = this; this.addLabel(parent, group); parent.className += " property texture"; @@ -471,20 +481,21 @@ HifiEntityUI.prototype = { textureUrl.id = group.id; textureImage.className = "texture-image no-texture"; var image = document.createElement("img"); - var imageLoad = _.debounce(function(url) { + var imageLoad = _.debounce(function (url) { if (url.length > 0) { - textureImage.className = textureImage.className.replace(' no-texture', ' with-texture'); + textureImage.classList.remove("no-texture"); + textureImage.classList.add("with-texture"); image.src = url; image.style.display = "block"; } else { image.src = ""; image.style.display = "none"; - textureImage.className += " no-texture"; + textureImage.classList.add("no-texture"); } self.webBridgeSync(group.id, url); }, 250); - textureUrl.oninput = function(event) { + textureUrl.oninput = function (event) { // Add throttle var url = event.target.value; imageLoad(url); @@ -494,7 +505,7 @@ HifiEntityUI.prototype = { parent.appendChild(textureImage); parent.appendChild(textureUrl); }, - addSlider: function(parent, group) { + addSlider: function (parent, group) { var self = this; this.addLabel(parent, group); parent.className += " property range"; @@ -518,7 +529,7 @@ HifiEntityUI.prototype = { slider.setAttribute("max", group.max !== undefined ? group.max : 10000); slider.setAttribute("step", 1); - inputField.oninput = function(event) { + inputField.oninput = function (event) { if (parseInt(event.target.value) > parseInt(slider.getAttribute("max")) && group.max !== 1) { slider.setAttribute("max", event.target.value); @@ -528,7 +539,7 @@ HifiEntityUI.prototype = { self.webBridgeSync(group.id, slider.value); }; inputField.onchange = inputField.oninput; - slider.oninput = function(event) { + slider.oninput = function (event) { inputField.value = event.target.value; self.webBridgeSync(group.id, slider.value); }; @@ -542,20 +553,20 @@ HifiEntityUI.prototype = { inputField.setAttribute("min", (group.min !== undefined ? group.min : 0)); inputField.setAttribute("max", (group.max !== undefined ? group.max : 180)); - inputField.oninput = function(event) { + inputField.oninput = function (event) { slider.value = event.target.value; - self.webBridgeSync(group.id, slider.value * RADIAN); + self.webBridgeSync(group.id, slider.value * RADIANS_PER_DEGREE); }; inputField.onchange = inputField.oninput; inputField.id = group.id; - slider.oninput = function(event) { + slider.oninput = function (event) { if (event.target.value > 0) { inputField.value = Math.floor(event.target.value); } else { inputField.value = Math.ceil(event.target.value); } - self.webBridgeSync(group.id, slider.value * RADIAN); + self.webBridgeSync(group.id, slider.value * RADIANS_PER_DEGREE); }; var degrees = document.createElement("label"); degrees.innerHTML = "°"; @@ -574,7 +585,7 @@ HifiEntityUI.prototype = { slider.setAttribute("max", group.max !== undefined ? group.max : 1); slider.setAttribute("step", 0.01); - inputField.oninput = function(event) { + inputField.oninput = function (event) { if (parseFloat(event.target.value) > parseFloat(slider.getAttribute("max")) && group.max !== 1) { slider.setAttribute("max", event.target.value); } @@ -584,7 +595,7 @@ HifiEntityUI.prototype = { // bind web sock update here. }; inputField.onchange = inputField.oninput; - slider.oninput = function(event) { + slider.oninput = function (event) { inputField.value = event.target.value; self.webBridgeSync(group.id, inputField.value); }; @@ -594,11 +605,11 @@ HifiEntityUI.prototype = { // UpdateBinding }, - addCheckBox: function(parent, group) { + addCheckBox: function (parent, group) { var checkBox = document.createElement("input"); checkBox.setAttribute("type", "checkbox"); var self = this; - checkBox.onchange = function(event) { + checkBox.onchange = function (event) { self.webBridgeSync(group.id, event.target.checked); }; checkBox.id = group.id; @@ -607,62 +618,62 @@ HifiEntityUI.prototype = { label.setAttribute("for", checkBox.id); parent.className += " property checkbox"; }, - addElement: function(parent, group) { + addElement: function (parent, group) { var self = this; var property = document.createElement("div"); property.id = group.id; var row = document.createElement("div"); switch (group.type) { - case "Button": - var button = document.createElement("input"); - button.setAttribute("type", "button"); - button.id = group.id; - if (group.disabled) { - button.disabled = group.disabled; - } - button.className = group.class; - button.value = group.name; + case "Button": + var button = document.createElement("input"); + button.setAttribute("type", "button"); + button.id = group.id; + if (group.disabled) { + button.disabled = group.disabled; + } + button.className = group.class; + button.value = group.name; - button.onclick = group.callback; - parent.appendChild(button); - break; - case "Row": - var hr = document.createElement("hr"); - hr.className = "splitter"; - if (group.id) { - hr.id = group.id; - } - parent.appendChild(hr); - break; - case "Boolean": - self.addCheckBox(row, group); - parent.appendChild(row); - break; - case "SliderFloat": - case "SliderInteger": - case "SliderRadian": - self.addSlider(row, group); - parent.appendChild(row); - break; - case "Texture": - self.addTextureField(row, group); - parent.appendChild(row); - break; - case "Color": - self.addColorPicker(row, group); - parent.appendChild(row); - break; - case "Vector": - self.addVector(row, group); - parent.appendChild(row); - break; - case "VectorQuaternion": - self.addVectorQuaternion(row, group); - parent.appendChild(row); - break; - default: - console.log("not defined"); + button.onclick = group.callback; + parent.appendChild(button); + break; + case "Row": + var hr = document.createElement("hr"); + hr.className = "splitter"; + if (group.id) { + hr.id = group.id; + } + parent.appendChild(hr); + break; + case "Boolean": + self.addCheckBox(row, group); + parent.appendChild(row); + break; + case "SliderFloat": + case "SliderInteger": + case "SliderRadian": + self.addSlider(row, group); + parent.appendChild(row); + break; + case "Texture": + self.addTextureField(row, group); + parent.appendChild(row); + break; + case "Color": + self.addColorPicker(row, group); + parent.appendChild(row); + break; + case "Vector": + self.addVector(row, group); + parent.appendChild(row); + break; + case "VectorQuaternion": + self.addVectorQuaternion(row, group); + parent.appendChild(row); + break; + default: + console.log("not defined"); } return row; } diff --git a/scripts/system/particle_explorer/particleExplorer.js b/scripts/system/particle_explorer/particleExplorer.js index 82c74da0f5..17d8269634 100644 --- a/scripts/system/particle_explorer/particleExplorer.js +++ b/scripts/system/particle_explorer/particleExplorer.js @@ -15,24 +15,27 @@ /* global HifiEntityUI, openEventBridge, console, EventBridge, document, window */ /* eslint no-console: 0, no-global-assign: 0 */ -(function(){ +(function () { var root = document.getElementById("particle-explorer"); - window.onload = function(){ + window.onload = function () { var ui = new HifiEntityUI(root); var textarea = document.createElement("textarea"); var properties = ""; var menuStructure = { General: [ - { type: "Row", id: "export-import-field" }, + { + type: "Row", + id: "export-import-field" + }, { id: "show-properties-button", name: "Show Properties", type: "Button", class: "blue", disabled: true, - callback: function(event){ + callback: function (event) { var insertZone = document.getElementById("export-import-field"); var json = ui.getSettings(); properties = JSON.stringify(json); @@ -41,22 +44,26 @@ insertZone.appendChild(textarea); insertZone.parentNode.parentNode.style.maxHeight = insertZone.parentNode.clientHeight + "px"; - document.getElementById("export-properties-button").removeAttribute("disabled"); - textarea.onchange = function(e) { - if (e.target.value !== properties){ - document.getElementById("import-properties-button").removeAttribute("disabled"); + document.getElementById("export-properties-button") + .removeAttribute("disabled"); + textarea.onchange = function (e) { + if (e.target.value !== properties) { + document.getElementById("import-properties-button") + .removeAttribute("disabled"); } }; textarea.oninput = textarea.onchange; } else { - textarea.onchange = function(){}; + textarea.onchange = function () {}; textarea.oninput = textarea.onchange; textarea.value = ""; textarea.remove(); insertZone.parentNode.parentNode.style.maxHeight = - insertZone.parentNode.clientHeight + "px"; - document.getElementById("export-properties-button").setAttribute("disabled",true); - document.getElementById("import-properties-button").setAttribute("disabled",true); + insertZone.parentNode.clientHeight + "px"; + document.getElementById("export-properties-button") + .setAttribute("disabled", true); + document.getElementById("import-properties-button") + .setAttribute("disabled", true); } } }, @@ -66,7 +73,7 @@ type: "Button", class: "blue", disabled: true, - callback: function(event){ + callback: function (event) { ui.fillFields(JSON.parse(textarea.value)); ui.submitChanges(JSON.parse(textarea.value)); } @@ -77,11 +84,11 @@ type: "Button", class: "red", disabled: true, - callback: function(event){ + callback: function (event) { textarea.select(); try { var success = document.execCommand('copy'); - if (!success ){ + if (!success) { throw "Not success :("; } } catch (e) { @@ -89,13 +96,17 @@ } } }, - { type: "Row"}, + { + type: "Row" + }, { id: "isEmitting", name: "Is Emitting", type: "Boolean" }, - { type: "Row" }, + { + type: "Row" + }, { id: "lifespan", name: "Lifespan", @@ -103,7 +114,9 @@ min: 0.01, max: 10 }, - { type: "Row" }, + { + type: "Row" + }, { id: "maxParticles", name: "Max Particles", @@ -111,13 +124,17 @@ min: 1, max: 10000 }, - { type: "Row" }, + { + type: "Row" + }, { id: "textures", name: "Textures", type: "Texture" }, - { type: "Row" } + { + type: "Row" + } ], Emit: [ { @@ -127,14 +144,18 @@ max: 1000, min: 1 }, - { type: "Row" }, + { + type: "Row" + }, { id: "emitSpeed", name: "Emit Speed", type: "SliderFloat", max: 5 }, - { type: "Row" }, + { + type: "Row" + }, { id: "emitDimensions", name: "Emit Dimension", @@ -144,7 +165,9 @@ step: 0.01 } }, - { type: "Row" }, + { + type: "Row" + }, { id: "emitOrientation", unit: "deg", @@ -155,13 +178,17 @@ step: 0.01 } }, - { type: "Row" }, + { + type: "Row" + }, { id: "emitShouldTrail", name: "Emit Should Trail", type: "Boolean" }, - { type: "Row" } + { + type: "Row" + } ], Radius: [ { @@ -170,28 +197,36 @@ type: "SliderFloat", max: 4.0 }, - { type: "Row" }, + { + type: "Row" + }, { id: "radiusSpread", name: "Radius Spread", type: "SliderFloat", max: 4.0 }, - { type: "Row" }, + { + type: "Row" + }, { id: "radiusStart", name: "Radius Start", type: "SliderFloat", max: 4.0 }, - { type: "Row" }, + { + type: "Row" + }, { id: "radiusFinish", name: "Radius Finish", type: "SliderFloat", max: 4.0 }, - { type: "Row" } + { + type: "Row" + } ], Color: [ { @@ -204,7 +239,9 @@ blue: 255 } }, - { type: "Row" }, + { + type: "Row" + }, { id: "colorSpread", name: "Color Spread", @@ -215,7 +252,9 @@ blue: 0 } }, - { type: "Row" }, + { + type: "Row" + }, { id: "colorStart", name: "Color Start", @@ -226,7 +265,9 @@ blue: 255 } }, - { type: "Row" }, + { + type: "Row" + }, { id: "colorFinish", name: "Color Finish", @@ -237,7 +278,9 @@ blue: 255 } }, - { type: "Row" } + { + type: "Row" + } ], Acceleration: [ { @@ -248,7 +291,9 @@ step: 0.01 } }, - { type: "Row" }, + { + type: "Row" + }, { id: "accelerationSpread", name: "Acceleration Spread", @@ -257,7 +302,9 @@ step: 0.01 } }, - { type: "Row" } + { + type: "Row" + } ], Alpha: [ { @@ -265,25 +312,33 @@ name: "Alpha", type: "SliderFloat" }, - { type: "Row" }, + { + type: "Row" + }, { id: "alphaSpread", name: "Alpha Spread", type: "SliderFloat" }, - { type: "Row" }, + { + type: "Row" + }, { id: "alphaStart", name: "Alpha Start", type: "SliderFloat" }, - { type: "Row" }, + { + type: "Row" + }, { id: "alphaFinish", name: "Alpha Finish", type: "SliderFloat" }, - { type: "Row" } + { + type: "Row" + } ], Polar: [ { @@ -292,14 +347,18 @@ unit: "deg", type: "SliderRadian" }, - { type: "Row" }, + { + type: "Row" + }, { id: "polarFinish", name: "Polar Finish", unit: "deg", type: "SliderRadian" }, - { type: "Row" } + { + type: "Row" + } ], Azimuth: [ { @@ -310,40 +369,46 @@ min: -180, max: 0 }, - { type: "Row" }, + { + type: "Row" + }, { id: "azimuthFinish", name: "Azimuth Finish", unit: "deg", type: "SliderRadian" }, - { type: "Row" } + { + type: "Row" + } ] }; ui.setUI(menuStructure); - ui.setOnSelect(function(){ - document.getElementById("show-properties-button").removeAttribute("disabled"); - document.getElementById("export-properties-button").setAttribute("disabled",true); - document.getElementById("import-properties-button").setAttribute("disabled",true); + ui.setOnSelect(function () { + document.getElementById("show-properties-button") + .removeAttribute("disabled"); + document.getElementById("export-properties-button") + .setAttribute("disabled", true); + document.getElementById("import-properties-button") + .setAttribute("disabled", true); }); ui.build(); var overrideLoad = false; if (openEventBridge === undefined) { overrideLoad = true, - openEventBridge = function(callback) { - callback( - { - emitWebEvent: function(){}, - submitChanges: function(){}, + openEventBridge = function (callback) { + callback({ + emitWebEvent: function () {}, + submitChanges: function () {}, scriptEventReceived: { - connect: function() { + connect: function () { } } }); - }; + }; } - openEventBridge( function(EventBridge) { + openEventBridge(function (EventBridge) { ui.connect(EventBridge); }); if (overrideLoad) {