From 47df0aff81c25334b129047bb227ea5015357eda Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 9 Feb 2012 16:22:03 -0800 Subject: Setting defaults and more cleanup Signed-off-by: Valerio Virgillito --- .../ComponentsPanelBase.js | 65 +++------------------- 1 file changed, 8 insertions(+), 57 deletions(-) (limited to 'js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js') 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 var that = this; var element = this.makeComponent(component.component); - this.application.ninja.currentDocument._window.addComponent(element, {type: component.name, path: component.module, name: "Button"}, function(instance, element) { + this.application.ninja.currentDocument._window.addComponent(element, {name: component.name, path: component.module}, function(instance, element) { var pos = that.getStageCenter(); @@ -181,73 +181,24 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component makeComponent: { value: function(name) { + var el; + switch(name) { case "button": - var el; el = NJUtils.makeNJElement(name, "Button", "component"); el.elementModel.pi = "ButtonPi"; el.setAttribute("type", "button"); - return el; + el.innerHTML = "Button"; + break; case "textfield": { - var el; - el = NJUtils.makeNJElement("input", "Text Field", "component"); + el = NJUtils.makeNJElement("input", "Textfield", "component"); el.elementModel.pi = "TextfieldPi"; el.setAttribute("type", "text"); - return el; + break; } } - } - }, - - ___addComponentToStage:{ - value:function(component, dropX, dropY){ -// var compW = 100, -// compH = 100, -// - var componentEl, componentInstance; - - if(componentType == "Button"){ - componentEl = NJUtils.makeNJElement("button", componentType, "component");//, {"type": "button"}); - componentEl.setAttribute("type", "button"); - - componentInstance = this.application.ninja.currentDocument._window.addComponent(componentEl, {type: componentType, path: "montage/ui/button.reel", name: "Button"}, this.callback); - - }else if(componentType == "Checkbox"){ - compW = 53; - compH = 53; -// elementType = "input"; - } - - /* - componentContainer = NJUtils.makeNJElement("div", componentType, "component"); - componentContainer.elementModel.isComponent = true; - */ - var styles = { - 'position': 'absolute', - 'top' : dropY + 'px', - 'left' : dropX + 'px', -// 'width' : compW + 'px', -// 'height' : compH + 'px', - '-webkit-transform-style' : 'preserve-3d', - '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' - }; - - - //componentElement = NJUtils.makeNJElement(elementType, "ComponentDiv", "block"); - - //componentContainer.appendChild(componentElement); - - this.application.ninja.currentDocument.setComponentInstance(componentInstance, componentEl); - - NJevent("elementAdding", {"el": componentEl, "data":styles}); - /* - var componentRef = this.application.ninja.currentDocument._window.addComponent(componentElement, componentType); - - */ - - - + return el; } }, -- cgit v1.2.3