From 19cd3ec15290ee39c003b1dfa15367e76330e0f1 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 17 Feb 2016 13:12:17 -0800 Subject: [PATCH] checkboxes working --- examples/edit.js | 1 - examples/html/entityProperties.html | 118 ++++++++++++++-------------- examples/html/style.css | 4 + 3 files changed, 62 insertions(+), 61 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index e89ad24a9c..6d170ab254 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -1542,7 +1542,6 @@ PropertiesTool = function(opts) { print(data.message); } } else if (data.type == "update") { - print("EBL WE GOT AN UPDATE! " + JSON.stringify(data)) selectionManager.saveProperties(); if (selectionManager.selections.length > 1) { properties = { diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index 502daa18fa..71c7aa0449 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -218,6 +218,28 @@ } }; + function updateCheckedSubProperty(propertyName, propertyValue, subPropertyElement, subPropertyString) { + if (subPropertyElement.checked) { + if (propertyValue.indexOf(subPropertyString)) { + propertyValue += subPropertyString + ','; + } + } else { + // We've unchecked, so remove + propertyValue = propertyValue.replace(subPropertyString + ",", ""); + } + + var _properties ={} + _properties[propertyName] = propertyValue; + + EventBridge.emitWebEvent( + JSON.stringify({ + type: "update", + properties: _properties + }) + ); + + } + function loaded() { openEventBridge(function() { var allSections = []; @@ -501,7 +523,6 @@ elDynamic.checked = properties.dynamic; - console.log('STARTCHECK', properties.collidesWith) elCollideStatic.checked = properties.collidesWith.indexOf("static") > -1; elCollideKinematic.checked = properties.collidesWith.indexOf("kinematic") > -1; elCollideDynamic.checked = properties.collidesWith.indexOf("dynamic") > -1; @@ -732,31 +753,9 @@ elDynamic.addEventListener('change', createEmitCheckedPropertyUpdateFunction('dynamic')); - function updateCheckedSubProperty(propertyName, propertyValue, subPropertyElement, subPropertyString) { - console.log("UPDATE CHECKED PROP") - if (subPropertyElement.checked) { - if (propertyValue.indexOf(subPropertyString)) { - propertyValue += subPropertyString + ','; - } - } else { - // We've unchecked, so remove - propertyValue = propertyValue.replace(subPropertyString + ",", ""); - } - var _properties ={} - _properties[propertyName] = propertyValue; - - EventBridge.emitWebEvent( - JSON.stringify({ - type: "update", - properties: _properties - }) - ); - - } elCollideDynamic.addEventListener('change', function() { - console.log("CHANGE!") updateCheckedSubProperty("collidesWith", properties.collidesWith, elCollideDynamic, 'dynamic'); }); @@ -1459,46 +1458,45 @@ -
-
collidesWith
+ +
Collides With:
+
+
+ Static + + + +
-
- Static - - - +
+ dynamic + + + +
+ +
+ kinematic + + + +
+ +
+ myAvatar + + + +
+ +
+ otherAvatar + + + +
-
- dynamic - - - -
- -
- kinematic - - - -
- -
- myAvatar - - - -
- -
- otherAvatar - - - -
- - -
diff --git a/examples/html/style.css b/examples/html/style.css index 5b794cbfec..83982dab15 100644 --- a/examples/html/style.css +++ b/examples/html/style.css @@ -263,6 +263,10 @@ table#properties-list { border-bottom: 0.75pt solid #e5e5e5; } +.sub-props-checkbox-group { + margin-left: 20px; +} + #properties-list .label { font-weight: bold; overflow: hidden;