From 8974ecd564563a991ff96f9cb6d47da172174242 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 22 Feb 2012 00:49:47 -0800 Subject: local storage integration and versioning - Fixed the splitters Signed-off-by: Valerio Virgillito --- js/panels/Splitter.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index 9f5b4de7..cb05104d 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js @@ -9,6 +9,10 @@ var Component = require("montage/ui/component").Component; exports.Splitter = Montage.create(Component, { + version: { + value: "1.0" + }, + hasTemplate: { value: false }, @@ -49,19 +53,23 @@ exports.Splitter = Montage.create(Component, { get: function() { return this._collapsed; }, - set: function(value) - { + set: function(value) { this._collapsed = value; - this.application.ninja.settings.setSetting(this.element.id, "collapsed", this.collapsed); + + this.application.localStorage._setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value}); } }, prepareForDraw: { value: function() { - //Get Setting from SettingManager - this.application.ninja.settings.getSetting(this.element.id, "collapsed"); - lapsed = false; - if (lapsed != null) this._collapsed = lapsed; + //Get splitter initial value from SettingManager + var storedData = this.application.localStorage._getItem(this.element.getAttribute("data-montage-id")); + if(storedData && this.element.getAttribute("data-montage-id") !== null) { + this._collapsed = storedData.value; + } else { + this._collapsed = false; + } + this.element.addEventListener("click", this, false); } }, -- cgit v1.2.3 From 2b672f6508a849b8023b0bc114ad15e9ddca5adc Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 24 Feb 2012 13:27:04 -0800 Subject: prefixing the local storage and using the new local-storage object. Signed-off-by: Valerio Virgillito --- js/panels/presets/content.reel/content.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/panels') diff --git a/js/panels/presets/content.reel/content.js b/js/panels/presets/content.reel/content.js index c43c593c..1ede7246 100644 --- a/js/panels/presets/content.reel/content.js +++ b/js/panels/presets/content.reel/content.js @@ -16,7 +16,7 @@ exports.content = Montage.create(Component, { }, templateDidLoad : { value: function() { - var storedTabIndex = window.localStorage.presetsTabIndex; + var storedTabIndex = this.application.localStorage.getItem("presetsTabIndex"); if(storedTabIndex) { this.activeTabIndex = storedTabIndex; } @@ -50,7 +50,7 @@ exports.content = Montage.create(Component, { }, set: function(tabObject) { this.contentPanel = tabObject.key; - window.localStorage.presetsTabIndex = this.tabs.indexOf(tabObject); + this.application.localStorage.setItem("presetsTabIndex", this.tabs.indexOf(tabObject)); this._tabToDeactivate = this._activeTab; this._activeTab = tabObject; -- cgit v1.2.3 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 --- .../CSSPanel/CSSPanelBase.reel/CSSPanelBase.html | 2 +- js/panels/Panel.reel/Panel.html | 9 ++++++++- js/panels/Panel.reel/Panel.js | 4 +++- js/panels/PanelBase.js | 23 +++++++++++++++++----- .../PanelContainer.reel/PanelContainer.js | 8 +++++--- js/panels/Resizer.js | 14 +++++++++---- js/panels/Splitter.js | 4 ++-- .../Timeline/TimelinePanel.reel/TimelinePanel.html | 2 +- 8 files changed, 48 insertions(+), 18 deletions(-) (limited to 'js/panels') diff --git a/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.html b/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.html index db630934..98b2b61d 100755 --- a/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.html +++ b/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.html @@ -53,7 +53,7 @@ -
+

diff --git a/js/panels/Panel.reel/Panel.html b/js/panels/Panel.reel/Panel.html index dc76d871..46c8fb91 100755 --- a/js/panels/Panel.reel/Panel.html +++ b/js/panels/Panel.reel/Panel.html @@ -15,6 +15,13 @@ "element": {"#": "resizeBar"}, "panel": {"#": "panel"}, "isVertical": true + }, + "bindings": { + "ownerId": { + "boundObject": {"@": "owner"}, + "boundObjectPropertyPath": "panelBase.panelName", + "oneway": true + } } }, @@ -55,7 +62,7 @@ -
+
diff --git a/js/panels/Panel.reel/Panel.js b/js/panels/Panel.reel/Panel.js index efa287c5..c8dd0456 100755 --- a/js/panels/Panel.reel/Panel.js +++ b/js/panels/Panel.reel/Panel.js @@ -188,6 +188,8 @@ exports.Panel = Montage.create(Component, { //Resized Event if(typeof this.resizer.value == "number") this.panelBase.contentHeight = this.resizer.value; this.resizer.element.addEventListener("mouseup",this.resized.bind(this),false); + + this.panelContent.content = this.panelBase.content; } } }, @@ -226,7 +228,7 @@ exports.Panel = Montage.create(Component, { else pContentDiv.style.overflow = "hidden"; this.element.getElementsByClassName("panelTitle")[0].innerHTML = this.panelBase.panelName; //pContentDiv.appendChild(this.panelBase.content); - this.panelContent.content = this.panelBase.content; + //this.panelContent.content = this.panelBase.content; } } diff --git a/js/panels/PanelBase.js b/js/panels/PanelBase.js index b7b6945c..03dcd0ee 100755 --- a/js/panels/PanelBase.js +++ b/js/panels/PanelBase.js @@ -32,11 +32,14 @@ exports.PanelBase = Montage.create(Component, { contentHeight: { get: function() { if(this._contentHeight == null) { + // Old settings + /* if(this.application.ninja.settings.getSetting(this.panelName, "contentHeight")) { this._contentHeight = this.application.ninja.settings.getSetting(this.panelName, "contentHeight"); } else { this._contentHeight = this.defaultHeight; - } + }*/ + this._contentHeight = this.defaultHeight; } return this._contentHeight; }, @@ -44,50 +47,60 @@ exports.PanelBase = Montage.create(Component, { if (this.minHeight > value) value = this._minHeight; if (this.maxHeight != null) if(this.maxHeight < value) value = this.maxHeight; this._contentHeight = value; - this.application.ninja.settings.setSetting(this.panelName, "contentHeight", value); +// this.application.ninja.settings.setSetting(this.panelName, "contentHeight", value); } }, forcedCollapse: { get: function() { if(this._forcedCollapse == null) { + /* if(this.application.Ninja.SettingsManager.getSetting(this.panelName, "isPanelForceCollapsed")) { this._forcedCollapse = this.application.Ninja.SettingsManager.getSetting(this.panelName, "isPanelForceCollapsed"); } else { this._forcedCollapse = false; } + */ + this._forcedCollapse = false; } return this._forcedCollapse; }, set: function(value) { this._forcedCollapse = value; - this.application.Ninja.SettingsManager.setSetting(this.panelName, "isPanelForceCollapsed", value); + //this.application.Ninja.SettingsManager.setSetting(this.panelName, "isPanelForceCollapsed", value); } }, collapsed: { get: function() { if(this._collapsed == null) { + /* if(this.application.ninja.settings.getSetting(this.panelName, "isPanelCollapsed")) { this._collapsed = this.application.ninja.settings.getSetting(this.panelName, "isPanelCollapsed"); } else { this._collapsed = false; } + */ + this._collapsed = false; } return this._collapsed; }, set: function(value) { this._collapsed = value; - this.application.ninja.settings.setSetting(this.panelName, "isPanelCollapsed", value); + //this.application.ninja.settings.setSetting(this.panelName, "isPanelCollapsed", value); } }, visible: { get: function() { if(this._visible === null) { + /* if(typeof(this.application.ninja.settings.getSetting(this.panelName, "visible")) !== "undefined") { this._visible = this.application.ninja.settings.getSetting(this.panelName, "visible"); } else { this._visible = true; } + */ + this._visible = true; + } return this._visible; @@ -95,7 +108,7 @@ exports.PanelBase = Montage.create(Component, { set: function(value) { this._visible = value; - this.application.ninja.settings.setSetting(this.panelName, "visible", value); + //this.application.ninja.settings.setSetting(this.panelName, "visible", value); } } diff --git a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js index b8223471..bdd112c6 100755 --- a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js @@ -63,14 +63,16 @@ exports.PanelContainer = Montage.create(Component, { value: function() { //Panels Loading this.lastOffset = this.element.offsetHeight; + /* if( this.application.ninja.settings.getSetting(this.element.id, "panelOrder") != null) { this.initPanelOrder = this.application.ninja.settings.getSetting(this.element.id, "panelOrder") } + */ // if Panels already loaded no need to load again. for(var i = 0; i < this.initPanelOrder.length; i++) { this.addPanel(eval(this.initPanelOrder[i])); this.panelOrder.push(this.initPanelOrder[i]); - this.application.ninja.settings.setSetting(this.element.id, "panelOrder", this.panelOrder); +// this.application.ninja.settings.setSetting(this.element.id, "panelOrder", this.panelOrder); } var hideSplitter = true; @@ -221,7 +223,7 @@ exports.PanelContainer = Montage.create(Component, { } minHeights -= this._panels[lastPanel].minHeight - this._collapsedHeight; this._panels[lastPanel].collapsed = true; - this.repeater.childComponents[lastPanel].needsDraw = true; + //this.repeater.childComponents[lastPanel].needsDraw = true; } @@ -329,7 +331,7 @@ exports.PanelContainer = Montage.create(Component, { this._panels.splice(overed,0, panelRemoved[0]); var panelOrderRemoved = this.panelOrder.splice(selected,1); this.panelOrder.splice(overed,0, panelOrderRemoved[0]); - this.application.ninja.settings.setSetting(this.element.id, "panelOrder", this.panelOrder); + //this.application.ninja.settings.setSetting(this.element.id, "panelOrder", this.panelOrder); } } }, 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) { diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index cb05104d..3215e928 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js @@ -56,14 +56,14 @@ exports.Splitter = Montage.create(Component, { set: function(value) { this._collapsed = value; - this.application.localStorage._setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value}); + this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value}); } }, prepareForDraw: { value: function() { //Get splitter initial value from SettingManager - var storedData = this.application.localStorage._getItem(this.element.getAttribute("data-montage-id")); + var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")); if(storedData && this.element.getAttribute("data-montage-id") !== null) { this._collapsed = storedData.value; } else { diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html index 0c302436..0fd5b05d 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html @@ -264,7 +264,7 @@ -
+
-- 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/Panel.reel/Panel.html | 3 +- js/panels/PanelBase.js | 40 +++++------- .../PanelContainer.reel/PanelContainer.js | 8 ++- js/panels/Resizer.js | 76 +++++++++++++--------- 4 files changed, 70 insertions(+), 57 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Panel.reel/Panel.html b/js/panels/Panel.reel/Panel.html index 46c8fb91..7556952c 100755 --- a/js/panels/Panel.reel/Panel.html +++ b/js/panels/Panel.reel/Panel.html @@ -14,7 +14,8 @@ "properties": { "element": {"#": "resizeBar"}, "panel": {"#": "panel"}, - "isVertical": true + "isVertical": true, + "willSave": false }, "bindings": { "ownerId": { diff --git a/js/panels/PanelBase.js b/js/panels/PanelBase.js index 03dcd0ee..473de596 100755 --- a/js/panels/PanelBase.js +++ b/js/panels/PanelBase.js @@ -36,56 +36,55 @@ exports.PanelBase = Montage.create(Component, { /* if(this.application.ninja.settings.getSetting(this.panelName, "contentHeight")) { this._contentHeight = this.application.ninja.settings.getSetting(this.panelName, "contentHeight"); - } else { - this._contentHeight = this.defaultHeight; - }*/ + } */ + this._contentHeight = this.defaultHeight; } return this._contentHeight; }, set: function(value) { - if (this.minHeight > value) value = this._minHeight; - if (this.maxHeight != null) if(this.maxHeight < value) value = this.maxHeight; + if (this.minHeight > value) value = this._minHeight; + if (this.maxHeight != null) if(this.maxHeight < value) value = this.maxHeight; this._contentHeight = value; -// this.application.ninja.settings.setSetting(this.panelName, "contentHeight", value); + + // this.application.ninja.settings.setSetting(this.panelName, "contentHeight", value); } }, forcedCollapse: { get: function() { if(this._forcedCollapse == null) { + // Old settings /* if(this.application.Ninja.SettingsManager.getSetting(this.panelName, "isPanelForceCollapsed")) { this._forcedCollapse = this.application.Ninja.SettingsManager.getSetting(this.panelName, "isPanelForceCollapsed"); - } else { - this._forcedCollapse = false; - } - */ + } */ this._forcedCollapse = false; } return this._forcedCollapse; }, set: function(value) { this._forcedCollapse = value; - //this.application.Ninja.SettingsManager.setSetting(this.panelName, "isPanelForceCollapsed", value); + + // this.application.Ninja.SettingsManager.setSetting(this.panelName, "isPanelForceCollapsed", value); } }, collapsed: { get: function() { if(this._collapsed == null) { + // Old settings /* if(this.application.ninja.settings.getSetting(this.panelName, "isPanelCollapsed")) { this._collapsed = this.application.ninja.settings.getSetting(this.panelName, "isPanelCollapsed"); - } else { - this._collapsed = false; - } - */ + } */ + this._collapsed = false; } return this._collapsed; }, set: function(value) { this._collapsed = value; - //this.application.ninja.settings.setSetting(this.panelName, "isPanelCollapsed", value); + + // this.application.ninja.settings.setSetting(this.panelName, "isPanelCollapsed", value); } }, visible: { @@ -95,10 +94,8 @@ exports.PanelBase = Montage.create(Component, { /* if(typeof(this.application.ninja.settings.getSetting(this.panelName, "visible")) !== "undefined") { this._visible = this.application.ninja.settings.getSetting(this.panelName, "visible"); - } else { - this._visible = true; - } - */ + } */ + this._visible = true; } @@ -112,7 +109,4 @@ exports.PanelBase = Montage.create(Component, { } } - - // Methods exist in panel.js - }); diff --git a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js index bdd112c6..3cbd4369 100755 --- a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js @@ -63,16 +63,19 @@ exports.PanelContainer = Montage.create(Component, { value: function() { //Panels Loading this.lastOffset = this.element.offsetHeight; - /* + + /* Old Settings if( this.application.ninja.settings.getSetting(this.element.id, "panelOrder") != null) { this.initPanelOrder = this.application.ninja.settings.getSetting(this.element.id, "panelOrder") } */ + // if Panels already loaded no need to load again. for(var i = 0; i < this.initPanelOrder.length; i++) { this.addPanel(eval(this.initPanelOrder[i])); this.panelOrder.push(this.initPanelOrder[i]); -// this.application.ninja.settings.setSetting(this.element.id, "panelOrder", this.panelOrder); + +// this.application.ninja.settings.setSetting(this.element.id, "panelOrder", this.panelOrder); } var hideSplitter = true; @@ -331,6 +334,7 @@ exports.PanelContainer = Montage.create(Component, { this._panels.splice(overed,0, panelRemoved[0]); var panelOrderRemoved = this.panelOrder.splice(selected,1); this.panelOrder.splice(overed,0, panelOrderRemoved[0]); + //this.application.ninja.settings.setSetting(this.element.id, "panelOrder", this.panelOrder); } } 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 From fb8aacbadba8dffb9619eb16e4626c197dc9264d Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Mon, 27 Feb 2012 10:23:05 -0800 Subject: Timeline : Selection Fix Signed-off-by: Kruti Shah Signed-off-by: Jonathan Duran --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 2143dafd..797a7cbf 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -230,8 +230,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { { this._openDoc=true; NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]}) -// this.selectLayer(myIndex); -// TimelineTrack.retrieveStoredTweens(); myIndex++; } }else{ @@ -488,7 +486,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if(this._openDoc){ event.detail.ele.uuid =nj.generateRandom(); thingToPush.elementsList.push(event.detail.ele); - this._openDoc=false; } newTrack.trackID = this.currentLayerNumber; @@ -534,6 +531,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.selectLayer(0); } + + if(this._openDoc){ + this.hashElementMapToLayer.setItem(event.detail.ele.uuid, event.detail.ele,this.currentLayerSelected); + this._openDoc=false; + } this._LayerUndoObject = thingToPush; this._LayerUndoIndex = thingToPush.layerID; this._LayerUndoStatus = true; @@ -733,6 +735,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } } hashLayerObject[key][index] = value; + console.log(hashLayerObject) this.counter = 0; } }, @@ -827,6 +830,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } this.mappingArray[key]["ele"] = value; this.mappingArray[key].layerID = layer.layerID; + console.log(this.mappingArray) } }, @@ -863,6 +867,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.trackRepetition.selectedIndexes = [layerIndex]; this.currentLayerSelected = this.arrLayers[layerIndex]; this.currentTrackSelected = this.arrTracks[layerIndex]; + if(this._captureSelection){ + this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList) + } + this._captureSelection = true; } else { this.layerRepetition.selectedIndexes = null; this.trackRepetition.selectedIndexes = null; -- cgit v1.2.3 From 125723cf19cf70121bc694909d09a301ca2fc2d6 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Mon, 27 Feb 2012 11:40:52 -0800 Subject: Timeline: RetrieveStoredTweens calling fixed Signed-off-by: Kruti Shah Signed-off-by: Jonathan Duran --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 19 ++-- .../Timeline/TimelineTrack.reel/TimelineTrack.js | 121 +++++++++++---------- 2 files changed, 71 insertions(+), 69 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 797a7cbf..92bb3405 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -224,13 +224,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this._hashKey = "123"; _firstLayerDraw = false; - if(this.application.ninja.currentDocument.documentRoot.children[0]){ - myIndex=0; - while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) - { - this._openDoc=true; - NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]}) - myIndex++; + if(!this.application.ninja.documentController.creatingNewFile){ + if(this.application.ninja.currentDocument.documentRoot.children[0]){ + myIndex=0; + while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) + { + this._openDoc=true; + NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]}) + myIndex++; + } } }else{ NJevent('newLayer', this._hashKey); @@ -476,6 +478,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { thingToPush.elementsList = []; thingToPush.deleted = false; thingToPush.isSelected = false; + thingToPush.created=false; if (_firstLayerDraw) { this.application.ninja.currentSelectedContainer.uuid=this._hashKey; @@ -735,7 +738,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } } hashLayerObject[key][index] = value; - console.log(hashLayerObject) this.counter = 0; } }, @@ -830,7 +832,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } this.mappingArray[key]["ele"] = value; this.mappingArray[key].layerID = layer.layerID; - console.log(this.mappingArray) } }, diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index a36e666b..55c84dce 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -331,10 +331,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { _styleCollapser:{ value:null }, - _openDocRedrawCheck:{ - value:true, - writable:true - }, prepareForDraw:{ value:function () { this.init(); @@ -364,10 +360,12 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { didDraw:{ value:function () { - if(this.application.ninja.currentDocument.documentRoot.children[0]){ - if (this._openDocRedrawCheck) { - this.retrieveStoredTweens(); - this._openDocRedrawCheck = false; + if(!this.application.ninja.documentController.creatingNewFile){ + if(this.application.ninja.currentDocument.documentRoot.children[0]){ + var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); + if(!this.application.ninja.timeline.arrLayers[selectedIndex].created){ + this.retrieveStoredTweens(); + } } } } @@ -465,60 +463,63 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { var percentValue, fraction, splitValue,offsetAttribute,topOffSetAttribute,leftOffsetAttribute, i = 0; var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); + this.application.ninja.timeline.arrLayers[selectedIndex].created=true; this.animatedElement = this.application.ninja.timeline.arrLayers[selectedIndex].elementsList[0]; - this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); - this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); - if(this.animationDuration){ - this.trackDuration = this.animationDuration.split("s"); - this.currentMilliSec = this.trackDuration[0] * 1000; - this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); - this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; - this.nextKeyframe = 0; - - this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document); - while (this.currentKeyframeRule[i]) { - var newTween = {}; - - offsetAttribute = this.currentKeyframeRule[i].cssText.split(" "); - topOffSetAttribute = offsetAttribute[3].split("px"); - leftOffsetAttribute = offsetAttribute[5].split("px"); - - parseInt(topOffSetAttribute[0]); - parseInt(leftOffsetAttribute[0]); - - if (this.currentKeyframeRule[i].keyText === "0%") { - newTween.spanWidth = 0; - newTween.keyFramePosition = 0; - newTween.keyFrameMillisec = 0; - newTween.tweenID = 0; - newTween.spanPosition = 0; - newTween.tweenedProperties = []; - newTween.tweenedProperties["top"] = topOffSetAttribute[0]; - newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; - this.tweens.push(newTween); - - } - else { - percentValue = this.currentKeyframeRule[i].keyText; - splitValue = percentValue.split("%"); - fraction = splitValue[0] / 100; - this.currentMilliSec = fraction * this.trackDuration[0] * 1000; - this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); - this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; - newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition; - newTween.keyFramePosition = this.clickPos; - newTween.keyFrameMillisec = this.currentMilliSec; - newTween.tweenID = this.nextKeyframe; - newTween.spanPosition = this.clickPos - newTween.spanWidth; - newTween.tweenedProperties=[]; - newTween.tweenedProperties["top"] = topOffSetAttribute[0]; - newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; - this.tweens.push(newTween); - - + if(this.animatedElement!==undefined){ + this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); + if(this.animationName){ + this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); + this.trackDuration = this.animationDuration.split("s"); + this.currentMilliSec = this.trackDuration[0] * 1000; + this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); + this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; + this.nextKeyframe = 0; + + this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document); + while (this.currentKeyframeRule[i]) { + var newTween = {}; + + offsetAttribute = this.currentKeyframeRule[i].cssText.split(" "); + topOffSetAttribute = offsetAttribute[3].split("px"); + leftOffsetAttribute = offsetAttribute[5].split("px"); + + parseInt(topOffSetAttribute[0]); + parseInt(leftOffsetAttribute[0]); + + if (this.currentKeyframeRule[i].keyText === "0%") { + newTween.spanWidth = 0; + newTween.keyFramePosition = 0; + newTween.keyFrameMillisec = 0; + newTween.tweenID = 0; + newTween.spanPosition = 0; + newTween.tweenedProperties = []; + newTween.tweenedProperties["top"] = topOffSetAttribute[0]; + newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; + this.tweens.push(newTween); + + } + else { + percentValue = this.currentKeyframeRule[i].keyText; + splitValue = percentValue.split("%"); + fraction = splitValue[0] / 100; + this.currentMilliSec = fraction * this.trackDuration[0] * 1000; + this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); + this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; + newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition; + newTween.keyFramePosition = this.clickPos; + newTween.keyFrameMillisec = this.currentMilliSec; + newTween.tweenID = this.nextKeyframe; + newTween.spanPosition = this.clickPos - newTween.spanWidth; + newTween.tweenedProperties=[]; + newTween.tweenedProperties["top"] = topOffSetAttribute[0]; + newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; + this.tweens.push(newTween); + + + } + i++; + this.nextKeyframe += 1; } - i++; - this.nextKeyframe += 1; } } else{ -- cgit v1.2.3 From cf9e9b711ba3d77a2a0888f8ab763383f53a1619 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Mon, 27 Feb 2012 11:49:34 -0800 Subject: Timeline : Reopening Doc has layer 1 default fix Signed-off-by: Kruti Shah Signed-off-by: Jonathan Duran --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/panels') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 92bb3405..d7d5328e 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -234,6 +234,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { myIndex++; } } + else{ + NJevent('newLayer', this._hashKey); + this.selectLayer(0); + } }else{ NJevent('newLayer', this._hashKey); this.selectLayer(0); -- cgit v1.2.3