diff options
Diffstat (limited to 'js/panels/properties.reel/properties.js')
-rwxr-xr-x | js/panels/properties.reel/properties.js | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index 84b0d589..934a3851 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js | |||
@@ -13,6 +13,35 @@ var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; | |||
13 | 13 | ||
14 | exports.Properties = Montage.create(Component, { | 14 | exports.Properties = Montage.create(Component, { |
15 | 15 | ||
16 | _currentDocument: { | ||
17 | value : null | ||
18 | }, | ||
19 | |||
20 | currentDocument : { | ||
21 | get : function() { | ||
22 | return this._currentDocument; | ||
23 | }, | ||
24 | set : function(value) { | ||
25 | if (value === this._currentDocument) { | ||
26 | return; | ||
27 | } | ||
28 | |||
29 | this._currentDocument = value; | ||
30 | |||
31 | // if(!value) { | ||
32 | this.clear(); | ||
33 | // } | ||
34 | |||
35 | /* | ||
36 | else if(this._currentDocument.currentView === "design") { | ||
37 | // Display the default document root PI | ||
38 | //this.displayElementProperties(this._currentDocument.model.documentRoot); | ||
39 | // this.displaySelection(this._currentDocument.model.selection); | ||
40 | } | ||
41 | */ | ||
42 | } | ||
43 | }, | ||
44 | |||
16 | elementName: { | 45 | elementName: { |
17 | value: null | 46 | value: null |
18 | }, | 47 | }, |
@@ -46,9 +75,8 @@ exports.Properties = Montage.create(Component, { | |||
46 | 75 | ||
47 | prepareForDraw: { | 76 | prepareForDraw: { |
48 | value : function() { | 77 | value : function() { |
49 | this.eventManager.addEventListener("openDocument", this, false); | 78 | this.eventManager.addEventListener("elementChange", this, false); |
50 | this.eventManager.addEventListener("selectionChange", this, false); | 79 | this.eventManager.addEventListener("selectionChange", this, false); |
51 | this.eventManager.addEventListener("closeDocument", this, false); | ||
52 | 80 | ||
53 | // This will be a toggle option | 81 | // This will be a toggle option |
54 | if(this.application.ninja.appData.PILiveUpdate) { | 82 | if(this.application.ninja.appData.PILiveUpdate) { |
@@ -65,24 +93,6 @@ exports.Properties = Montage.create(Component, { | |||
65 | } | 93 | } |
66 | }, | 94 | }, |
67 | 95 | ||
68 | handleOpenDocument: { | ||
69 | value: function() { | ||
70 | this.eventManager.addEventListener( "elementChange", this, false); | ||
71 | |||
72 | // Save a reference of the pi inside the document view to be able to clear | ||
73 | this.application.ninja.currentDocument.model.views.design.propertiesPanel = this; | ||
74 | |||
75 | // Display the default document root PI | ||
76 | this.displayElementProperties(this.application.ninja.currentDocument.model.documentRoot); | ||
77 | } | ||
78 | }, | ||
79 | |||
80 | handleCloseDocument: { | ||
81 | value: function(){ | ||
82 | this.clear(); | ||
83 | } | ||
84 | }, | ||
85 | |||
86 | /** | 96 | /** |
87 | * Blur and Key up to handle change in the Element ID field. | 97 | * Blur and Key up to handle change in the Element ID field. |
88 | */ | 98 | */ |
@@ -173,6 +183,20 @@ exports.Properties = Montage.create(Component, { | |||
173 | } | 183 | } |
174 | }, | 184 | }, |
175 | 185 | ||
186 | displaySelection: { | ||
187 | value: function(selection) { | ||
188 | if(selection.length === 0) { | ||
189 | this.displayElementProperties(this._currentDocument.model.documentRoot); | ||
190 | } else { | ||
191 | if(selection.length === 1) { | ||
192 | this.displayElementProperties(this.application.ninja.selectedElements[0]); | ||
193 | } else { | ||
194 | this.displayGroupProperties(this.application.ninja.selectedElements); | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | }, | ||
199 | |||
176 | clear: { | 200 | clear: { |
177 | value: function() { | 201 | value: function() { |
178 | this.elementName.value = ""; | 202 | this.elementName.value = ""; |