aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/Layer.reel/Layer.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/Layer.reel/Layer.js')
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js27
1 files changed, 11 insertions, 16 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
index 71a1f01f..2e9a8f1a 100644
--- a/js/panels/Timeline/Layer.reel/Layer.js
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -80,7 +80,6 @@ var Layer = exports.Layer = Montage.create(Component, {
80 this._layerName = newVal; 80 this._layerName = newVal;
81 this._layerEditable.needsDraw = true; 81 this._layerEditable.needsDraw = true;
82 this.needsDraw = true; 82 this.needsDraw = true;
83
84 } 83 }
85 84
86 } 85 }
@@ -323,6 +322,7 @@ var Layer = exports.Layer = Montage.create(Component, {
323 this.styleCollapser.myContent = this.contentStyle; 322 this.styleCollapser.myContent = this.contentStyle;
324 this.styleCollapser.element = this.element; 323 this.styleCollapser.element = this.element;
325 this.styleCollapser.isCollapsed = this.isStyleCollapsed; 324 this.styleCollapser.isCollapsed = this.isStyleCollapsed;
325 this.styleCollapser.contentHeight = 20;
326 this.styleCollapser.isAnimated = true; 326 this.styleCollapser.isAnimated = true;
327 this.styleCollapser.labelClickEvent = function(boolBypass) { 327 this.styleCollapser.labelClickEvent = function(boolBypass) {
328 var newEvent = document.createEvent("CustomEvent"); 328 var newEvent = document.createEvent("CustomEvent");
@@ -483,8 +483,11 @@ var Layer = exports.Layer = Montage.create(Component, {
483 // Delete the style from the view 483 // Delete the style from the view
484 this.arrLayerStyles.splice(selectedIndex, 1); 484 this.arrLayerStyles.splice(selectedIndex, 1);
485 485
486 } else { 486 // Was that the last style?
487 alert('TODO: what should happen when no rule is selected and the user clicks the delete button?') 487 if (this.arrLayerStyles.length === 0) {
488 this.buttonDeleteStyle.classList.add("disabled");
489 }
490
488 } 491 }
489 } 492 }
490 } 493 }
@@ -509,8 +512,12 @@ var Layer = exports.Layer = Montage.create(Component, {
509 // Next, update this.styleRepetition.selectedIndexes. 512 // Next, update this.styleRepetition.selectedIndexes.
510 if (styleIndex !== false) { 513 if (styleIndex !== false) {
511 this.styleRepetition.selectedIndexes = [styleIndex]; 514 this.styleRepetition.selectedIndexes = [styleIndex];
515 this.buttonDeleteStyle.classList.remove("disabled");
512 } else { 516 } else {
513 this.styleRepetition.selectedIndexes = null; 517 this.styleRepetition.selectedIndexes = null;
518 if (typeof(this.buttonDeleteStyle) !== "undefined") {
519 this.buttonDeleteStyle.classList.add("disabled");
520 }
514 } 521 }
515 522
516 } 523 }
@@ -537,14 +544,11 @@ var Layer = exports.Layer = Montage.create(Component, {
537 /* Begin: Event handlers */ 544 /* Begin: Event handlers */
538 handleAddStyleClick: { 545 handleAddStyleClick: {
539 value: function(event) { 546 value: function(event) {
540 // Stop the event propagation
541 //event.stopPropagation();
542 this.addStyle(); 547 this.addStyle();
543 } 548 }
544 }, 549 },
545 handleDeleteStyleClick: { 550 handleDeleteStyleClick: {
546 value: function(event) { 551 value: function(event) {
547 //event.stopPropagation();
548 this.deleteStyle(); 552 this.deleteStyle();
549 } 553 }
550 }, 554 },
@@ -566,25 +570,16 @@ var Layer = exports.Layer = Montage.create(Component, {
566 handleMousedown: { 570 handleMousedown: {
567 value: function(event) { 571 value: function(event) {
568 this.isActive = true; 572 this.isActive = true;
569 // Check ALL THE CLICKS
570 // Are they in a particular style? If so, we need to select that style and
571 // deselect the others.
572 var ptrParent = nj.queryParentSelector(event.target, ".content-style"); 573 var ptrParent = nj.queryParentSelector(event.target, ".content-style");
573 if (ptrParent !== false) { 574 if (ptrParent !== false) {
574 // Why yes, the click was within a layer. But which one? 575 this.selectStyle(this.getActiveStyleIndex());
575 var myIndex = this.getActiveStyleIndex();
576 this.selectStyle(myIndex);
577 } 576 }
578 } 577 }
579 }, 578 },
580 handleLayerClick : { 579 handleLayerClick : {
581 value: function(event) { 580 value: function(event) {
582 // Check ALL THE CLICKS
583 // Are they in a particular style? If so, we need to select that style and
584 // deselect the others.
585 var ptrParent = nj.queryParentSelector(event.target, ".content-style"); 581 var ptrParent = nj.queryParentSelector(event.target, ".content-style");
586 if (ptrParent !== false) { 582 if (ptrParent !== false) {
587 // Why yes, the click was within a layer. But which one?
588 var myIndex = this.getActiveStyleIndex(); 583 var myIndex = this.getActiveStyleIndex();
589 this.selectStyle(myIndex); 584 this.selectStyle(myIndex);
590 } 585 }