aboutsummaryrefslogtreecommitdiff
path: root/js/panels/properties/content.reel/content.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-01 13:38:44 -0800
committerValerio Virgillito2012-03-01 13:38:44 -0800
commit0a500496236bedbdd9fbbcb3d841a195b3e5fc0f (patch)
tree0985abebdcf61dab85cfc97170a1c6339a5346eb /js/panels/properties/content.reel/content.js
parentb09956e4a9a35c5588cc7cd1f01efb617cbe0884 (diff)
downloadninja-0a500496236bedbdd9fbbcb3d841a195b3e5fc0f.tar.gz
stage and elements fixes
- Resizing the iframe container when resizing the stage - Removing 3d rules from elements when adding them - Adding a name property in the pi Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/panels/properties/content.reel/content.js')
-rwxr-xr-xjs/panels/properties/content.reel/content.js31
1 files changed, 26 insertions, 5 deletions
diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js
index 72c02ffd..d4b0edc4 100755
--- a/js/panels/properties/content.reel/content.js
+++ b/js/panels/properties/content.reel/content.js
@@ -25,6 +25,10 @@ exports.Content = Montage.create(Component, {
25 value: null 25 value: null
26 }, 26 },
27 27
28 nameAttribute: {
29 value: null
30 },
31
28 customSections: { 32 customSections: {
29 value: [] 33 value: []
30 }, 34 },
@@ -72,6 +76,9 @@ exports.Content = Montage.create(Component, {
72 76
73 this.elementId.element.addEventListener("blur", this, false); 77 this.elementId.element.addEventListener("blur", this, false);
74 this.elementId.element.addEventListener("keyup", this, false); 78 this.elementId.element.addEventListener("keyup", this, false);
79
80 this.elementNameAttribute.element.addEventListener("blur", this, false);
81 this.elementNameAttribute.element.addEventListener("keyup", this, false);
75 } 82 }
76 }, 83 },
77 84
@@ -95,10 +102,18 @@ exports.Content = Montage.create(Component, {
95 */ 102 */
96 handleBlur: { 103 handleBlur: {
97 value: function(event) { 104 value: function(event) {
98 if(this.application.ninja.selectedElements.length) { 105 console.log(event.target);
99 ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, "Change", "pi"); 106 if(event.target.id === "elementID") {
100 } else { 107 if(this.application.ninja.selectedElements.length) {
101 ElementsMediator.setAttribute(this.application.ninja.currentDocument.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.documentRoot.elementModel.id); 108 ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, "Change", "pi");
109 } else {
110 ElementsMediator.setAttribute(this.application.ninja.currentDocument.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.documentRoot.elementModel.id);
111 }
112 } else if(event.target.id === "elementNameAttribute") {
113 if(this.application.ninja.selectedElements.length) {
114 //ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "name", this.elementNameAttribute.value, "Change", "pi");
115 this.application.ninja.selectedElements[0]._element.setAttribute("name", this.elementNameAttribute.value);
116 }
102 } 117 }
103 } 118 }
104 }, 119 },
@@ -106,7 +121,11 @@ exports.Content = Montage.create(Component, {
106 handleKeyup: { 121 handleKeyup: {
107 value: function(event) { 122 value: function(event) {
108 if(event.keyCode === 13) { 123 if(event.keyCode === 13) {
109 this.elementId.element.blur(); 124 if(event.target === "elementID") {
125 this.elementId.element.blur();
126 } else if(event.target === "elementNameAttribute") {
127 this.elementNameAttribute.element.blur();
128 }
110 } 129 }
111 } 130 }
112 }, 131 },
@@ -164,6 +183,7 @@ exports.Content = Montage.create(Component, {
164 this.elementName = "Stage"; 183 this.elementName = "Stage";
165 this.elementId.value = stage.elementModel.id; 184 this.elementId.value = stage.elementModel.id;
166 this.elementClassName = ""; 185 this.elementClassName = "";
186 this.nameAttribute = "";
167 187
168 this.positionSize.disablePosition = true; 188 this.positionSize.disablePosition = true;
169 this.threeD.disableTranslation = true; 189 this.threeD.disableTranslation = true;
@@ -226,6 +246,7 @@ exports.Content = Montage.create(Component, {
226 this.elementName = el.elementModel.selection; 246 this.elementName = el.elementModel.selection;
227 this.elementId.value = el.getAttribute("id") || ""; 247 this.elementId.value = el.getAttribute("id") || "";
228 this.elementClassName = el.getAttribute("class"); 248 this.elementClassName = el.getAttribute("class");
249 this.nameAttribute = el.getAttribute("name") || "";
229 250
230 this.positionSize.disablePosition = false; 251 this.positionSize.disablePosition = false;
231 this.threeD.disableTranslation = false; 252 this.threeD.disableTranslation = false;