diff options
Diffstat (limited to 'js/panels/properties.reel/properties.js')
-rwxr-xr-x | js/panels/properties.reel/properties.js | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index 84b0d589..4b663220 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js | |||
@@ -13,6 +13,34 @@ 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 | enumerable : false | ||
19 | }, | ||
20 | |||
21 | currentDocument : { | ||
22 | get : function() { | ||
23 | return this._currentDocument; | ||
24 | }, | ||
25 | set : function(value) { | ||
26 | if (value === this._currentDocument) { | ||
27 | return; | ||
28 | } | ||
29 | |||
30 | this._currentDocument = value; | ||
31 | |||
32 | if(!value) { | ||
33 | this.clear(); | ||
34 | } else if(this._currentDocument.currentView === "design") { | ||
35 | // Save a reference of the pi inside the document view to be able to clear | ||
36 | this._currentDocument.model.views.design.propertiesPanel = this; | ||
37 | |||
38 | // Display the default document root PI | ||
39 | this.displayElementProperties(this._currentDocument.model.documentRoot); | ||
40 | } | ||
41 | } | ||
42 | }, | ||
43 | |||
16 | elementName: { | 44 | elementName: { |
17 | value: null | 45 | value: null |
18 | }, | 46 | }, |
@@ -46,9 +74,8 @@ exports.Properties = Montage.create(Component, { | |||
46 | 74 | ||
47 | prepareForDraw: { | 75 | prepareForDraw: { |
48 | value : function() { | 76 | value : function() { |
49 | this.eventManager.addEventListener("openDocument", this, false); | 77 | this.eventManager.addEventListener("elementChange", this, false); |
50 | this.eventManager.addEventListener("selectionChange", this, false); | 78 | this.eventManager.addEventListener("selectionChange", this, false); |
51 | this.eventManager.addEventListener("closeDocument", this, false); | ||
52 | 79 | ||
53 | // This will be a toggle option | 80 | // This will be a toggle option |
54 | if(this.application.ninja.appData.PILiveUpdate) { | 81 | if(this.application.ninja.appData.PILiveUpdate) { |
@@ -65,24 +92,6 @@ exports.Properties = Montage.create(Component, { | |||
65 | } | 92 | } |
66 | }, | 93 | }, |
67 | 94 | ||
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 | /** | 95 | /** |
87 | * Blur and Key up to handle change in the Element ID field. | 96 | * Blur and Key up to handle change in the Element ID field. |
88 | */ | 97 | */ |