aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJonathan Duran2012-03-01 23:58:41 -0800
committerJonathan Duran2012-03-01 23:58:41 -0800
commitef41a2897809d768e066ee3b4bfbb436ab20175c (patch)
treee46ba526f806a620b65e5053f2f57203c17bc360 /js
parent8b08cbf68180187fe3913ea853adc0f65895fde5 (diff)
downloadninja-ef41a2897809d768e066ee3b4bfbb436ab20175c.tar.gz
Timeline bug fixes and cleanup
Deselect tweens on every selection change. Replace JS alerts with console logs. Cleanup obsolete models and references. Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js90
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js10
-rw-r--r--js/panels/Timeline/Tween.reel/Tween.js8
3 files changed, 23 insertions, 85 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 9819d7e1..93fd170e 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -44,14 +44,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
44 this._layerRepetition = newVal; 44 this._layerRepetition = newVal;
45 } 45 }
46 }, 46 },
47
47 _cacheArrays : { 48 _cacheArrays : {
48 value: function() { 49 value: function() {
49 // Cache this.arrLayers and this.arrTracks.
50 //this.log('cacheArrays ' + this._boolCacheArrays)
51 if (this._boolCacheArrays) { 50 if (this._boolCacheArrays) {
52 //this.log('caching arrays for ', this.application.ninja.currentDocument.name);
53 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; 51 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
54 //this.application.ninja.currentDocument.tlArrTracks = this.arrTracks;
55 } 52 }
56 } 53 }
57 }, 54 },
@@ -80,10 +77,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
80 value: null 77 value: null
81 }, 78 },
82 79
83 currentTrackSelected:{
84 value: null
85 },
86
87 millisecondsOffset:{ 80 millisecondsOffset:{
88 value:1000 81 value:1000
89 }, 82 },
@@ -181,22 +174,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
181 value:false, 174 value:false,
182 writable:true 175 writable:true
183 }, 176 },
177
184 timeMarkerHolder:{ 178 timeMarkerHolder:{
185 value: null 179 value: null
186 }, 180 },
187 /* === END: Models === */ 181 /* === END: Models === */
188
189 /* === BEGIN: Draw cycle === */ 182 /* === BEGIN: Draw cycle === */
190 prepareForDraw:{ 183 prepareForDraw:{
191 value:function () { 184 value:function () {
192 this.initTimeline(); 185 this.initTimeline();
193 this.eventManager.addEventListener("onOpenDocument", this, false); 186 this.eventManager.addEventListener("onOpenDocument", this, false);
194 this.eventManager.addEventListener("closeDocument", this, false); 187 this.eventManager.addEventListener("closeDocument", this, false);
195 this.eventManager.addEventListener("switchDocument", this, false); 188 this.eventManager.addEventListener("switchDocument", this, false);
196 } 189 }
197 }, 190 },
198 191
199
200 willDraw:{ 192 willDraw:{
201 value:function () { 193 value:function () {
202 if (this._isLayer) { 194 if (this._isLayer) {
@@ -206,9 +198,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
206 } 198 }
207 }, 199 },
208 /* === END: Draw cycle === */ 200 /* === END: Draw cycle === */
209
210 /* === BEGIN: Controllers === */ 201 /* === BEGIN: Controllers === */
211
212 // Bind all document-specific events (pass in true to unbind) 202 // Bind all document-specific events (pass in true to unbind)
213 _bindDocumentEvents : { 203 _bindDocumentEvents : {
214 value: function(boolUnbind) { 204 value: function(boolUnbind) {
@@ -259,7 +249,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
259 this.drawTimeMarkers(); 249 this.drawTimeMarkers();
260 this._hashKey = "123"; 250 this._hashKey = "123";
261 251
262
263 // Document switching 252 // Document switching
264 // Check to see if we have saved timeline information in the currentDocument. 253 // Check to see if we have saved timeline information in the currentDocument.
265 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { 254 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") {
@@ -300,7 +289,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
300 289
301 } else { 290 } else {
302 // we do have information stored. Use it. 291 // we do have information stored. Use it.
303 this.log('oldfile ' + this.application.ninja.currentDocument.name)
304 this._boolCacheArrays = false; 292 this._boolCacheArrays = false;
305 this.arrLayers = []; 293 this.arrLayers = [];
306 this.arrTracks = []; 294 this.arrTracks = [];
@@ -313,8 +301,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
313 this.layerRepetition.needsDraw = true; 301 this.layerRepetition.needsDraw = true;
314 this.trackRepetition.needsDraw = true; 302 this.trackRepetition.needsDraw = true;
315 this.needsDraw = true; 303 this.needsDraw = true;
316
317
318 } 304 }
319 }, 305 },
320 306
@@ -323,7 +309,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
323 // Remove events 309 // Remove events
324 this._bindDocumentEvents(true); 310 this._bindDocumentEvents(true);
325 311
326 // Remove every event listener for every tween in TimelineTrack 312 // Remove every event listener for every selected tween in the timeline
327 this.deselectTweens(); 313 this.deselectTweens();
328 314
329 // Reset visual appearance 315 // Reset visual appearance
@@ -342,21 +328,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
342 328
343 this.currentLayerNumber = 0; 329 this.currentLayerNumber = 0;
344 this.currentLayerSelected = false; 330 this.currentLayerSelected = false;
345 this.currentTrackSelected = false;
346 this.selectedKeyframes = []; 331 this.selectedKeyframes = [];
347 this.selectedTweens = []; 332 this.selectedTweens = [];
348 this._captureSelection = false; 333 this._captureSelection = false;
349 this._openDoc = false; 334 this._openDoc = false;
350 this.end_hottext.value = 25; 335 this.end_hottext.value = 25;
351 this.updateTrackContainerWidth(); 336 this.updateTrackContainerWidth();
352
353 } 337 }
354 }, 338 },
355 339
356
357 handleOnOpenDocument:{ 340 handleOnOpenDocument:{
358 value:function(){ 341 value:function(){
359
360 this._boolCacheArrays = false; 342 this._boolCacheArrays = false;
361 this.clearTimelinePanel(); 343 this.clearTimelinePanel();
362 this._boolCacheArrays = true; 344 this._boolCacheArrays = true;
@@ -367,8 +349,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
367 this.hashLayerNumber = this.createLayerNumberHash(); 349 this.hashLayerNumber = this.createLayerNumberHash();
368 this.hashElementMapToLayer = this.createElementMapToLayer(); 350 this.hashElementMapToLayer = this.createElementMapToLayer();
369 this.initTimelineForDocument(); 351 this.initTimelineForDocument();
370
371
372 } 352 }
373 }, 353 },
374 354
@@ -393,7 +373,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
393 if (this.timeMarkerHolder) { 373 if (this.timeMarkerHolder) {
394 this.time_markers.removeChild(this.timeMarkerHolder); 374 this.time_markers.removeChild(this.timeMarkerHolder);
395 } 375 }
396
397 this.drawTimeMarkers(); 376 this.drawTimeMarkers();
398 } 377 }
399 }, 378 },
@@ -408,6 +387,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
408 handleSelectionChange:{ 387 handleSelectionChange:{
409 value:function(){ 388 value:function(){
410 var key , switchSelectedLayer,layerIndex; 389 var key , switchSelectedLayer,layerIndex;
390 this.deselectTweens();
411 if(this.application.ninja.selectedElements[0]){ 391 if(this.application.ninja.selectedElements[0]){
412 key = this.application.ninja.selectedElements[0].uuid; 392 key = this.application.ninja.selectedElements[0].uuid;
413 switchSelectedLayer = this.hashElementMapToLayer.getItem(key); 393 switchSelectedLayer = this.hashElementMapToLayer.getItem(key);
@@ -468,7 +448,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
468 448
469 handleDeleteLayerClick:{ 449 handleDeleteLayerClick:{
470 value:function (event) { 450 value:function (event) {
471 this.log('handleDeleteLayerClick called')
472 if (this.arrLayers.length === 1) { 451 if (this.arrLayers.length === 1) {
473 // do not delete last layer 452 // do not delete last layer
474 return; 453 return;
@@ -488,7 +467,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
488 handleLayerBinding:{ 467 handleLayerBinding:{
489 value:function (event) { 468