aboutsummaryrefslogtreecommitdiff
path: root/js/lib/NJUtils.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/NJUtils.js')
-rwxr-xr-xjs/lib/NJUtils.js44
1 files changed, 41 insertions, 3 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js
index 4f1082f9..67bb59c4 100755
--- a/js/lib/NJUtils.js
+++ b/js/lib/NJUtils.js
@@ -94,19 +94,53 @@ exports.NJUtils = Object.create(Object.prototype, {
94 ///// TODO: find a different place for this function 94 ///// TODO: find a different place for this function
95 makeElementModel: { 95 makeElementModel: {
96 value: function(el, selection, controller, isShape) { 96 value: function(el, selection, controller, isShape) {
97 var p3d = Montage.create(Properties3D).init(el); 97 var p3d = Montage.create(Properties3D);
98 if(selection === "Stage") {
99 p3d.init(el, true);
100 }
98 var shapeProps = null; 101 var shapeProps = null;
102 var pi = controller + "Pi";
103
99 if(isShape) { 104 if(isShape) {
100 shapeProps = Montage.create(ShapeModel); 105 shapeProps = Montage.create(ShapeModel);
101 } 106 }
102 107
108 if(el.controller) {
109
110 var componentInfo = Montage.getInfoForObject(el.controller);
111 var componentName = componentInfo.objectName.toLowerCase();
112
113 controller = "component";
114 isShape = false;
115
116 switch(componentName) {
117 case "feedreader":
118 selection = "Feed Reader";
119 pi = "FeedReaderPi";
120 break;
121 case "map":
122 selection = "Map";
123 pi = "MapPi";
124 break;
125 case "youtubechannel":
126 selection = "Youtube Channel";
127 pi = "YoutubeChannelPi";
128 break;
129 case "picasacarousel":
130 selection = "Picasa Carousel";
131 pi = "PicasaCarouselPi";
132 break;
133 }
134 }
135
103 el.elementModel = Montage.create(ElementModel, { 136 el.elementModel = Montage.create(ElementModel, {
104 type: { value: el.nodeName}, 137 type: { value: el.nodeName},
105 selection: { value: selection}, 138 selection: { value: selection},
106 controller: { value: ControllerFactory.getController(controller)}, 139 controller: { value: ControllerFactory.getController(controller)},
107 pi: { value: controller + "Pi"}, 140 pi: { value: pi},
108 props3D: { value: p3d}, 141 props3D: { value: p3d},
109 shapeModel: { value: shapeProps} 142 shapeModel: { value: shapeProps},
143 isShape: { value: isShape}
110 }); 144 });
111 145
112 } 146 }
@@ -138,6 +172,7 @@ exports.NJUtils = Object.create(Object.prototype, {
138 // TODO - Need more info about the shape 172 // TODO - Need more info about the shape
139 selection = "canvas"; 173 selection = "canvas";
140 controller = "shape"; 174 controller = "shape";
175 isShape = true;
141 } 176 }
142 else 177 else
143 { 178 {
@@ -149,6 +184,9 @@ exports.NJUtils = Object.create(Object.prototype, {
149 break; 184 break;
150 } 185 }
151 this.makeElementModel(el, selection, controller, isShape); 186 this.makeElementModel(el, selection, controller, isShape);
187 if(el.elementModel && el.elementModel.props3D) {
188 el.elementModel.props3D.init(el, (selection === "Stage"));
189 }
152 } 190 }
153 }, 191 },
154 192