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