diff options
Diffstat (limited to 'js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js')
-rw-r--r-- | js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index 41afefa5..c8624b29 100644 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js | |||
@@ -59,15 +59,20 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component | |||
59 | 59 | ||
60 | addComponentToStage:{ | 60 | addComponentToStage:{ |
61 | value:function(componentType, dropX, dropY){ | 61 | value:function(componentType, dropX, dropY){ |
62 | var compW = 100, | 62 | // var compW = 100, |
63 | compH = 100, | 63 | // compH = 100, |
64 | elementType = "div", | 64 | // elementType = "div", |
65 | componentContainer, | 65 | // componentContainer, |
66 | componentElement; | 66 | // componentElement; |
67 | var componentEl; | ||
67 | 68 | ||
68 | if(componentType == "Button"){ | 69 | if(componentType == "Button"){ |
69 | compW = 118; | 70 | componentEl = NJUtils.makeNJElement("button", componentType, "component");//, {"type": "button"}); |
70 | compH = 52; | 71 | componentEl.setAttribute("type", "button"); |
72 | componentEl.innerHTML = "Button"; | ||
73 | console.log(componentEl); | ||
74 | // compW = 118; | ||
75 | // compH = 52; | ||
71 | }else if(componentType == "Checkbox"){ | 76 | }else if(componentType == "Checkbox"){ |
72 | compW = 53; | 77 | compW = 53; |
73 | compH = 53; | 78 | compH = 53; |
@@ -117,28 +122,31 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component | |||
117 | compH = 25; | 122 | compH = 25; |
118 | } | 123 | } |
119 | 124 | ||
125 | |||
126 | /* | ||
120 | componentContainer = NJUtils.makeNJElement("div", componentType, "component"); | 127 | componentContainer = NJUtils.makeNJElement("div", componentType, "component"); |
121 | componentContainer.elementModel.isComponent = true; | 128 | componentContainer.elementModel.isComponent = true; |
122 | 129 | */ | |
123 | var styles = { | 130 | var styles = { |
124 | 'position': 'absolute', | 131 | 'position': 'absolute', |
125 | 'top' : dropY + 'px', | 132 | 'top' : dropY + 'px', |
126 | 'left' : dropX + 'px', | 133 | 'left' : dropX + 'px', |
127 | 'width' : compW + 'px', | 134 | // 'width' : compW + 'px', |
128 | 'height' : compH + 'px', | 135 | // 'height' : compH + 'px', |
129 | '-webkit-transform-style' : 'preserve-3d', | 136 | '-webkit-transform-style' : 'preserve-3d', |
130 | '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' | 137 | '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' |
131 | }; | 138 | }; |
132 | 139 | ||
133 | 140 | ||
134 | componentElement = NJUtils.makeNJElement(elementType, "ComponentDiv", "block"); | 141 | //componentElement = NJUtils.makeNJElement(elementType, "ComponentDiv", "block"); |
135 | |||
136 | componentContainer.appendChild(componentElement); | ||
137 | 142 | ||
138 | NJevent("elementAdding", {"el": componentContainer, "data":styles}); | 143 | //componentContainer.appendChild(componentElement); |
139 | 144 | ||
145 | NJevent("elementAdding", {"el": componentEl, "data":styles}); | ||
146 | /* | ||
140 | var componentRef = this.application.ninja.currentDocument._window.addComponent(componentElement, componentType); | 147 | var componentRef = this.application.ninja.currentDocument._window.addComponent(componentElement, componentType); |
141 | this.application.ninja.currentDocument._userComponentSet[componentContainer.uuid] = componentRef; | 148 | this.application.ninja.currentDocument._userComponentSet[componentContainer.uuid] = componentRef; |
149 | */ | ||
142 | 150 | ||
143 | } | 151 | } |
144 | } | 152 | } |