aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline
diff options
context:
space:
mode:
authorKruti Shah2012-07-16 16:28:57 -0700
committerKruti Shah2012-07-16 16:28:57 -0700
commit7e2c2dbd040ed79a3f0678f91bd4b6db9cf69231 (patch)
treea1c0985f584273990dcacdfaf9aeaddeb583d0b1 /js/panels/Timeline
parentcdcc677c827b65e3c689d4207c0117f94e4d6d57 (diff)
parent33e54da07d024ece1d52041d4ed2bcc28b8cbca3 (diff)
downloadninja-7e2c2dbd040ed79a3f0678f91bd4b6db9cf69231.tar.gz
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r--js/panels/Timeline/DragDrop.js160
-rw-r--r--js/panels/Timeline/Keyframe.reel/Keyframe.js17
-rw-r--r--js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js12
-rw-r--r--js/panels/Timeline/Style.reel/Style.js2
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js9
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js2
-rw-r--r--js/panels/Timeline/Tween.reel/Tween.js8
7 files changed, 33 insertions, 177 deletions
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 @@
1/* <copyright>
2Copyright (c) 2012, Motorola Mobility, Inc
3All Rights Reserved.
4BSD License.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9 - Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14 - Neither the name of Motorola Mobility nor the names of its contributors
15 may be used to endorse or promote products derived from this software
16 without specific prior written permission.
17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE.
29</copyright> */
30
31var Montage = require("montage/core/core").Montage;
32var Composer = require("montage/ui/composer/composer").Composer;
33
34exports.DragDropComposer = Montage.create(Composer, {
35
36 draggable: {
37 value: true
38 },
39
40 droppable: {
41 value: true
42 },
43
44 identifier: {
45 value: "generic"
46 },
47
48 _dragover: {
49 value: false
50 },
51
52 load: {
53 value: function() {
54 //TODO: to make this work even better check to see if this is a component or not
55 //right now it does not support data-montage id's
56 this.element.addEventListener("mouseover", this, true);
57 this.element.addEventListener("mouseout", this, true);
58 this.component.element.addEventListener("dragenter", this, true);
59 this.component.element.addEventListener("dragleave", this, true);
60 this.component.element.addEventListener("dragend", this, true);
61 this.component.element.addEventListener("drop", this, true);
62 this.component.element.addEventListener("dragover", this, true);
63 this.component.element.addEventListener("dragstart", this, true);
64 }
65 },
66
67 unload: {
68 value: function() {
69 this.element.removeEventListener("mouseover", this, true);
70 this.element.removeEventListener("mouseout", this, true);
71 this.component.element.removeEventListener("dragenter", this, true);
72 this.component.element.removeEventListener("dragleave", this, true);
73 this.component.element.removeEventListener("dragend", this, true);
74 this.component.element.removeEventListener("drop", this, true);
75 this.component.element.removeEventListener("dragover", this, true);
76 this.component.element.removeEventListener("dragstart", this, true);
77 }
78 },
79
80 captureMouseover: {
81 value: function(e) {
82 if(this.draggable) {
83 this.component.element.draggable = true;
84 }
85 }
86 },
87
88 captureMouseout: {
89 value: function(e) {
90 this.component.element.draggable = false;
91 }
92 },
93
94 /* ------ Drag Drop Events ------- */
95
96 // This Function will determine what is being moved
97 captureDragstart: {
98 value:function(e) {
99 e.dataTransfer.effectAllowed = 'move';
100 e.dataTransfer.setData('Text', this.identifier);
101 this.component.element.classList.add("dragging");
102 this.component.application.ninja.componentBeingDragged = this.component;
103 }
104 },
105
106 captureDragenter: {
107 value: function(e) {
108
109 }
110 },
111
112 captureDragover: {
113 value:function(e) {
114 e.preventDefault();
115 e.stopImmediatePropagation();
116 if (!this._dragover) {
117 this._dragover = true;
118 this.component.element.classList.add("dragOver");
119 }
120 }
121 },
122
123 captureDragleave: {
124 value: function(e) {
125 if (this._dragover) {
126 this._dragover = false;
127 this.component.element.classList.remove("dragOver");
128 }
129 }
130 },
131
132 captureDrop: {
133 value:function(e) {
134 e.stopPropagation(); // Stops some browsers from redirecting.
135 e.preventDefault();
136 if (this._dragover) {
137 this._dragover = false;
138 this.component.element.classList.remove("dragOver");
139 if (this.identifier === e.dataTransfer.getData("Text")) {
140 if(this.component.application.ninja.componentBeingDragged !== this.component) {
141 dropEvent = document.createEvent("CustomEvent");
142 dropEvent.initCustomEvent("dropped", true, false, null);
143 dropEvent.draggedComponent = this.component.application.ninja.componentBeingDragged;
144 dropEvent.droppedComponent = this.component;
145 this.component.dispatchEvent(dropEvent);
146 }
147 }
148 this.component.application.ninja.componentBeingDragged = null;
149 }
150
151 }
152 },
153
154 captureDragend: {
155 value:function(e) {
156 this.component.element.classList.remove("dragging");
157 }
158 }
159
160});
diff --git a/js/panels/Timeline/Keyframe.reel/Keyframe.js b/js/panels/Timeline/Keyframe.reel/Keyframe.js
index a52150af..13902ddb 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, {
119 value: function(event) { 119 value: function(event) {
120 event.dataTransfer.setData('Text', 'Keyframe'); 120 event.dataTransfer.setData('Text', 'Keyframe');
121 var i = 0, 121 var i = 0,
122 tweenRepetitionLength = this.parentComponent.parentComponent.parentComponent.tweenRepetition.childComponents.length, 122 tweenRepetitionLength,
123 myTrack,
123 myIndex = null; 124 myIndex = null;
125 if (typeof(this.parentComponent.parentComponent.parentComponent.tweenRepetition) !== "undefined") {
126 myTrack = this.parentComponent.parentComponent.parentComponent;
127 } else {
128 myTrack = this.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent;
129 }
130 tweenRepetitionLength = myTrack.tweenRepetition.childComponents.length;
124 for (i = 0; i < tweenRepetitionLength; i++) { 131 for (i = 0; i < tweenRepetitionLength; i++) {
125 if (this.parentComponent.parentComponent.parentComponent.tweenRepetition.childComponents[i].uuid === this.parentComponent.uuid) { 132 if (myTrack.tweenRepetition.childComponents[i].uuid === this.parentComponent.uuid) {
126 myIndex = i; 133 myIndex = i;
127 } 134 }
128 } 135 }
129 this.parentComponent.parentComponent.parentComponent.draggingIndex = myIndex; 136 myTrack.draggingIndex = myIndex;
130 this.selectKeyframe(); 137 this.selectKeyframe();
131 } 138 }
132 }, 139 },
@@ -151,7 +158,7 @@ var Keyframe = exports.Keyframe = Montage.create(Component, {
151 return; 158 return;
152 } 159 }
153 this.isSelected=true; 160 this.isSelected=true;
154 this.element.style.left = (this.position - 6) + "px"; 161 //this.element.style.left = (this.position - 6) + "px"; Moved to draw cycle.
155 this.application.ninja.timeline.selectedStyle = this.parentComponent.parentComponent.parentComponent.trackEditorProperty; 162 this.application.ninja.timeline.selectedStyle = this.parentComponent.parentComponent.parentComponent.trackEditorProperty;
156 this.parentComponent.selectTween(); 163 this.parentComponent.selectTween();
157 } 164 }
@@ -160,7 +167,7 @@ var Keyframe = exports.Keyframe = Montage.create(Component, {
160 deselectKeyframe:{ 167 deselectKeyframe:{
161 value:function () { 168 value:function () {
162 this.isSelected = false; 169 this.isSelected = false;
163 this.element.style.left = (this.position - 5) + "px"; 170 // this.element.style.left = (this.position - 5) + "px"; Moved to draw cycle
164 } 171 }
165 } 172 }
166 // ==== End Controllers 173 // ==== End Controllers
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
i