diff options
author | Valerio Virgillito | 2012-05-09 15:40:50 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-09 15:40:50 -0700 |
commit | 480c3c43f15162980390cf762411b93f7d02db19 (patch) | |
tree | ab406e791d71985a79d63c1bc6efb892f6483d8d | |
parent | f8c467bd268e10d4f07136ca932c6eaffc94bc12 (diff) | |
download | ninja-480c3c43f15162980390cf762411b93f7d02db19.tar.gz |
fixing the components for the new dom
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rwxr-xr-x | js/document/models/html.js | 29 | ||||
-rwxr-xr-x | js/panels/components-panel.reel/components-panel.js | 4 |
2 files changed, 30 insertions, 3 deletions
diff --git a/js/document/models/html.js b/js/document/models/html.js index 1639a8e2..2764a6d6 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js | |||
@@ -26,9 +26,36 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { | |||
26 | // | 26 | // |
27 | webGlHelper: { | 27 | webGlHelper: { |
28 | value: webGlDocumentHelper | 28 | value: webGlDocumentHelper |
29 | } | 29 | }, |
30 | //////////////////////////////////////////////////////////////////// | 30 | //////////////////////////////////////////////////////////////////// |
31 | //////////////////////////////////////////////////////////////////// | 31 | //////////////////////////////////////////////////////////////////// |
32 | userComponents: { | ||
33 | value: {} | ||
34 | }, | ||
35 | |||
36 | /** | ||
37 | * Add a reference to a component instance to the userComponents hash using the | ||
38 | * element UUID | ||
39 | */ | ||
40 | setComponentInstance: { | ||
41 | value: function(instance, el) { | ||
42 | this.userComponents[el.uuid] = instance; | ||
43 | } | ||
44 | }, | ||
45 | |||
46 | /** | ||
47 | * Returns the component instance obj from the element | ||
48 | */ | ||
49 | getComponentFromElement: { | ||
50 | value: function(el) { | ||
51 | if(el) { | ||
52 | if(el.uuid) return this.userComponents[el.uuid]; | ||
53 | } else { | ||
54 | return null; | ||
55 | } | ||
56 | } | ||
57 | } | ||
58 | |||
32 | }); | 59 | }); |
33 | //////////////////////////////////////////////////////////////////////// | 60 | //////////////////////////////////////////////////////////////////////// |
34 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | 61 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file |
diff --git a/js/panels/components-panel.reel/components-panel.js b/js/panels/components-panel.reel/components-panel.js index 4169423b..9b237229 100755 --- a/js/panels/components-panel.reel/components-panel.js +++ b/js/panels/components-panel.reel/components-panel.js | |||
@@ -278,7 +278,7 @@ exports.ComponentsPanel = Montage.create(Component, { | |||
278 | that = this; | 278 | that = this; |
279 | element = this.makeComponent(component.component); | 279 | element = this.makeComponent(component.component); |
280 | 280 | ||
281 | this.application.ninja.currentDocument._window.addComponent(element, {name: component.name, path: component.module}, function(instance, element) { | 281 | this.application.ninja.currentDocument.model.views.design.iframe.contentWindow.addComponent(element, {name: component.name, path: component.module}, function(instance, element) { |
282 | 282 | ||
283 | //var pos = that.getStageCenter(); | 283 | //var pos = that.getStageCenter(); |
284 | 284 | ||
@@ -297,7 +297,7 @@ exports.ComponentsPanel = Montage.create(Component, { | |||
297 | 297 | ||
298 | instance.addEventListener('firstDraw', that, false); | 298 | instance.addEventListener('firstDraw', that, false); |
299 | 299 | ||
300 | that.application.ninja.currentDocument.setComponentInstance(instance, element); | 300 | that.application.ninja.currentDocument.model.setComponentInstance(instance, element); |
301 | 301 | ||
302 | that.application.ninja.elementMediator.addElements(element, styles); | 302 | that.application.ninja.elementMediator.addElements(element, styles); |
303 | }); | 303 | }); |