aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/selection-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/selection-controller.js')
-rwxr-xr-xjs/controllers/selection-controller.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index d69b53e0..c4623d3f 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -47,6 +47,7 @@ exports.SelectionController = Montage.create(Component, {
47 this.eventManager.addEventListener("elementDeleted", this, false); 47 this.eventManager.addEventListener("elementDeleted", this, false);
48 this.eventManager.addEventListener("selectAll", this, false); 48 this.eventManager.addEventListener("selectAll", this, false);
49 this.eventManager.addEventListener("deleteSelection", this, false); 49 this.eventManager.addEventListener("deleteSelection", this, false);
50 this.eventManager.addEventListener("switchDocument", this, false);
50// defaultEventManager.addEventListener( "undo", this, false); 51// defaultEventManager.addEventListener( "undo", this, false);
51// defaultEventManager.addEventListener( "redo", this, false); 52// defaultEventManager.addEventListener( "redo", this, false);
52 } 53 }
@@ -58,6 +59,7 @@ exports.SelectionController = Montage.create(Component, {
58 handleOpenDocument: { 59 handleOpenDocument: {
59 value: function() { 60 value: function() {
60 // Handle initializing the selection array here. 61 // Handle initializing the selection array here.
62 this.initWithDocument([]);
61 } 63 }
62 }, 64 },
63 65
@@ -70,6 +72,14 @@ exports.SelectionController = Montage.create(Component, {
70 if(currentSelectionArray.length >= 1) { 72 if(currentSelectionArray.length >= 1) {
71 this._selectedItems = currentSelectionArray; 73 this._selectedItems = currentSelectionArray;
72 this._isDocument = false; 74 this._isDocument = false;
75
76
77
78 this.application.ninja.selectedElements = currentSelectionArray;
79 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
80
81
82
73 } 83 }
74 } 84 }
75 85
@@ -79,6 +89,18 @@ exports.SelectionController = Montage.create(Component, {
79 } 89 }
80 }, 90 },
81 91
92 handleSwitchDocument: {
93 value: function() {
94 this._selectedItems = this.application.ninja.selectedElements.slice(0);
95 if(this._selectedItems.length === 0 ){
96 this._isDocument = true;
97 }else{
98 this._isDocument = false;
99 }
100 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
101 }
102 },
103
82 handleElementAdded: { 104 handleElementAdded: {
83 value: function(event) { 105 value: function(event) {
84 this.executeSelectElement(event.detail); 106 this.executeSelectElement(event.detail);