aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJon Reid2012-02-27 13:31:39 -0800
committerJon Reid2012-02-27 13:31:39 -0800
commit5179adf63d25856a8ee96005678d7a6ac626cba6 (patch)
tree57b42e4c8ef02066dcf60bebac71f35dfb7bcf4d /js
parentd55224f36da55e26c266a02efa6e58d4ecf1253e (diff)
downloadninja-5179adf63d25856a8ee96005678d7a6ac626cba6.tar.gz
Timeline: More work on clear timeline method.
Diffstat (limited to 'js')
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js1
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js53
-rw-r--r--js/panels/Timeline/Tween.reel/Tween.js1
3 files changed, 43 insertions, 12 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
index e75b4d0f..d50360e6 100644
--- a/js/panels/Timeline/Layer.reel/Layer.js
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -509,7 +509,6 @@ var Layer = exports.Layer = Montage.create(Component, {
509 this.styleCollapser.bypassAnimation = true; 509 this.styleCollapser.bypassAnimation = true;
510 this.styleCollapser.toggle(); 510 this.styleCollapser.toggle();
511 } 511 }
512
513 if (this.isSelected) { 512 if (this.isSelected) {
514 this.element.classList.add("selected"); 513 this.element.classList.add("selected");
515 } else { 514 } else {
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index d7ce7079..0feada6b 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -171,11 +171,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
171 /* === BEGIN: Draw cycle === */ 171 /* === BEGIN: Draw cycle === */
172 prepareForDraw:{ 172 prepareForDraw:{
173 value:function () { 173 value:function () {
174 this.initTimeline();
174 this.eventManager.addEventListener( "onOpenDocument", this, false); 175 this.eventManager.addEventListener( "onOpenDocument", this, false);
175 var that = this; 176 this.eventManager.addEventListener("closeDocument", this, false);
176 this.getme.addEventListener("click", function() {
177 that.clearTimelinePanel();
178 }, false)
179 } 177 }
180 }, 178 },
181 179
@@ -198,6 +196,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
198 196
199 } 197 }
200 }, 198 },
199
200 handleCloseDocument: {
201 value: function(event) {
202 this.clearTimelinePanel();
203 }
204 },
201 willDraw:{ 205 willDraw:{
202 value:function () { 206 value:function () {
203 if (this._isLayer) { 207 if (this._isLayer) {
@@ -209,10 +213,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
209 /* === END: Draw cycle === */ 213 /* === END: Draw cycle === */
210 214
211 /* === BEGIN: Controllers === */ 215 /* === BEGIN: Controllers === */
212 initTimelineView:{ 216 initTimeline : {
213 value:function () { 217 value: function() {
214 var myIndex; 218 // Set up basic Timeline functions: event listeners, etc. Things that only need to be run once.
215 this.layout_tracks = this.element.querySelector(".layout-tracks"); 219 this.layout_tracks = this.element.querySelector(".layout-tracks");
216 this.layout_markers = this.element.querySelector(".layout_markers"); 220 this.layout_markers = this.element.querySelector(".layout_markers");
217 221
218 this.newlayer_button.identifier = "addLayer"; 222 this.newlayer_button.identifier = "addLayer";
@@ -223,6 +227,13 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
223 this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false); 227 this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false);
224 this.user_layers.addEventListener("scroll", this.updateLayerScroll.bind(this), false); 228 this.user_layers.addEventListener("scroll", this.updateLayerScroll.bind(this), false);
225 this.end_hottext.addEventListener("changing", this.updateTrackContainerWidth.bind(this), false); 229 this.end_hottext.addEventListener("changing", this.updateTrackContainerWidth.bind(this), false);
230
231 }
232 },
233 initTimelineView:{
234 value:function () {
235 var myIndex;
236
226 237
227 this.drawTimeMarkers(); 238 this.drawTimeMarkers();
228 239
@@ -253,13 +264,27 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
253 264
254 clearTimelinePanel : { 265 clearTimelinePanel : {
255 value: function() { 266 value: function() {
256 console.log('clearing timeline...') 267 // Remove events
257 // update playhead position and time text 268 this.eventManager.removeEventListener("deleteLayerClick", this, false);
269 this.eventManager.removeEventListener("newLayer", this, false);
270 this.eventManager.removeEventListener("deleteLayer", this, false);
271 this.eventManager.removeEventListener("layerBinding", this, false);
272 this.eventManager.removeEventListener("elementAdded", this, false);
273 this.eventManager.removeEventListener("elementDeleted", this, false);
274 this.eventManager.removeEventListener("deleteSelection", this, false);
275 this.eventManager.removeEventListener("selectionChange", this, true);
276
277 // Reset visual appearance
258 this.application.ninja.timeline.playhead.style.left = "-2px"; 278 this.application.ninja.timeline.playhead.style.left = "-2px";
259 this.application.ninja.timeline.playheadmarker.style.left = "0px"; 279 this.application.ninja.timeline.playheadmarker.style.left = "0px";
260 this.application.ninja.timeline.updateTimeText(0.00); 280 this.application.ninja.timeline.updateTimeText(0.00);
261 this.timebar.style.width = "0px"; 281 this.timebar.style.width = "0px";
262 282
283 // Clear variables--including repetitions.
284 this.hashInstance = null;
285 this.hashTrackInstance = null;
286 this.hashLayerNumber = null;
287 this.hashElementMapToLayer = null;
263 this.arrTracks = []; 288 this.arrTracks = [];
264 this.arrLayers = []; 289 this.arrLayers = [];
265 this.currentLayerNumber = 0; 290 this.currentLayerNumber = 0;
@@ -271,6 +296,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
271 this._openDoc = false; 296 this._openDoc = false;
272 this.end_hottext.value = 25; 297 this.end_hottext.value = 25;
273 this.updateTrackContainerWidth(); 298 this.updateTrackContainerWidth();
299
300 // Redraw all the things
301 this.layerRepetition.needsDraw = true;
302 this.trackRepetition.needsDraw = true;
274 this.needsDraw = true; 303 this.needsDraw = true;
275 } 304 }
276 }, 305 },
@@ -502,6 +531,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
502 531
503 if(this._openDoc){ 532 if(this._openDoc){
504 event.detail.ele.uuid =nj.generateRandom(); 533 event.detail.ele.uuid =nj.generateRandom();
534 console.log("in open doc")
535 console.log(event.detail.ele)
505 thingToPush.elementsList.push(event.detail.ele); 536 thingToPush.elementsList.push(event.detail.ele);
506 } 537 }
507 538
@@ -657,7 +688,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
657 688
658 handleElementAdded:{ 689 handleElementAdded:{
659 value:function (event) { 690 value:function (event) {
660 691 console.log('called')
661 event.detail.uuid=nj.generateRandom(); 692 event.detail.uuid=nj.generateRandom();
662 this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected); 693 this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected);
663 this.currentLayerSelected.elementsList.push(event.detail); 694 this.currentLayerSelected.elementsList.push(event.detail);
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js
index f6dbf32c..70b52297 100644
--- a/js/panels/Timeline/Tween.reel/Tween.js
+++ b/js/panels/Timeline/Tween.reel/Tween.js
@@ -140,6 +140,7 @@ var Tween = exports.Tween = Montage.create(Component, {
140 value:function (event) { 140 value:function (event) {
141 if (event.detail.source && event.detail.source !== "tween") { 141 if (event.detail.source && event.detail.source !== "tween") {
142 // check for correct element selection 142 // check for correct element selection
143 console.log(this.application.ninja.selectedElements[0]._element)
143 if (this.application.ninja.selectedElements[0]._element != this.parentComponent.parentComponent.animatedElement) { 144 if (this.application.ninja.selectedElements[0]._element != this.parentComponent.parentComponent.animatedElement) {
144 alert("Wrong element selected for this keyframe track"); 145 alert("Wrong element selected for this keyframe track");
145 } else { 146 } else {