diff options
author | Valerio Virgillito | 2012-02-03 00:38:13 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-03 00:38:13 -0800 |
commit | 7950424cf704bb221971f4645406b01e6979db18 (patch) | |
tree | 6c9d208a2bc8c0d2da6a9001681787bbe1d6a14b | |
parent | 197ae04f7677b7a5890a589ba572e750a229c502 (diff) | |
download | ninja-7950424cf704bb221971f4645406b01e6979db18.tar.gz |
Fix the main user component to create distinct instance of component.
- Create a distinct instance of button
- Cleanup.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rw-r--r-- | js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js | 14 | ||||
-rw-r--r-- | user-document-templates/montage-application-cloud/main.reel/main.js | 32 |
2 files changed, 16 insertions, 30 deletions
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index ec092604..8c81b3ab 100644 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js | |||
@@ -97,12 +97,13 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component | |||
97 | this.application.ninja.currentDocument._window.addComponent(element, {type: "Button", path: component.module, name: "Button"}, function(instance, element) { | 97 | this.application.ninja.currentDocument._window.addComponent(element, {type: "Button", path: component.module, name: "Button"}, function(instance, element) { |
98 | 98 | ||
99 | var styles = { | 99 | var styles = { |
100 | 'position': 'absolute', | 100 | 'position': 'absolute', |
101 | 'top' : that._stash.dropx + 'px', | 101 | 'top' : that._stash.dropy + 'px', |
102 | 'left' : that._stash.dropy + 'px', | 102 | 'left' : that._stash.dropx + 'px', |
103 | '-webkit-transform-style' : 'preserve-3d', | 103 | '-webkit-transform-style' : 'preserve-3d', |
104 | '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' | 104 | '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' |
105 | }; | 105 | }; |
106 | |||
106 | 107 | ||
107 | that.application.ninja.currentDocument.setComponentInstance(instance, element); | 108 | that.application.ninja.currentDocument.setComponentInstance(instance, element); |
108 | 109 | ||
@@ -134,6 +135,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component | |||
134 | value: function(name) { | 135 | value: function(name) { |
135 | var el; | 136 | var el; |
136 | el = NJUtils.makeNJElement(name, "Button", "component"); | 137 | el = NJUtils.makeNJElement(name, "Button", "component"); |
138 | //el.elementModel.pi = "buttonPi"; | ||
137 | el.setAttribute("type", "button"); | 139 | el.setAttribute("type", "button"); |
138 | return el; | 140 | return el; |
139 | } | 141 | } |
diff --git a/user-document-templates/montage-application-cloud/main.reel/main.js b/user-document-templates/montage-application-cloud/main.reel/main.js index 90262073..b4ed049f 100644 --- a/user-document-templates/montage-application-cloud/main.reel/main.js +++ b/user-document-templates/montage-application-cloud/main.reel/main.js | |||
@@ -37,36 +37,20 @@ exports.Main = Montage.create(Component, { | |||
37 | switch(componentType.type){ | 37 | switch(componentType.type){ |
38 | case "Button": | 38 | case "Button": |
39 | 39 | ||
40 | //var tmpFix = ("montage/ui/button.reel"); | 40 | var button = require.async(componentType.path) |
41 | //var str = "montage/ui/button.reel"; | ||
42 | var stro = componentType.path; | ||
43 | |||
44 | // var button = (stro); | ||
45 | |||
46 | var button = require.async(stro) | ||
47 | .then(function (button) { | 41 | .then(function (button) { |
48 | var btIns = button["Button"]; | 42 | var buttonObj = button["Button"]; |
43 | var btIns = buttonObj.create(); | ||
49 | 44 | ||
50 | btIns.element = containerElement; | 45 | btIns.element = containerElement; |
51 | btIns.deserializedFromTemplate(); | 46 | btIns.deserializedFromTemplate(); |
52 | 47 | ||
53 | btIns.needsDraw = true; | 48 | btIns.needsDraw = true; |
54 | btIns.label = "Button"; | 49 | btIns.label = "Button"; |
55 | callback(btIns, containerElement); | 50 | callback(btIns, containerElement); |
56 | }) | 51 | }) |
57 | .end(); | 52 | .end(); |
58 | 53 | ||
59 | /* | ||
60 | var buttonInstance = button[componentType.name]; | ||
61 | |||
62 | buttonInstance.element = containerElement; | ||
63 | buttonInstance.deserializedFromTemplate(); | ||
64 | |||
65 | buttonInstance.needsDraw = true; | ||
66 | buttonInstance.label = "Button"; | ||
67 | |||
68 | return buttonInstance; | ||
69 | */ | ||
70 | break; | 54 | break; |
71 | case "Checkbox": | 55 | case "Checkbox": |
72 | component = Checkbox.create(); | 56 | component = Checkbox.create(); |