diff options
author | Valerio Virgillito | 2012-05-29 00:34:40 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-29 00:34:40 -0700 |
commit | 4c3aac5eabd93052b1554a03d78235215bb49db4 (patch) | |
tree | fe08f4f6d33d81d602f56daeaec845577fb9d8a5 /js/controllers/selection-controller.js | |
parent | 9a66ccad0235484643ef6d821315b11b5be4a93e (diff) | |
download | ninja-4c3aac5eabd93052b1554a03d78235215bb49db4.tar.gz |
document bindings phase 1
- using array controller to bind the current document to all ninja components
- removed open document event
- removed references to the document controller
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/controllers/selection-controller.js')
-rwxr-xr-x | js/controllers/selection-controller.js | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 75bffc5c..db8bdf51 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -20,6 +20,41 @@ exports.SelectionController = Montage.create(Component, { | |||
20 | } | 20 | } |
21 | }, | 21 | }, |
22 | 22 | ||
23 | _currentDocument: { | ||
24 | value : null, | ||
25 | enumerable : false | ||
26 | }, | ||
27 | |||
28 | currentDocument : { | ||
29 | get : function() { | ||
30 | return this._currentDocument; | ||
31 | }, | ||
32 | set : function(value) { | ||
33 | if (value === this._currentDocument) { | ||
34 | return; | ||
35 | } | ||
36 | |||
37 | this._currentDocument = value; | ||
38 | |||
39 | if(this._currentDocument.currentView === "design") { | ||
40 | |||
41 | /* | ||
42 | this._isDocument = true; | ||
43 | |||
44 | if(currentSelectionArray) { | ||
45 | this.application.ninja.selectedElements = currentSelectionArray; | ||
46 | if(currentSelectionArray.length) { | ||
47 | this._isDocument = false; | ||
48 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | this._selectionContainer = this.application.ninja.currentSelectedContainer; | ||
53 | */ | ||
54 | } | ||
55 | } | ||
56 | }, | ||
57 | |||
23 | /* | 58 | /* |
24 | * Bound property to the ninja currentSelectedContainer | 59 | * Bound property to the ninja currentSelectedContainer |
25 | */ | 60 | */ |
@@ -52,32 +87,6 @@ exports.SelectionController = Montage.create(Component, { | |||
52 | } | 87 | } |
53 | }, | 88 | }, |
54 | 89 | ||
55 | /** | ||
56 | * Get the current document selection array. If nothing is selected the currentSelectionArray should be null | ||
57 | */ | ||
58 | handleOpenDocument: { | ||
59 | value: function() { | ||
60 | // Handle initializing the selection array here. | ||
61 | this.initWithDocument([]); | ||
62 | } | ||
63 | }, | ||
64 | |||
65 | initWithDocument: { | ||
66 | value: function(currentSelectionArray) { | ||
67 | this._isDocument = true; | ||
68 | |||
69 | if(currentSelectionArray) { | ||
70 | this.application.ninja.selectedElements = currentSelectionArray; | ||
71 | if(currentSelectionArray.length) { | ||
72 | this._isDocument = false; | ||
73 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); | ||
74 | } | ||
75 | } | ||
76 | |||
77 | this._selectionContainer = this.application.ninja.currentSelectedContainer; | ||
78 | } | ||
79 | }, | ||
80 | |||
81 | handleSwitchDocument: { | 90 | handleSwitchDocument: { |
82 | value: function() { | 91 | value: function() { |
83 | // if(this.application.ninja.documentController.activeDocument.currentView === "design"){ | 92 | // if(this.application.ninja.documentController.activeDocument.currentView === "design"){ |