diff options
Diffstat (limited to 'js/controllers/selection-controller.js')
-rwxr-xr-x | js/controllers/selection-controller.js | 64 |
1 files changed, 54 insertions, 10 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 848355da..a219c597 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -20,6 +20,60 @@ exports.SelectionController = Montage.create(Component, { | |||
20 | } | 20 | } |
21 | }, | 21 | }, |
22 | 22 | ||
23 | _currentDocument: { | ||
24 | value : null | ||
25 | }, | ||
26 | |||
27 | currentDocument : { | ||
28 | get : function() { | ||
29 | return this._currentDocument; | ||
30 | }, | ||
31 | set : function(value) { | ||
32 | if (value === this._currentDocument) { | ||
33 | return; | ||
34 | } | ||
35 | |||
36 | if(this._currentDocument) { | ||
37 | this._currentDocument.model.selection = this.application.ninja.selectedElements; | ||
38 | this._currentDocument.model.selectionContainer = this.application.ninja._currentSelectedContainer; | ||
39 | } | ||
40 | |||
41 | this._currentDocument = value; | ||
42 | |||
43 | if(!value) { | ||
44 | } else if(this._currentDocument.currentView === "design") { | ||
45 | } else { | ||
46 | } | ||
47 | |||
48 | } | ||
49 | }, | ||
50 | |||
51 | _selectedElements: { | ||
52 | value: null | ||
53 | }, | ||
54 | |||
55 | selectedElements: { | ||
56 | get: function() { | ||
57 | return this._selectedElements; | ||
58 | }, | ||
59 | set: function(value) { | ||
60 | if(value) { | ||
61 | this._selectedElements = value; | ||
62 | |||
63 | this.application.ninja.selectedElements = this._selectedElements; | ||
64 | this.application.ninja._currentSelectedContainer = this._selectionContainer = this.application.ninja.currentDocument.model.documentRoot; | ||
65 | |||
66 | if(this._selectedElements.length === 0) { | ||
67 | this.executeSelectElement(); | ||
68 | } else { | ||
69 | this.executeSelectElement(this._selectedElements); | ||
70 | } | ||
71 | |||
72 | |||
73 | } | ||
74 | } | ||
75 | }, | ||
76 | |||
23 | // Bound property to the ninja currentSelectedContainer | 77 | // Bound property to the ninja currentSelectedContainer |
24 | _selectionContainer: { | 78 | _selectionContainer: { |
25 | value: null | 79 | value: null |
@@ -44,16 +98,6 @@ exports.SelectionController = Montage.create(Component, { | |||
44 | this.eventManager.addEventListener("elementsRemoved", this, false); | 98 | this.eventManager.addEventListener("elementsRemoved", this, false); |
45 | this.eventManager.addEventListener("elementReplaced", this, false); | 99 | this.eventManager.addEventListener("elementReplaced", this, false); |
46 | this.eventManager.addEventListener("selectAll", this, false); | 100 | this.eventManager.addEventListener("selectAll", this, false); |
47 | this.eventManager.addEventListener("switchDocument", this, false); | ||
48 | } | ||
49 | }, | ||
50 | |||
51 | handleSwitchDocument: { | ||
52 | value: function() { | ||
53 | // if(this.application.ninja.documentController.activeDocument.currentView === "design"){ | ||
54 | this._isDocument = this.application.ninja.selectedElements.length === 0; | ||
55 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); | ||
56 | // } | ||
57 | } | 101 | } |
58 | }, | 102 | }, |
59 | 103 | ||