diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index d7d5328e..0feada6b 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -171,7 +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); |
176 | this.eventManager.addEventListener("closeDocument", this, false); | ||
175 | } | 177 | } |
176 | }, | 178 | }, |
177 | 179 | ||
@@ -194,6 +196,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
194 | 196 | ||
195 | } | 197 | } |
196 | }, | 198 | }, |
199 | |||
200 | handleCloseDocument: { | ||
201 | value: function(event) { | ||
202 | this.clearTimelinePanel(); | ||
203 | } | ||
204 | }, | ||
197 | willDraw:{ | 205 | willDraw:{ |
198 | value:function () { | 206 | value:function () { |
199 | if (this._isLayer) { | 207 | if (this._isLayer) { |
@@ -205,10 +213,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
205 | /* === END: Draw cycle === */ | 213 | /* === END: Draw cycle === */ |
206 | 214 | ||
207 | /* === BEGIN: Controllers === */ | 215 | /* === BEGIN: Controllers === */ |
208 | initTimelineView:{ | 216 | initTimeline : { |
209 | value:function () { | 217 | value: function() { |
210 | var myIndex; | 218 | // Set up basic Timeline functions: event listeners, etc. Things that only need to be run once. |
211 | this.layout_tracks = this.element.querySelector(".layout-tracks"); | 219 | this.layout_tracks = this.element.querySelector(".layout-tracks"); |
212 | this.layout_markers = this.element.querySelector(".layout_markers"); | 220 | this.layout_markers = this.element.querySelector(".layout_markers"); |
213 | 221 | ||
214 | this.newlayer_button.identifier = "addLayer"; | 222 | this.newlayer_button.identifier = "addLayer"; |
@@ -219,6 +227,13 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
219 | this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false); | 227 | this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false); |
220 | this.user_layers.addEventListener("scroll", this.updateLayerScroll.bind(this), false); | 228 | this.user_layers.addEventListener("scroll", this.updateLayerScroll.bind(this), false); |
221 | 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 | |||
222 | 237 | ||
223 | this.drawTimeMarkers(); | 238 | this.drawTimeMarkers(); |
224 | 239 | ||
@@ -249,18 +264,42 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
249 | 264 | ||
250 | clearTimelinePanel : { | 265 | clearTimelinePanel : { |
251 | value: function() { | 266 | value: function() { |
252 | console.log('clearing timeline...') | 267 | // Remove events |
253 | this.arrTracks = null; | 268 | this.eventManager.removeEventListener("deleteLayerClick", this, false); |
254 | this.arrLayers = null; | 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 | ||
278 | this.application.ninja.timeline.playhead.style.left = "-2px"; | ||
279 | this.application.ninja.timeline.playheadmarker.style.left = "0px"; | ||
280 | this.application.ninja.timeline.updateTimeText(0.00); | ||
281 | this.timebar.style.width = "0px"; | ||
282 | |||
283 | // Clear variables--including repetitions. | ||
284 | this.hashInstance = null; | ||
285 | this.hashTrackInstance = null; | ||
286 | this.hashLayerNumber = null; | ||
287 | this.hashElementMapToLayer = null; | ||
288 | this.arrTracks = []; | ||
289 | this.arrLayers = []; | ||
255 | this.currentLayerNumber = 0; | 290 | this.currentLayerNumber = 0; |
256 | this.currentLayerSelected = null; | 291 | this.currentLayerSelected = false; |
257 | this.currentTrackSelected = null; | 292 | this.currentTrackSelected = false; |
258 | this.selectedKeyframes = []; | 293 | this.selectedKeyframes = []; |
259 | this.selectedTweens = []; | 294 | this.selectedTweens = []; |
260 | this._captureSelection = false; | 295 | this._captureSelection = false; |
261 | this._openDoc = false; | 296 | this._openDoc = false; |
262 | this.end_hottext.value = 25; | 297 | this.end_hottext.value = 25; |
263 | this.updateTrackContainerWidth(); | 298 | this.updateTrackContainerWidth(); |
299 | |||
300 | // Redraw all the things | ||
301 | this.layerRepetition.needsDraw = true; | ||
302 | this.trackRepetition.needsDraw = true; | ||
264 | this.needsDraw = true; | 303 | this.needsDraw = true; |
265 | } | 304 | } |
266 | }, | 305 | }, |
@@ -492,6 +531,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
492 | 531 | ||
493 | if(this._openDoc){ | 532 | if(this._openDoc){ |
494 | 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) | ||
495 | thingToPush.elementsList.push(event.detail.ele); | 536 | thingToPush.elementsList.push(event.detail.ele); |
496 | } | 537 | } |
497 | 538 | ||
@@ -647,7 +688,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
647 | 688 | ||
648 | handleElementAdded:{ | 689 | handleElementAdded:{ |
649 | value:function (event) { | 690 | value:function (event) { |
650 | 691 | console.log('called') | |
651 | event.detail.uuid=nj.generateRandom(); | 692 | event.detail.uuid=nj.generateRandom(); |
652 | this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected); | 693 | this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected); |
653 | this.currentLayerSelected.elementsList.push(event.detail); | 694 | this.currentLayerSelected.elementsList.push(event.detail); |