aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js65
1 files changed, 8 insertions, 57 deletions
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
index 33241d42..953c0484 100644
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
@@ -160,7 +160,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
160 var that = this; 160 var that = this;
161 var element = this.makeComponent(component.component); 161 var element = this.makeComponent(component.component);
162 162
163 this.application.ninja.currentDocument._window.addComponent(element, {type: component.name, path: component.module, name: "Button"}, function(instance, element) { 163 this.application.ninja.currentDocument._window.addComponent(element, {name: component.name, path: component.module}, function(instance, element) {
164 164
165 var pos = that.getStageCenter(); 165 var pos = that.getStageCenter();
166 166
@@ -181,73 +181,24 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
181 181
182 makeComponent: { 182 makeComponent: {
183 value: function(name) { 183 value: function(name) {
184 var el;
185
184 switch(name) { 186 switch(name) {
185 case "button": 187 case "button":
186 var el;
187 el = NJUtils.makeNJElement(name, "Button", "component"); 188 el = NJUtils.makeNJElement(name, "Button", "component");
188 el.elementModel.pi = "ButtonPi"; 189 el.elementModel.pi = "ButtonPi";
189 el.setAttribute("type", "button"); 190 el.setAttribute("type", "button");
190 return el; 191 el.innerHTML = "Button";
192 break;
191 case "textfield": { 193 case "textfield": {
192 var el; 194 el = NJUtils.makeNJElement("input", "Textfield", "component");
193 el = NJUtils.makeNJElement("input", "Text Field", "component");
194 el.elementModel.pi = "TextfieldPi"; 195 el.elementModel.pi = "TextfieldPi";
195 el.setAttribute("type", "text"); 196 el.setAttribute("type", "text");
196 return el; 197 break;
197 } 198 }
198 } 199 }
199 200
200 } 201 return el;
201 },
202
203 ___addComponentToStage:{
204 value:function(component, dropX, dropY){
205// var compW = 100,
206// compH = 100,
207//
208 var componentEl, componentInstance;
209
210 if(componentType == "Button"){
211 componentEl = NJUtils.makeNJElement("button", componentType, "component");//, {"type": "button"});
212 componentEl.setAttribute("type", "button");
213
214 componentInstance = this.application.ninja.currentDocument._window.addComponent(componentEl, {type: componentType, path: "montage/ui/button.reel", name: "Button"}, this.callback);
215
216 }else if(componentType == "Checkbox"){
217 compW = 53;
218 compH = 53;
219// elementType = "input";
220 }
221
222 /*
223 componentContainer = NJUtils.makeNJElement("div", componentType, "component");
224 componentContainer.elementModel.isComponent = true;
225 */
226 var styles = {
227 'position': 'absolute',
228 'top' : dropY + 'px',
229 'left' : dropX + 'px',
230// 'width' : compW + 'px',
231// 'height' : compH + 'px',
232 '-webkit-transform-style' : 'preserve-3d',
233 '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)'
234 };
235
236
237 //componentElement = NJUtils.makeNJElement(elementType, "ComponentDiv", "block");
238
239 //componentContainer.appendChild(componentElement);
240
241 this.application.ninja.currentDocument.setComponentInstance(componentInstance, componentEl);
242
243 NJevent("elementAdding", {"el": componentEl, "data":styles});
244 /*
245 var componentRef = this.application.ninja.currentDocument._window.addComponent(componentElement, componentType);
246
247 */
248
249
250
251 } 202 }
252 }, 203 },
253 204