From 99d50a7dc1403d1d918a8e4a6f7876c559d5e3a9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 21 Jun 2012 17:34:37 -0700 Subject: Reclaim negative padding when moving items back into positive direction. Note that we only do this on elementChange and not elementChanging since it is a potentially slow routine. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 42 +++++++++++++++++++++++++++++--------- js/stage/stage.reel/stage.js | 4 ++++ 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 8ddd0d52..42b759b5 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -73,6 +73,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { // Properties that require element planes to be updated _updatePlaneProps : {value: ["matrix", "left", "top", "width", "height"], writable: false }, + _recalculateScrollOffsets : { value: false }, /////////////////////////////////////////////////////////////////////// // Property accessors @@ -117,7 +118,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { }, initializeFromDocument:{ - value:function(adjustScrollOffsets){ + value:function(adjustScrollOffsets, useStageValues){ var i, documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true), stage = this.application.ninja.stage, @@ -141,6 +142,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { t, plane, elt; + if(useStageValues) { + initL = stage.userPaddingLeft; + initT = stage.userPaddingTop; + this._recalculateScrollOffsets = false; + } for(i=0; i minLeft)) { + this._recalculateScrollOffsets = true; } + if(t < minTop) { minTop = t; + stage.minTopElement = elt; + } else if((elt === stage.minTopElement) && (t > minTop)) { + this._recalculateScrollOffsets = true; } } } } if(adjustStagePadding) { - if(minLeft !== stage.userPaddingLeft) { - stage.userPaddingLeft = minLeft; - changed = true; - } - if(minTop !== stage.userPaddingTop) { - stage.userPaddingTop = minTop; + if(this._recalculateScrollOffsets && !isChanging) { + this.initializeFromDocument(true, true); changed = true; + } else { + if(minLeft !== stage.userPaddingLeft) { + stage.userPaddingLeft = minLeft; + changed = true; + } + if(minTop !== stage.userPaddingTop) { + stage.userPaddingTop = minTop; + changed = true; + } } } diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index fce73882..3552935d 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -279,6 +279,10 @@ exports.Stage = Montage.create(Component, { _userPaddingLeft: { value: 0 }, _userPaddingTop: { value: 0 }, + // keep track of the elements that determine the minimum left and top scrollable amount + minLeftElement: { value: null }, + minTopElement: { value: null }, + userPaddingLeft: { get: function() { return this._userPaddingLeft; }, set: function(value) { -- cgit v1.2.3 From 04f206173530b6efde16b934b1f959b255d18441 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Fri, 22 Jun 2012 01:33:58 -0700 Subject: FIx - can't delete keyframes F5 now deletes the selected keyframe Signed-off-by: Jonathan Duran --- js/mediators/keyboard-mediator.js | 7 ++- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 6 +-- .../Timeline/TimelineTrack.reel/TimelineTrack.js | 60 ++++++++++++++++++---- 3 files changed, 58 insertions(+), 15 deletions(-) diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index cce053bc..f0afff13 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -50,6 +50,7 @@ var Keyboard = exports.Keyboard = { X:88, Y:89, Z:90, + F5:116, F6:117, PLUS:187, MINUS:189 @@ -218,7 +219,11 @@ exports.KeyboardMediator = Montage.create(Component, { // F6 keyboard shortcut to add a keyframe to the timeline if (evt.keyCode == Keyboard.F6) { - this.application.ninja.timeline.handleKeyframeShortcut(); + this.application.ninja.timeline.handleKeyframeShortcut("insert"); + return; + } + if (evt.keyCode == Keyboard.F5) { + this.application.ninja.timeline.handleKeyframeShortcut("remove"); return; } diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 2cbd9e2b..1c023fdb 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -1034,17 +1034,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { }, handleKeyframeShortcut:{ - value:function(){ - //console.log(this.currentLayersSelected); - //console.log(this.trackRepetition); + value:function(action){ var tempEv = {}; tempEv.offsetX = this.playheadmarker.offsetLeft; + tempEv.actionType = action; if (typeof(this.trackRepetition.childComponents[this.currentLayersSelected[0]]) !== "undefined") { this.trackRepetition.childComponents[this.currentLayersSelected[0]].handleKeyboardShortcut(tempEv); } else { // oops, we do not have a layer selected. We should growl at the user. For now, this will fail silently. } - } }, diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index bf380e00..85fce1ec 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -702,17 +702,22 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { handleKeyboardShortcut:{ value:function(ev){ - if (this.tweens.length < 1) { - this.insertTween(0); - this.addAnimationRuleToElement(ev); - this.updateKeyframeRule(); - } else { - //this.handleNewTween(ev); - - // Split a tween! - this.splitTweenAt(this.application.ninja.timeline.playheadmarker.offsetLeft) - this.updateKeyframeRule(); + if(ev.actionType == "insert"){ + if (this.tweens.length < 1) { + this.insertTween(0); + this.addAnimationRuleToElement(ev); + this.updateKeyframeRule(); + } else { + this.handleNewTween(ev); + + // Split a tween! + //this.splitTweenAt(this.application.ninja.timeline.playheadmarker.offsetLeft); + this.updateKeyframeRule(); + } + } else if(ev.actionType == "remove"){ + this.removeTween(); } + } }, @@ -801,6 +806,41 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { } }, + removeTween:{ + value:function(){ + var tweenIDToRemove = this.application.ninja.timeline.selectedTweens[0].tweenID, + oldPosition = this.application.ninja.timeline.selectedTweens[0].spanPosition, + oldSpanWidth = this.application.ninja.timeline.selectedTweens[0].spanWidth; + + if(tweenIDToRemove == this.tweens[this.tweens.length-1].tweenData.tweenID){ + this.trackDuration = this.tweens[this.tweens.length-2].tweenData.keyFrameMillisec; + this.tweens.pop(); + return; + } + + // Update the next tween to have new span position and width. + this.tweens[tweenIDToRemove + 1].tweenData.spanPosition = oldPosition; + this.tweens[tweenIDToRemove + 1].spanPosition = oldPosition; + this.tweens[tweenIDToRemove + 1].tweenData.spanWidth = this.tweens[tweenIDToRemove + 1].tweenData.spanWidth + oldSpanWidth; + this.tweens[tweenIDToRemove + 1].spanWidth = this.tweens[tweenIDToRemove + 1].spanWidth + oldSpanWidth; + + // redraw the tweens + for(var i in this.tweenRepetition.childComponents){ + this.tweenRepetition.childComponents[i].setData(); + } + + // remove the selected tween + this.tweens.splice(tweenIDToRemove, 1); + this.application.ninja.currentDocument.model.needsSave = true; + + // update the tween ids + for (var j = 0; j < this.tweens.length; j++) { + this.tweens[j].tweenID = j; + this.tweens[j].tweenData.tweenID = j; + } + } + }, + createMatchingPositionSizeTween:{ value:function (newTween) { var i; -- cgit v1.2.3 From 7563c059270d08395f52d9349bbe4d9aa9d9b99f Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Fri, 22 Jun 2012 11:22:47 -0700 Subject: Timeline fix - remove unneeded binding Signed-off-by: Jonathan Duran --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 1c023fdb..53a3b299 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -869,12 +869,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false); this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false); - // Bind some bindings - Object.defineBinding(this, "currentSelectedContainer", { - boundObject:this.application.ninja, - boundObjectPropertyPath:"currentSelectedContainer", - oneway:true - }); this.addPropertyChangeListener("currentDocument.model.domContainer", this); // Start the panel out in disabled mode by default -- cgit v1.2.3 From 21edfc9a02df0ab4360d5eb41f9ef036500c681b Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Mon, 25 Jun 2012 08:12:21 -0700 Subject: Timeline Fix - reopen subprop keyframes for Position and Size correctly Signed-off-by: Jonathan Duran --- js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 85fce1ec..68ea928a 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -709,15 +709,12 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { this.updateKeyframeRule(); } else { this.handleNewTween(ev); - - // Split a tween! - //this.splitTweenAt(this.application.ninja.timeline.playheadmarker.offsetLeft); this.updateKeyframeRule(); } } else if(ev.actionType == "remove"){ this.removeTween(); + this.updateKeyframeRule(); } - } }, @@ -800,8 +797,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { this.createMatchingPositionSizeTween(newTween); } - - this.application.ninja.currentDocument.model.needsSave = true; } }, @@ -995,6 +990,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { newTween.tweenData.easing = "none"; } this.tweens.push(newTween); + this.createMatchingPositionSizeTween(newTween); } this.nextKeyframe += 1; } @@ -1022,8 +1018,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { value:function(ruleSet){ for(var i in ruleSet){ var styleProp = ruleSet[i][0].style[0]; - //console.log(styleProp); - //console.log(ruleSet[i]); this.application.ninja.timeline.layerRepetition.childComponents[0].addStyle(styleProp, ruleSet[i]); } } -- cgit v1.2.3 From 3b5e824faf4b7fa685498b45477cb85e9eec31a1 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 25 Jun 2012 09:47:11 -0700 Subject: When reclaiming stage's negative scroll padding, we need to use the template's left and top padding as the minimum values when switching between documents. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 2 ++ js/stage/stage.reel/stage.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 42b759b5..5d210d41 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -145,6 +145,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { if(useStageValues) { initL = stage.userPaddingLeft; initT = stage.userPaddingTop; + minLeft = stage.templateLeft; + minTop = stage.templateTop; this._recalculateScrollOffsets = false; } for(i=0; i this.documentOffsetLeft) { this.userPaddingLeft = -initialLeft; + this.templateLeft = -initialLeft; } if(initialTop > this.documentOffsetTop) { this.userPaddingTop = -initialTop; + this.templateTop = -initialTop; } } -- cgit v1.2.3 From 48bb94a72126e7be712b2c4ca9be2f03ecb65aea Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 25 Jun 2012 14:54:16 -0700 Subject: IKNinja-1688 - Creating a banner file after a code file causes body div to shift to the right and has different scroll bars. Signed-off-by: Nivesh Rajbhandari --- js/panels/Splitter.js | 8 ++++++-- js/stage/stage.reel/stage.js | 16 ++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index c6d46911..4f2a137e 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js @@ -156,7 +156,7 @@ exports.Splitter = Montage.create(Component, { } }, restore:{ - value: function() { + value: function(onSwitchFromCodeDocument) { //Get splitter initial value from SettingManager var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")), temp = this.collapsed; if(storedData && this.element.getAttribute("data-montage-id") !== null) { @@ -172,7 +172,11 @@ exports.Splitter = Montage.create(Component, { this.panel.addEventListener("webkitTransitionEnd", this, false); } this.disabled = false; - this.needsDraw = true; + if(onSwitchFromCodeDocument) { + this.draw(); // When switching from code document, draw immediately so stage size is correct + } else { + this.needsDraw = true; + } } } } diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 5e913c76..319ffe87 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -19,6 +19,7 @@ exports.Stage = Montage.create(Component, { // TODO - Need to figure out how to remove this dependency // Needed by some tools that depend on selectionDrawn event to set up some logic drawNow: { value : false }, + switchedFromCodeDoc: { value : false }, // TO REVIEW zoomFactor: {value : 1 }, @@ -256,6 +257,8 @@ exports.Stage = Montage.create(Component, { //call configure false with the old document on the selected tool to tear down down any temp. stuff this.application.ninja.toolsData.selectedToolInstance._configure(false); + } else if(this.currentDocument && (this.currentDocument.currentView === "code")) { + this.switchedFromCodeDoc = true; // Switching from code document affects stage's size and scrollbar } this._currentDocument = value; @@ -266,7 +269,8 @@ exports.Stage = Montage.create(Component, { drawUtils._eltArray.length = 0; drawUtils._planesArray.length = 0; } else if(this._currentDocument.currentView === "design") { - this.restoreAllPanels(); + this.restoreAllPanels(this.switchedFromCodeDoc); + this.switchedFromCodeDoc = false; this.hideCanvas(false); this.showRulers(); @@ -1271,11 +1275,11 @@ exports.Stage = Montage.create(Component, { } }, restoreAllPanels:{ - value:function(){ - this.application.ninja.panelSplitter.restore(); - this.application.ninja.timelineSplitter.restore(); - this.application.ninja.toolsSplitter.restore(); - this.application.ninja.optionsSplitter.restore(); + value:function(onSwitchDocument){ + this.application.ninja.panelSplitter.restore(onSwitchDocument); + this.application.ninja.timelineSplitter.restore(onSwitchDocument); + this.application.ninja.toolsSplitter.restore(onSwitchDocument); + this.application.ninja.optionsSplitter.restore(onSwitchDocument); } }, -- cgit v1.2.3 From 3b2c406210854a95c27660496f5aef1c1391c1e4 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 25 Jun 2012 16:02:04 -0700 Subject: Fix for Pan Tool not working when initially opening banner or animation template files. Also, fixed a case where the "stage" would become transparent due to rounding issues. Signed-off-by: Nivesh Rajbhandari --- js/tools/PanTool.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js index a8911c0c..fce8a7d7 100755 --- a/js/tools/PanTool.js +++ b/js/tools/PanTool.js @@ -47,8 +47,8 @@ exports.PanTool = Montage.create(toolBase, HandleLeftButtonDown: { value : function ( event ) { // Determine the maximum horizontal and vertical scroll values - this._maxHorizontalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollWidth - this.application.ninja.stage._canvas.width - 11; - this._maxVerticalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollHeight - this.application.ninja.stage._canvas.height - 11; + this._maxHorizontalScroll = this.application.ninja.currentDocument.model.views.design.document.body.scrollWidth - this.application.ninja.stage._canvas.width - 11; + this._maxVerticalScroll = this.application.ninja.currentDocument.model.views.design.document.body.scrollHeight - this.application.ninja.stage._canvas.height - 11; if((this._maxHorizontalScroll > 0) || (this._maxVerticalScroll > 0) || this._altKeyDown) { this._isDrawing = true; @@ -239,6 +239,8 @@ exports.PanTool = Montage.create(toolBase, this._localPt = [cop[0] + localPt[0], cop[1] + localPt[1], localPt[2]]; viewUtils.popViewportObj(); } + this._localPt[0] = Math.round(this._localPt[0]); + this._localPt[1] = Math.round(this._localPt[1]); this._globalPt = MathUtils.transformAndDivideHomogeneousPoint( this._localPt, localToGlobalMat ); var tmpLocal = MathUtils.transformAndDivideHomogeneousPoint( this._globalPt, globalToLocalMat ); -- cgit v1.2.3