aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Resizer.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-24 14:43:51 -0800
committerValerio Virgillito2012-02-24 14:44:02 -0800
commit72baf1c366829ada6858097dd7553ee9988d6110 (patch)
treee43790b3a45587b998be5ee897451dec8c29f564 /js/panels/Resizer.js
parentf97080989ee988c1e613915c2d246dc17b104b3b (diff)
downloadninja-72baf1c366829ada6858097dd7553ee9988d6110.tar.gz
removing the old settings class and disabling panel settings until the new panels are in
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/panels/Resizer.js')
-rwxr-xr-xjs/panels/Resizer.js76
1 files changed, 45 insertions, 31 deletions
diff --git a/js/panels/Resizer.js b/js/panels/Resizer.js
index e9bd4fc0..60fdde4f 100755
--- a/js/panels/Resizer.js
+++ b/js/panels/Resizer.js
@@ -8,15 +8,42 @@ var Montage = require("montage/core/core").Montage;
8var Component = require("montage/ui/component").Component; 8var Component = require("montage/ui/component").Component;
9 9
10exports.Resizer = Montage.create(Component, { 10exports.Resizer = Montage.create(Component, {
11 11
12 version: {
13 value: "1.0"
14 },
15
12 hasTemplate: { 16 hasTemplate: {
13 value: false 17 value: false
14 }, 18 },
15 19
20 // This property might not be needed anymore.
21 // TODO - Review this once we the the new panels in place
16 ownerId: { 22 ownerId: {
17 value: "" 23 value: ""
18 }, 24 },
19 25
26 willSave: {
27 value: true
28 },
29
30 _value: {
31 value: null
32 },
33
34 value: {
35 get: function() {
36 return this._value;
37 },
38 set: function(val) {
39 this._value = val;
40 }
41 },
42
43 redrawStage: {
44 value:false
45 },
46
20 _isInversed: { 47 _isInversed: {
21 value: false 48 value: false
22 }, 49 },
@@ -101,7 +128,8 @@ exports.Resizer = Montage.create(Component, {
101 } else { 128 } else {
102 this.panel.style.width = ""; 129 this.panel.style.width = "";
103 } 130 }
104// this.application.ninja.settings.setSetting(this.element.id,"value", ""); 131
132 this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": ""});
105 } 133 }
106 }, 134 },
107 135
@@ -116,8 +144,15 @@ exports.Resizer = Montage.create(Component, {
116 144
117 prepareForDraw: { 145 prepareForDraw: {
118 value: function() { 146 value: function() {
119// console.log("owner id: ", this.ownerId); 147 if(this.willSave) {
120 console.log("resizer for ", this.element.getAttribute("data-montage-id") + this.ownerId); 148 var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id"));
149
150 if(storedData && storedData.value) {
151 this.value = storedData.value;
152 }
153
154 }
155
121 if(this.value != null) { 156 if(this.value != null) {
122 if (this.isVertical) { 157 if (this.isVertical) {
123 this.panel.style.height = this.value + "px"; 158 this.panel.style.height = this.value + "px";
@@ -142,15 +177,19 @@ exports.Resizer = Montage.create(Component, {
142 window.removeEventListener("mousemove", this); 177 window.removeEventListener("mousemove", this);
143 window.removeEventListener("mouseup", this); 178 window.removeEventListener("mouseup", this);
144 this.panel.classList.remove("disableTransition"); 179 this.panel.classList.remove("disableTransition");
180
145 if (this.isVertical) { 181 if (this.isVertical) {
146 this.panel.style.height = this.panel.offsetHeight; 182 this.panel.style.height = this.panel.offsetHeight;
147 } else { 183 } else {
148 this.panel.style.width = this.panel.offsetWidth; 184 this.panel.style.width = this.panel.offsetWidth;
149 } 185 }
150// this.application.ninja.settings.setSetting(this.element.id,"value", this.value); 186
187 this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": this.value});
188
151 if(this.redrawStage) { 189 if(this.redrawStage) {
152 this.application.ninja.stage.resizeCanvases = true; 190 this.application.ninja.stage.resizeCanvases = true;
153 } 191 }
192
154 NJevent("panelResizedEnd", this) 193 NJevent("panelResizedEnd", this)
155 } 194 }
156 }, 195 },
@@ -176,30 +215,5 @@ exports.Resizer = Montage.create(Component, {
176 215
177 NJevent("panelResizing", this); 216 NJevent("panelResizing", this);
178 } 217 }
179 },
180
181 _value: {
182 value: null
183 },
184
185 redrawStage: {
186 value:false
187 },
188
189 value: {
190 get: function() {
191 /*
192 if(this.application.ninja.settings) {
193 var gottenValue = this.application.ninja.settings.getSetting(this.id, "value");
194 if (this._value == null && gottenValue !=null) {
195 this.value = gottenValue;
196 }
197 }
198 */
199 return this._value;
200 },
201 set: function(val) {
202 this._value = val;
203 }
204 } 218 }
205}); \ No newline at end of file 219}); \ No newline at end of file