diff options
author | Jon Reid | 2012-05-15 11:14:16 -0700 |
---|---|---|
committer | Jon Reid | 2012-05-15 11:14:16 -0700 |
commit | e33a4e58c271a9507082694a5268b840fdd05968 (patch) | |
tree | e70798347ca1afd01be88b766e8be9f44a009a4f | |
parent | 847276c1e62d55c10d059683e7180635aa994890 (diff) | |
download | ninja-e33a4e58c271a9507082694a5268b840fdd05968.tar.gz |
Timeline: Code cleanup. Improve efficiency for track scrolling.
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 7f4fee89..d85259cb 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -57,6 +57,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
57 | this._layerRepetition = newVal; | 57 | this._layerRepetition = newVal; |
58 | } | 58 | } |
59 | }, | 59 | }, |
60 | |||
61 | _areTracksScrolling: { | ||
62 | value: false | ||
63 | }, | ||
60 | 64 | ||
61 | // Set to false to skip array caching array sets in current document | 65 | // Set to false to skip array caching array sets in current document |
62 | _boolCacheArrays:{ | 66 | _boolCacheArrays:{ |
@@ -240,10 +244,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
240 | } | 244 | } |
241 | }, | 245 | }, |
242 | 246 | ||
243 | _isLayer:{ | ||
244 | value:false | ||
245 | }, | ||
246 | |||
247 | _firstTimeLoaded:{ | 247 | _firstTimeLoaded:{ |
248 | value:true | 248 | value:true |
249 | }, | 249 | }, |
@@ -370,35 +370,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
370 | prepareForDraw:{ | 370 | prepareForDraw:{ |
371 | value:function () { | 371 | value:function () { |
372 | this.initTimeline(); | 372 | this.initTimeline(); |
373 | // Bind the event handler for the document change events | ||
374 | //this.eventManager.addEventListener("onOpenDocument", this.handleDocumentChange.bind(this), false); | ||
375 | this.eventManager.addEventListener("closeDocument", this.handleDocumentChange.bind(this), false); | ||
376 | //this.eventManager.addEventListener("switchDocument", this.handleDocumentChange.bind(this), false); | ||
377 | //this.eventManager.addEventListener("breadCrumbBinding",this,false); | ||
378 | |||
379 | // Bind drag and drop event handlers | ||
380 | this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false); | ||
381 | this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false); | ||
382 | this.container_layers.addEventListener("dragover", this.handleLayerDragover.bind(this), false); | ||
383 | this.container_layers.addEventListener("drop", this.handleLayerDrop.bind(this), false); | ||
384 | this.container_tracks.addEventListener("dragover", this.handleKeyframeDragover.bind(this), false); | ||
385 | this.container_tracks.addEventListener("drop", this.handleKeyframeDrop.bind(this), false); | ||
386 | |||
387 | // Bind the handlers for the config menu | ||
388 | this.checkable_animated.addEventListener("click", this.handleAnimatedClick.bind(this), false); | ||
389 | this.checkable_relative.addEventListener("click", this.handleRelativeClick.bind(this), false); | ||
390 | this.checkable_absolute.addEventListener("click", this.handleAbsoluteClick.bind(this), false); | ||
391 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); | ||
392 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); | ||
393 | |||
394 | } | ||
395 | }, | ||
396 | |||
397 | willDraw:{ | ||
398 | value:function () { | ||
399 | if (this._isLayer) { | ||
400 | this._isLayer = false; | ||
401 | } | ||
402 | } | 373 | } |
403 | }, | 374 | }, |
404 | 375 | ||
@@ -453,6 +424,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
453 | this._scrollTracks = false; | 424 | this._scrollTracks = false; |
454 | } | 425 | } |
455 | } | 426 | } |
427 | |||
428 | // Do we need to scroll the layers? | ||
429 | if (this._areTracksScrolling) { | ||
430 | this._areTracksScrolling = false; | ||
431 | this.user_layers.scrollTop = this.layout_tracks.scrollTop; | ||
432 | this.layout_markers.scrollLeft = this.layout_tracks.scrollLeft; | ||
433 | this.playheadmarker.style.top = this.layout_tracks.scrollTop + "px"; | ||
434 | } | ||
456 | 435 | ||
457 | } | 436 | } |
458 | }, | 437 | }, |
@@ -597,6 +576,28 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
597 | this.layout_tracks = this.element.querySelector(".layout-tracks"); | 576 | this.layout_tracks = this.element.querySelector(".layout-tracks"); |
598 | this.layout_markers = this.element.querySelector(".layout_markers"); | 577 | this.layout_markers = this.element.querySelector(".layout_markers"); |
599 | 578 | ||
579 | |||
580 | // Bind the event handler for the document change events | ||
581 | //this.eventManager.addEventListener("onOpenDocument", this.handleDocumentChange.bind(this), false); | ||
582 | this.eventManager.addEventListener("closeDocument", this.handleDocumentChange.bind(this), false); | ||
583 | //this.eventManager.addEventListener("switchDocument", this.handleDocumentChange.bind(this), false); | ||
584 | //this.eventManager.addEventListener("breadCrumbBinding",this,false); | ||
585 | |||
586 | // Bind drag and drop event handlers | ||
587 | this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false); | ||
588 | this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false); | ||
589 | this.container_layers.addEventListener("dragover", this.handleLayerDragover.bind(this), false); | ||
590 | this.container_layers.addEventListener("drop", this.handleLayerDrop.bind(this), false); | ||
591 | this.container_tracks.addEventListener("dragover", this.handleKeyframeDragover.bind(this), false); | ||
592 | this.container_tracks.addEventListener("drop", this.handleKeyframeDrop.bind(this), false); | ||
593 | |||
594 | // Bind the handlers for the config menu | ||
595 | this.checkable_animated.addEventListener("click", this.handleAnimatedClick.bind(this), false); | ||
596 | this.checkable_relative.addEventListener("click", this.handleRelativeClick.bind(this), false); | ||
597 | this.checkable_absolute.addEventListener("click", this.handleAbsoluteClick.bind(this), false); | ||
598 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); | ||
599 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); | ||
600 | |||
600 | // Add some event handlers | 601 | // Add some event handlers |
601 | this.timeline_leftpane.addEventListener("mousedown", this.timelineLeftPaneMousedown.bind(this), false); | 602 | this.timeline_leftpane.addEventListener("mousedown", this.timelineLeftPaneMousedown.bind(this), false); |
602 | this.timeline_leftpane.addEventListener("mouseup", this.timelineLeftPaneMouseup.bind(this), false); | 603 | this.timeline_leftpane.addEventListener("mouseup", this.timelineLeftPaneMouseup.bind(this), false); |
@@ -824,9 +825,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
824 | 825 | ||
825 | updateLayerScroll:{ | 826 | updateLayerScroll:{ |
826 | value:function () { | 827 | value:function () { |
827 | this.user_layers.scrollTop = this.layout_tracks.scrollTop; | 828 | this._areTracksScrolling = true; |
828 | this.layout_markers.scrollLeft = this.layout_tracks.scrollLeft; | 829 | this.needsDraw = true; |
829 | this.playheadmarker.style.top = this.layout_tracks.scrollTop + "px"; | ||
830 | } | 830 | } |
831 | }, | 831 | }, |
832 | 832 | ||