From d2ae0619d673e66d59d7a0584fc14d420511dcdf Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Mon, 9 Jul 2012 14:50:02 -0700 Subject: Timeline: Delete unused file. --- js/panels/Timeline/DragDrop.js | 160 ----------------------------------------- 1 file changed, 160 deletions(-) delete mode 100644 js/panels/Timeline/DragDrop.js diff --git a/js/panels/Timeline/DragDrop.js b/js/panels/Timeline/DragDrop.js deleted file mode 100644 index 739eac93..00000000 --- a/js/panels/Timeline/DragDrop.js +++ /dev/null @@ -1,160 +0,0 @@ -/* -Copyright (c) 2012, Motorola Mobility, Inc -All Rights Reserved. -BSD License. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - */ - -var Montage = require("montage/core/core").Montage; -var Composer = require("montage/ui/composer/composer").Composer; - -exports.DragDropComposer = Montage.create(Composer, { - - draggable: { - value: true - }, - - droppable: { - value: true - }, - - identifier: { - value: "generic" - }, - - _dragover: { - value: false - }, - - load: { - value: function() { - //TODO: to make this work even better check to see if this is a component or not - //right now it does not support data-montage id's - this.element.addEventListener("mouseover", this, true); - this.element.addEventListener("mouseout", this, true); - this.component.element.addEventListener("dragenter", this, true); - this.component.element.addEventListener("dragleave", this, true); - this.component.element.addEventListener("dragend", this, true); - this.component.element.addEventListener("drop", this, true); - this.component.element.addEventListener("dragover", this, true); - this.component.element.addEventListener("dragstart", this, true); - } - }, - - unload: { - value: function() { - this.element.removeEventListener("mouseover", this, true); - this.element.removeEventListener("mouseout", this, true); - this.component.element.removeEventListener("dragenter", this, true); - this.component.element.removeEventListener("dragleave", this, true); - this.component.element.removeEventListener("dragend", this, true); - this.component.element.removeEventListener("drop", this, true); - this.component.element.removeEventListener("dragover", this, true); - this.component.element.removeEventListener("dragstart", this, true); - } - }, - - captureMouseover: { - value: function(e) { - if(this.draggable) { - this.component.element.draggable = true; - } - } - }, - - captureMouseout: { - value: function(e) { - this.component.element.draggable = false; - } - }, - - /* ------ Drag Drop Events ------- */ - - // This Function will determine what is being moved - captureDragstart: { - value:function(e) { - e.dataTransfer.effectAllowed = 'move'; - e.dataTransfer.setData('Text', this.identifier); - this.component.element.classList.add("dragging"); - this.component.application.ninja.componentBeingDragged = this.component; - } - }, - - captureDragenter: { - value: function(e) { - - } - }, - - captureDragover: { - value:function(e) { - e.preventDefault(); - e.stopImmediatePropagation(); - if (!this._dragover) { - this._dragover = true; - this.component.element.classList.add("dragOver"); - } - } - }, - - captureDragleave: { - value: function(e) { - if (this._dragover) { - this._dragover = false; - this.component.element.classList.remove("dragOver"); - } - } - }, - - captureDrop: { - value:function(e) { - e.stopPropagation(); // Stops some browsers from redirecting. - e.preventDefault(); - if (this._dragover) { - this._dragover = false; - this.component.element.classList.remove("dragOver"); - if (this.identifier === e.dataTransfer.getData("Text")) { - if(this.component.application.ninja.componentBeingDragged !== this.component) { - dropEvent = document.createEvent("CustomEvent"); - dropEvent.initCustomEvent("dropped", true, false, null); - dropEvent.draggedComponent = this.component.application.ninja.componentBeingDragged; - dropEvent.droppedComponent = this.component; - this.component.dispatchEvent(dropEvent); - } - } - this.component.application.ninja.componentBeingDragged = null; - } - - } - }, - - captureDragend: { - value:function(e) { - this.component.element.classList.remove("dragging"); - } - } - -}); -- cgit v1.2.3 From 15edcb5fe22793aab024c1ef7dde109b36977dd8 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Mon, 16 Jul 2012 09:20:10 -0700 Subject: Timeline: Disable drag-and-drop on subproperty keyframes. Better error handling. Fix some minor bugs. --- js/panels/Timeline/Keyframe.reel/Keyframe.js | 13 ++++++++++--- js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | 12 ++++++++++++ js/panels/Timeline/Style.reel/Style.js | 2 +- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 9 --------- js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 2 +- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/js/panels/Timeline/Keyframe.reel/Keyframe.js b/js/panels/Timeline/Keyframe.reel/Keyframe.js index a52150af..b771f6f3 100644 --- a/js/panels/Timeline/Keyframe.reel/Keyframe.js +++ b/js/panels/Timeline/Keyframe.reel/Keyframe.js @@ -119,14 +119,21 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { value: function(event) { event.dataTransfer.setData('Text', 'Keyframe'); var i = 0, - tweenRepetitionLength = this.parentComponent.parentComponent.parentComponent.tweenRepetition.childComponents.length, + tweenRepetitionLength, + myTrack, myIndex = null; + if (typeof(this.parentComponent.parentComponent.parentComponent.tweenRepetition) !== "undefined") { + myTrack = this.parentComponent.parentComponent.parentComponent; + } else { + myTrack = this.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent; + } + tweenRepetitionLength = myTrack.tweenRepetition.childComponents.length; for (i = 0; i < tweenRepetitionLength; i++) { - if (this.parentComponent.parentComponent.parentComponent.tweenRepetition.childComponents[i].uuid === this.parentComponent.uuid) { + if (myTrack.tweenRepetition.childComponents[i].uuid === this.parentComponent.uuid) { myIndex = i; } } - this.parentComponent.parentComponent.parentComponent.draggingIndex = myIndex; + myTrack.draggingIndex = myIndex; this.selectKeyframe(); } }, diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js index 12e87636..9ee9b922 100644 --- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js +++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js @@ -192,6 +192,11 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { this.trackID = this.timelineTrack.trackID; this.animatedElement = this.timelineTrack.animatedElement; this.ninjaStylesContoller = this.application.ninja.stylesController; + + // Drag and Drop event handlers + this.element.addEventListener("dragstart", this.handleKeyframeDragstart.bind(this), false); + this.element.addEventListener("dragend", this.handleKeyframeDragstart.bind(this), false); + this.element.addEventListener("drop", this.handleKeyframeDragstart.bind(this), false); } }, @@ -206,6 +211,13 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { /* End: Draw Cycle */ /* Begin: Event Handlers */ + + handleKeyframeDragstart: { + value: function(event) { + event.stopPropagation(); + return false; + } + }, handleClick:{ value:function (ev) { diff --git a/js/panels/Timeline/Style.reel/Style.js b/js/panels/Timeline/Style.reel/Style.js index dc159a01..930e1281 100644 --- a/js/panels/Timeline/Style.reel/Style.js +++ b/js/panels/Timeline/Style.reel/Style.js @@ -232,7 +232,7 @@ var LayerStyle = exports.LayerStyle = Montage.create(Component, { set: function(newVal) { if (this._whichView !== newVal) { if ((newVal !== "hintable") && (newVal !== "propval")) { - this.log("Error: Unknown view -"+newVal+"- requested for style.js."); + console.log("Error: Unknown view -"+newVal+"- requested for style.js."); return; } this._whichView = newVal; diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 93b4d67e..c790466c 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -979,9 +979,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.layout_tracks = this.element.querySelector(".layout-tracks"); this.layout_markers = this.element.querySelector(".layout_markers"); - // Bind the event handler for the document close events - this.eventManager.addEventListener("closeDocument", this.handleDocumentChange.bind(this), false); - // Bind drag and drop event handlers this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false); this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false); @@ -1628,12 +1625,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } }, - handleDocumentChange:{ - value:function () { - - } - }, - handlePlayButtonClick:{ value:function(ev){ this.application.ninja.appModel.livePreview = !this.application.ninja.appModel.livePreview; diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index c9516d1f..e6d9165a 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -699,7 +699,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { this._dragAndDropHelper.style.opacity = 0.8; this._dragAndDropHelper.style.position = "absolute"; this._dragAndDropHelper.style.top = "5px"; - this._dragAndDropHelper.style.left = "0px"; + this._dragAndDropHelper.style.left = event.target.style.left; this._dragAndDropHelper.style.zIndex = 700; this._dragAndDropHelper.classList.add("keyframeSelected"); this._dragAndDropHelper.classList.add("track-dnd-helper"); -- cgit v1.2.3 From 33e54da07d024ece1d52041d4ed2bcc28b8cbca3 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Mon, 16 Jul 2012 15:38:59 -0700 Subject: Timeline: Ameliorate slowness when adding first keyframe to an element. --- js/panels/Timeline/Keyframe.reel/Keyframe.js | 4 ++-- js/panels/Timeline/Tween.reel/Tween.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/js/panels/Timeline/Keyframe.reel/Keyframe.js b/js/panels/Timeline/Keyframe.reel/Keyframe.js index b771f6f3..13902ddb 100644 --- a/js/panels/Timeline/Keyframe.reel/Keyframe.js +++ b/js/panels/Timeline/Keyframe.reel/Keyframe.js @@ -158,7 +158,7 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { return; } this.isSelected=true; - this.element.style.left = (this.position - 6) + "px"; + //this.element.style.left = (this.position - 6) + "px"; Moved to draw cycle. this.application.ninja.timeline.selectedStyle = this.parentComponent.parentComponent.parentComponent.trackEditorProperty; this.parentComponent.selectTween(); } @@ -167,7 +167,7 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { deselectKeyframe:{ value:function () { this.isSelected = false; - this.element.style.left = (this.position - 5) + "px"; + // this.element.style.left = (this.position - 5) + "px"; Moved to draw cycle } } // ==== End Controllers diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js index 85fdfdc9..d41ad74f 100644 --- a/js/panels/Timeline/Tween.reel/Tween.js +++ b/js/panels/Timeline/Tween.reel/Tween.js @@ -229,7 +229,13 @@ var Tween = exports.Tween = Montage.create(Component, { prepareForDraw:{ value:function(){ if(this.initSelect){ - this.keyframe.selectKeyframe(); + // Select our new keyframe only if our parent is a main track. + // TODO: When we decouple all property tracks, this will go away. + if (typeof(this.parentComponent.parentComponent.trackType) === "undefined") { + if (this.tweenID > 0) { + this.keyframe.selectKeyframe(); + } + } this.initSelect = false; } } -- cgit v1.2.3