diff options
Diffstat (limited to 'js/panels/properties/content.reel/content.js')
-rwxr-xr-x | js/panels/properties/content.reel/content.js | 356 |
1 files changed, 0 insertions, 356 deletions
diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js deleted file mode 100755 index 8fa33a75..00000000 --- a/js/panels/properties/content.reel/content.js +++ /dev/null | |||
@@ -1,356 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | |||
7 | var 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 | |||
12 | var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; | ||
13 | |||
14 | exports.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 | } | ||
59 | }, | ||
60 | |||
61 | // Document is opened - Display the current selection | ||
62 | handleOpenDocument: { | ||
63 | value: function() { | ||
64 | |||
65 | this.eventManager.addEventListener( "elementChange", this, false); | ||
66 | |||
67 | // For now always assume that the stage is selected by default | ||
68 | if(this.application.ninja.selectedElements.length === 0) { | ||
69 | this.displayStageProperties(); | ||
70 | } | ||
71 | |||
72 | this.elementId.element.addEventListener("blur", this, false); | ||
73 | this.elementId.element.addEventListener("keyup", this, false); | ||
74 | } | ||
75 | }, | ||
76 | |||
77 | /** | ||
78 | * Blur and Key up to handle change in the Element ID field. | ||
79 | */ | ||
80 | handleBlur: { | ||
81 | value: function(event) { | ||
82 | if(this.application.ninja.selectedElements.length) { | ||
83 | ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, "Change", "pi"); | ||
84 | } else { | ||
85 | ElementsMediator.setAttribute(this.application.ninja.currentDocument.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.documentRoot.elementModel.id); | ||
86 | } | ||
87 | } | ||
88 | }, | ||
89 | |||
90 | handleKeyup: { | ||
91 | value: function(event) { | ||
92 | if(event.keyCode === 13) { | ||
93 | this.elementId.element.blur(); | ||
94 | } | ||
95 | } | ||
96 | }, | ||
97 | |||
98 | handleElementChanging: { | ||
99 | value: function(event) { | ||
100 | // this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "left")); | ||
101 | // this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "top")); | ||
102 | } | ||
103 | }, | ||
104 | |||
105 | handleElementChange: { | ||
106 | value: function(event) { | ||
107 | // console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update | ||
108 | if(event.detail.source && event.detail.source !== "pi") { | ||
109 | // TODO - This should only update the properties that were changed. | ||
110 | var el = this.application.ninja.selectedElements[0]._element || this.application.ninja.selectedElements[0]; | ||
111 | this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(el, "left")); | ||
112 | this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(el, "top")); | ||
113 | this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(el, "height")); | ||
114 | this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(el, "width")); | ||
115 | |||
116 | if(this.threeD.inGlobalMode) | ||
117 | { | ||
118 | this.threeD.x3D = ElementsMediator.get3DProperty(el, "x3D"); | ||
119 | this.threeD.y3D = ElementsMediator.get3DProperty(el, "y3D"); | ||
120 | this.threeD.z3D = ElementsMediator.get3DProperty(el, "z3D"); | ||
121 | this.threeD.xAngle = ElementsMediator.get3DProperty(el, "xAngle"); | ||
122 | this.threeD.yAngle = ElementsMediator.get3DProperty(el, "yAngle"); | ||
123 | this.threeD.zAngle = ElementsMediator.get3DProperty(el, "zAngle"); | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | }, | ||
128 | |||
129 | handleSelectionChange: { | ||
130 | value: function(event) { | ||
131 | if(event.detail.isDocument) { | ||
132 | this.displayStageProperties(); | ||
133 | } else { | ||
134 | if(this.application.ninja.selectedElements.length === 1) { | ||
135 | this.displayElementProperties(this.application.ninja.selectedElements[0]._element); | ||
136 | } else { | ||
137 | this.displayGroupProperties(this.application.ninja.selectedElements); | ||
138 | } | ||
139 | |||
140 | } | ||
141 | } | ||
142 | }, | ||
143 | |||
144 | displayStageProperties: { | ||
145 | value: function() { | ||
146 | var stage = this.application.ninja.currentDocument.documentRoot; | ||
147 | //this is test code please remove | ||
148 | this.elementName = "Stage"; | ||
149 | this.elementId.value = stage.elementModel.id; | ||
150 | this.elementClassName = ""; | ||
151 | |||
152 | this.positionSize.disablePosition = true; | ||
153 | this.threeD.disableTranslation = true; | ||
154 | |||
155 | this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(stage, "height")); | ||
156 | this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(stage, "width")); | ||
157 | |||
158 | if(this.customPi !== stage.elementModel.pi) { | ||
159 | this.customPi = stage.elementModel.pi; | ||
160 | this.displayCustomProperties(stage, stage.elementModel.pi); | ||
161 | } | ||
162 | |||
163 | // For now hardcode the background since it is the only custom property | ||
164 | // No need to loop through all the properties. | ||
165 | var backgroundChip = this.customSections[0].content.controls["background"]; | ||
166 | backgroundChip.color = ElementsMediator.getProperty(stage, "background"); | ||
167 | |||
168 | /* | ||
169 | var customPI = PiData[this.customPi]; | ||
170 | // Get all the custom section for the custom PI | ||
171 | for(var i = 0, customSec; customSec = customPI[i]; i++) { | ||
172 | |||
173 | // Now set the Fields for the custom PI | ||
174 | for(var j = 0, fields; fields = customSec.Section[j]; j++) { | ||
175 | for(var k = 0, control; control = fields[k]; k++) { | ||
176 | |||
177 | var colorChipEl = this.customSections[i].content.controls[control.id]; | ||
178 | this.foo = colorChipEl; | ||
179 | colorChipEl.addEventListener("firstDraw", this, false); | ||
180 | |||
181 | } | ||
182 | } | ||
183 | } | ||
184 | */ | ||
185 | } | ||
186 | }, | ||
187 | |||
188 | handleFirstDraw: { | ||
189 | value: function() { | ||
190 | this.foo.chipBtn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 0, b: 0}, css: 'rgb(255,0,0)'}); | ||
191 | } | ||
192 | }, | ||
193 | |||
194 | displayElementProperties: { | ||
195 | value: function (el) { | ||
196 | var customPI, | ||
197 | currentValue; | ||
198 | |||
199 | this.elementName = el.elementModel.selection; | ||
200 | this.elementId.value = el.getAttribute("id") || ""; | ||
201 | this.elementClassName = el.getAttribute("class"); | ||
202 | |||
203 | this.positionSize.disablePosition = false; | ||
204 | this.threeD.disableTranslation = false; | ||
205 | |||
206 | this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(el, "left")); | ||
207 | this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(el, "top")); | ||
208 | this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(el, "height")); | ||
209 | this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(el, "width")); | ||
210 | |||
211 | |||
212 | if(this.threeD.inGlobalMode) | ||
213 | { | ||
214 | this.threeD.x3D = ElementsMediator.get3DProperty(el, "x3D"); | ||
215 | this.threeD.y3D = ElementsMediator.get3DProperty(el, "y3D"); | ||
216 | this.threeD.z3D = ElementsMediator.get3DProperty(el, "z3D"); | ||
217 | this.threeD.xAngle = ElementsMediator.get3DProperty(el, "xAngle"); | ||
218 | this.threeD.yAngle = ElementsMediator.get3DProperty(el, "yAngle"); | ||
219 | this.threeD.zAngle = ElementsMediator.get3DProperty(el, "zAngle"); | ||
220 | } | ||
221 | |||
222 | // Custom Section | ||