aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/controllers/elements/component-controller.js12
-rw-r--r--js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js65
2 files changed, 20 insertions, 57 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js
index 1b0591be..33b9b79a 100644
--- a/js/controllers/elements/component-controller.js
+++ b/js/controllers/elements/component-controller.js
@@ -18,6 +18,12 @@ exports.ComponentController = Montage.create(ElementController, {
18 case "enabled": 18 case "enabled":
19 return this.application.ninja.currentDocument.getComponentFromElement(el).enabled; 19 return this.application.ninja.currentDocument.getComponentFromElement(el).enabled;
20 break; 20 break;
21 case "disabled":
22 return this.application.ninja.currentDocument.getComponentFromElement(el).disabled;
23 break;
24 case "value":
25 return this.application.ninja.currentDocument.getComponentFromElement(el).value;
26 break;
21 default: 27 default:
22 return ElementController.getProperty(el, prop, true); 28 return ElementController.getProperty(el, prop, true);
23 } 29 }
@@ -33,6 +39,12 @@ exports.ComponentController = Montage.create(ElementController, {
33 case "enabled": 39 case "enabled":
34 this.application.ninja.currentDocument.getComponentFromElement(el).enabled = value; 40 this.application.ninja.currentDocument.getComponentFromElement(el).enabled = value;
35 break; 41 break;
42 case "disabled":
43 this.application.ninja.currentDocument.getComponentFromElement(el).disabled = value;
44 break;
45 case "value":
46 this.application.ninja.currentDocument.getComponentFromElement(el).value = value;
47 break;
36 default: 48 default:
37 ElementController.setProperty(el, p, value); 49 ElementController.setProperty(el, p, value);
38 } 50 }
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