aboutsummaryrefslogtreecommitdiff
path: root/js/panels/properties/content.reel/content.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/properties/content.reel/content.js')
-rwxr-xr-xjs/panels/properties/content.reel/content.js394
1 files changed, 0 insertions, 394 deletions
diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js
deleted file mode 100755
index 72c02ffd..00000000
--- a/js/panels/properties/content.reel/content.js
+++ /dev/null
@@ -1,394 +0,0 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component,
9 PiData = require("js/data/pi/pi-data").PiData,
10 CustomSection = require("js/panels/properties/sections/custom.reel").CustomSection;
11
12var ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
13
14exports.Content = Montage.create(Component, {
15
16 elementName: {
17 value: null
18 },
19
20 elementID: {
21 value: null
22 },
23
24 elementClassName: {
25 value: null
26 },
27
28 customSections: {
29 value: []
30 },
31
32 _customPi: {
33 value: null
34 },
35
36 customPi: {
37 get: function() {
38 return this._customPi;
39 },
40 set: function(value) {
41 if(this._customPi !== value) {
42 this._customPi = value;
43 }
44 }
45 },
46
47 prepareForDraw: {
48 value : function() {
49
50 this.eventManager.addEventListener("selectionChange", this, false);
51
52 // This will be a toggle option
53 if(this.application.ninja.appData.PILiveUpdate) {
54 this.eventManager.addEventListener( "elementChanging", this, false);
55 }
56
57 this.eventManager.addEventListener("openDocument", this, false);
58 this.eventManager.addEventListener("switchDocument", this, false);
59 }
60 },
61
62 // Document is opened - Display the current selection
63 handleOpenDocument: {
64 value: function() {
65
66 this.eventManager.addEventListener( "elementChange", this, false);
67
68 // For now always assume that the stage is selected by default
69 if(this.application.ninja.selectedElements.length === 0) {
70 this.displayStageProperties();
71 }
72
73 this.elementId.element.addEventListener("blur", this, false);
74 this.elementId.element.addEventListener("keyup", this, false);
75 }
76 },
77
78 handleSwitchDocument: {
79 value: function(){
80 // For now always assume that the stage is selected by default
81 if(this.application.ninja.selectedElements.length === 0) {
82 this.displayStageProperties();
83 }else {
84 if(this.application.ninja.selectedElements.length === 1) {
85 this.displayElementProperties(this.application.ninja.selectedElements[0]._element);
86 } else {
87 this.displayGroupProperties(this.application.ninja.selectedElements);
88 }
89 }
90 }
91 },
92
93 /**
94 * Blur and Key up to handle change in the Element ID field.
95 */
96 handleBlur: {
97 value: function(event) {
98 if(this.application.ninja.selectedElements.length) {
99 ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, "Change", "pi");
100 } else {
101 ElementsMediator.setAttribute(this.application.ninja.currentDocument.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.documentRoot.elementModel.id);
102 }
103 }
104 },
105
106 handleKeyup: {
107 value: function(event) {
108 if(event.keyCode === 13) {
109 this.elementId.element.blur();
110 }
111 }
112 },
113
114 handleElementChanging: {
115 value: function(event) {
116// this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "left"));
117// this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "top"));
118 }
119 },
120
121 handleElementChange: {
122 value: function(event) {
123// console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update
124 if(event.detail.source && event.detail.source !== "pi") {
125 // TODO - This should only update the properties that were changed.
126 var el = this.application.ninja.selectedElements[0]._element || this.application.ninja.selectedElements[0];
127 this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(el, "left"));
128 this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(el, "top"));
129 this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(el, "height"));
130 this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(el, "width"));
131
132 if(this.threeD.inGlobalMode)
133 {
134 this.threeD.x3D = ElementsMediator.get3DProperty(el, "x3D");
135 this.threeD.y3D = ElementsMediator.get3DProperty(el, "y3D");
136 this.threeD.z3D = ElementsMediator.get3DProperty(el, "z3D");
137 this.threeD.xAngle = ElementsMediator.get3DProperty(el, "xAngle");
138 this.threeD.yAngle = ElementsMediator.get3DProperty(el, "yAngle");
139 this.threeD.zAngle = ElementsMediator.get3DProperty(el, "zAngle");
140 }
141 }
142 }
143 },
144
145 handleSelectionChange: {
146 value: function(event) {
147 if(event.detail.isDocument) {
148 this.displayStageProperties();
149 } else {
150 if(this.application.ninja.selectedElements.length === 1) {
151 this.displayElementProperties(this.application.ninja.selectedElements[0]._element);
152 } else {
153 this.displayGroupProperties(this.application.ninja.selectedElements);
154 }
155
156 }
157 }
158 },
159
160 displayStageProperties: {
161 value: function() {
162 var stage = this.application.ninja.currentDocument.documentRoot;
163 //this is test code please remove
164 this.elementName = "Stage";
165 this.elementId.value = stage.elementModel.id;
166 this.elementClassName = "";
167
168 this.positionSize.disablePosition = true;
169 this.threeD.disableTranslation = true;
170
171 this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(stage, "height"));
172 this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(stage, "width"));
173
174 if(this.customPi !== stage.elementModel.pi) {
175 // We need to unregister color chips from the previous selection from the Color Model
176 var len = this.customSections.length;
177 for(var n = 0, controls; n < len; n++) {
178 controls = this.customSections[n].content.controls;
179 if(controls["colorSelect"]) {
180 controls["colorSelect"].destroy();
181 } else if(controls["stageBackground"]) {
182 controls["stageBackground"].destroy();
183 }
184 }
185
186 this.customPi = stage.elementModel.pi;
187 this.displayCustomProperties(stage, stage.elementModel.pi);
188 }
189
190 // For now hardcode the background since it is the only custom property
191 // No need to loop through all the properties.
192 var backgroundChip = this.customSections[0].content.controls["background"];
193 backgroundChip.color = ElementsMediator.getProperty(stage, "background");
194
195 /*
196 var customPI = PiData[this.customPi];
197 // Get all the custom section for the custom PI
198 for(var i = 0, customSec; customSec = customPI[i]; i++) {
199
200 // Now set the Fields for the custom PI
201 for(var j = 0, fields; fields = customSec.Section[j]; j++) {
202 for(var k = 0, control; control = fields[k]; k++) {
203
204 var colorChipEl = this.customSections[i].content.controls[control.id];
205 this.foo = colorChipEl;
206 colorChipEl.addEventListener("firstDraw", this, false);
207
208 }
209 }
210 }
211 */
212 }
213 },
214
215 handleFirstDraw: {
216 value: function() {
217 this.foo.chipBtn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 0, b: 0}, css: 'rgb(255,0,0)'});
218 }
219 },
220
221 displayElementProperties: {
222 value: function (el) {
223