From f97080989ee988c1e613915c2d246dc17b104b3b Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 24 Feb 2012 13:27:33 -0800 Subject: clearing the old local setting and using the new version/prefix local settings. Signed-off-by: Valerio Virgillito --- js/panels/Resizer.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'js/panels/Resizer.js') diff --git a/js/panels/Resizer.js b/js/panels/Resizer.js index 3afe5d5b..e9bd4fc0 100755 --- a/js/panels/Resizer.js +++ b/js/panels/Resizer.js @@ -12,6 +12,10 @@ exports.Resizer = Montage.create(Component, { hasTemplate: { value: false }, + + ownerId: { + value: "" + }, _isInversed: { value: false @@ -74,7 +78,6 @@ exports.Resizer = Montage.create(Component, { e.preventDefault(); this.panel.addEventListener("webkitTransitionEnd", this, true); if (this.isVertical) { - //console.log("y: " + e.y + " startPosition: " + this._startPosition + " initDimension: " + this._initDimension); this._startPosition = e.y; this._initDimension = this.panel.offsetHeight; } @@ -98,7 +101,7 @@ exports.Resizer = Montage.create(Component, { } else { this.panel.style.width = ""; } - this.application.ninja.settings.setSetting(this.element.id,"value", ""); +// this.application.ninja.settings.setSetting(this.element.id,"value", ""); } }, @@ -113,6 +116,8 @@ exports.Resizer = Montage.create(Component, { prepareForDraw: { value: function() { +// console.log("owner id: ", this.ownerId); + console.log("resizer for ", this.element.getAttribute("data-montage-id") + this.ownerId); if(this.value != null) { if (this.isVertical) { this.panel.style.height = this.value + "px"; @@ -142,7 +147,7 @@ exports.Resizer = Montage.create(Component, { } else { this.panel.style.width = this.panel.offsetWidth; } - this.application.ninja.settings.setSetting(this.element.id,"value", this.value); +// this.application.ninja.settings.setSetting(this.element.id,"value", this.value); if(this.redrawStage) { this.application.ninja.stage.resizeCanvases = true; } @@ -154,7 +159,6 @@ exports.Resizer = Montage.create(Component, { value: function(e) { if(this.isVertical) { this.value = this._isInversed ? this._initDimension + (this._startPosition - e.y) : this._initDimension + (e.y - this._startPosition); - //console.log("y: " + e.y + " startPosition: " + this._startPosition + " initDimension: " + this._initDimension + " finalPosition: " + pos); this.panel.style.height = this.value + "px"; } else { @@ -184,12 +188,14 @@ exports.Resizer = Montage.create(Component, { value: { get: function() { + /* if(this.application.ninja.settings) { var gottenValue = this.application.ninja.settings.getSetting(this.id, "value"); if (this._value == null && gottenValue !=null) { this.value = gottenValue; } } + */ return this._value; }, set: function(val) { -- cgit v1.2.3 From 72baf1c366829ada6858097dd7553ee9988d6110 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 24 Feb 2012 14:43:51 -0800 Subject: removing the old settings class and disabling panel settings until the new panels are in Signed-off-by: Valerio Virgillito --- js/panels/Resizer.js | 76 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 31 deletions(-) (limited to 'js/panels/Resizer.js') 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; var Component = require("montage/ui/component").Component; exports.Resizer = Montage.create(Component, { - + + version: { + value: "1.0" + }, + hasTemplate: { value: false }, + // This property might not be needed anymore. + // TODO - Review this once we the the new panels in place ownerId: { value: "" }, - + + willSave: { + value: true + }, + + _value: { + value: null + }, + + value: { + get: function() { + return this._value; + }, + set: function(val) { + this._value = val; + } + }, + + redrawStage: { + value:false + }, + _isInversed: { value: false }, @@ -101,7 +128,8 @@ exports.Resizer = Montage.create(Component, { } else { this.panel.style.width = ""; } -// this.application.ninja.settings.setSetting(this.element.id,"value", ""); + + this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": ""}); } }, @@ -116,8 +144,15 @@ exports.Resizer = Montage.create(Component, { prepareForDraw: { value: function() { -// console.log("owner id: ", this.ownerId); - console.log("resizer for ", this.element.getAttribute("data-montage-id") + this.ownerId); + if(this.willSave) { + var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")); + + if(storedData && storedData.value) { + this.value = storedData.value; + } + + } + if(this.value != null) { if (this.isVertical) { this.panel.style.height = this.value + "px"; @@ -142,15 +177,19 @@ exports.Resizer = Montage.create(Component, { window.removeEventListener("mousemove", this); window.removeEventListener("mouseup", this); this.panel.classList.remove("disableTransition"); + if (this.isVertical) { this.panel.style.height = this.panel.offsetHeight; } else { this.panel.style.width = this.panel.offsetWidth; } -// this.application.ninja.settings.setSetting(this.element.id,"value", this.value); + + this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": this.value}); + if(this.redrawStage) { this.application.ninja.stage.resizeCanvases = true; } + NJevent("panelResizedEnd", this) } }, @@ -176,30 +215,5 @@ exports.Resizer = Montage.create(Component, { NJevent("panelResizing", this); } - }, - - _value: { - value: null - }, - - redrawStage: { - value:false - }, - - value: { - get: function() { - /* - if(this.application.ninja.settings) { - var gottenValue = this.application.ninja.settings.getSetting(this.id, "value"); - if (this._value == null && gottenValue !=null) { - this.value = gottenValue; - } - } - */ - return this._value; - }, - set: function(val) { - this._value = val; - } } }); \ No newline at end of file -- cgit v1.2.3