aboutsummaryrefslogtreecommitdiff
path: root/js/lib/NJUtils.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-07 11:28:25 -0700
committerJose Antonio Marquez2012-06-07 11:28:25 -0700
commit7d1a564a8fd246c621f674b5521554fbfc058281 (patch)
treed1be340a099e318db8113b651ba45c3d4c00f3a5 /js/lib/NJUtils.js
parent0efbbf8287517b755be1774f6aa49947bed50a0d (diff)
parentb75fe9369f7caec0351d298f7106c8d59572b440 (diff)
downloadninja-7d1a564a8fd246c621f674b5521554fbfc058281.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into FileIO
Diffstat (limited to 'js/lib/NJUtils.js')
-rwxr-xr-xjs/lib/NJUtils.js120
1 files changed, 0 insertions, 120 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js
index 7dd4c9e8..0dec6345 100755
--- a/js/lib/NJUtils.js
+++ b/js/lib/NJUtils.js
@@ -90,30 +90,6 @@ exports.NJUtils = Montage.create(Component, {
90 } 90 }
91 }, 91 },
92 92
93 createModel: {
94 value: function(el) {
95 el.elementModel = Montage.create(ElementModel).initialize(el);
96 }
97 },
98
99 createModelWithShape: {
100 value: function(el, selection) {
101 el.elementModel = Montage.create(ElementModel).initialize(el, true, selection);
102 }
103 },
104
105 createModelWithSelection: {
106 value: function(el, selection) {
107 el.elementModel = Montage.create(ElementModel).initialize(el, false, selection);
108 }
109 },
110
111 createModelForComponent: {
112 value: function(el, selection) {
113 el.elementModel = Montage.create(ElementModel).initialize(el, false, selection, true);
114 }
115 },
116
117 // TODO: Find a better place for this method 93 // TODO: Find a better place for this method
118 stylesFromDraw: { 94 stylesFromDraw: {
119 value: function(element, width, height, drawData, pos) { 95 value: function(element, width, height, drawData, pos) {
@@ -166,102 +142,6 @@ exports.NJUtils = Montage.create(Component, {
166 } 142 }
167 }, 143 },
168 144
169 ///// Element Model creation for existing elements
170 ///// TODO: find a different place for this function
171 makeElementModel: {
172 value: function(el, selection, controller, isShape) {
173 var p3d = Montage.create(Properties3D);
174
175 var shapeProps = null;
176 var pi = controller + "Pi";
177
178 if(isShape) {
179 shapeProps = Montage.create(ShapeModel);
180 }
181
182 if(el.controller) {
183
184 var componentInfo = Montage.getInfoForObject(el.controller);
185 var componentName = componentInfo.objectName.toLowerCase();
186
187 controller = "component";
188 isShape = false;
189
190 switch(componentName) {
191 case "feedreader":
192 selection = "Feed Reader";
193 pi = "FeedReaderPi";
194 break;
195 case "map":
196 selection = "Map";
197 pi = "MapPi";
198 break;
199 case "youtubechannel":
200 selection = "Youtube Channel";
201 pi = "YoutubeChannelPi";
202 break;
203 case "picasacarousel":
204 selection = "Picasa Carousel";
205 pi = "PicasaCarouselPi";
206 break;
207 }
208 }
209
210 el.elementModel = Montage.create(ElementModel, {
211 type: { value: el.nodeName},
212 selection: { value: selection},
213 controller: { value: ControllerFactory.getController(controller)},
214 pi: { value: pi},
215 props3D: { value: p3d},
216 shapeModel: { value: shapeProps},
217 isShape: { value: isShape}
218 });
219
220
221 }
222 },
223
224 ///// Element Model creation for existing elements based on element type.
225 ///// TODO: Selection and model should be based on the element type
226 makeModelFromElement: {
227 value: function(el) {
228 var selection = "div",
229 controller = "block",
230 isShape = false;
231 switch(el.nodeName.toLowerCase())
232 {
233 case "div":
234 break;
235 case "img":
236 selection = "image";
237 controller = "image";
238 break;
239 case "video":
240 selection = "video";
241 controller = "video";
242 break;
243 case "canvas":
244 isShape = el.getAttribute("data-RDGE-id");
245 if(isShape) {
246 // TODO - Need more info about the shape
247 selection = "canvas";
248 controller = "shape";
249 isShape = true;
250 } else {
251 selection = "canvas";
252 controller = "canvas";
253 }
254 break;
255 case "shape":
256 break;
257 }
258 this.makeElementModel(el, selection, controller, isShape);
259 if(el.elementModel && el.elementModel.props3D) {
260 el.elementModel.props3D.init(el, (selection === "Stage"));
261 }
262 }
263 },
264
265 ///// Removes all child nodes and returns node 145 ///// Removes all child nodes and returns node
266 ///// Accepts a single node, or an array of dom nodes 146 ///// Accepts a single node, or an array of dom nodes
267 empty : { 147 empty : {