aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js55
-rw-r--r--js/panels/Timeline/Style.reel/Style.js2
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js1
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js4
4 files changed, 31 insertions, 31 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
index db4ad712..9576d66f 100644
--- a/js/panels/Timeline/Layer.reel/Layer.js
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -83,6 +83,7 @@ var Layer = exports.Layer = Montage.create(Component, {
83 return; 83 return;
84 } 84 }
85 if (newVal !== this._selectedStyleIndex) { 85 if (newVal !== this._selectedStyleIndex) {
86 console.log("Layer.selectedStyleIndex.set ", newVal);
86 this._selectedStyleIndex = newVal; 87 this._selectedStyleIndex = newVal;
87 this.layerData.selectedStyleIndex = newVal; 88 this.layerData.selectedStyleIndex = newVal;
88 this.needsDraw = true; 89 this.needsDraw = true;
@@ -638,37 +639,34 @@ var Layer = exports.Layer = Montage.create(Component, {
638 }, 639 },
639 deleteStyle : { 640 deleteStyle : {
640 value: function() { 641 value: function() {
641 var newEvent = document.createEvent("CustomEvent"), 642
642 selectedIndex = 0; 643 // Only delete a style if we have one or more styles, and one of them is selected
643 if (this.arrLayerStyles.length > 0) { 644 if ((this.arrLayerStyles.length > 0) && (this.selectedStyleIndex !== false)) {
644 if (!!this.styleRepetition.selectedIndexes) { 645 var newEvent = document.createEvent("CustomEvent");
645
646 selectedIndex = this.styleRepetition.selectedIndexes[0];
647 646
648 // Set up the event info and dispatch the event 647 // Set up the event info and dispatch the event
649 newEvent.initCustomEvent("layerEvent", false, true); 648 newEvent.initCustomEvent("layerEvent", false, true);
650 newEvent.layerEventLocale = "styles"; 649 newEvent.layerEventLocale = "styles";
651 newEvent.layerEventType = "deleteStyle"; 650 newEvent.layerEventType = "deleteStyle";
652 newEvent.layerID = this.layerID; 651 newEvent.layerID = this.layerID;
653 newEvent.styleID = this.arrLayerStyles[selectedIndex].styleID; 652 newEvent.styleID = this.selectedStyleIndex;
654 newEvent.styleSelection = selectedIndex; 653 newEvent.selectedStyleIndex = this.selectedStyleIndex;
655 defaultEventManager.dispatchEvent(newEvent); 654 defaultEventManager.dispatchEvent(newEvent);
656 655
657 // Delete the style from the view 656 // Delete the style from the view
658 this.arrLayerStyles.splice(selectedIndex, 1); 657 this.arrLayerStyles.splice(this.selectedStyleIndex, 1);
659 658
660 // Was that the last style? 659 // Set selection to none
661 if (this.arrLayerStyles.length === 0) { 660 this.selectedStyleIndex = false;
662 this.buttonDeleteStyle.classList.add("disabled"); 661
663 } 662 // Disable the delete style button, because now nothing is selected
664 663 this.buttonDeleteStyle.classList.add("disabled");
665 } 664 }
666 }
667 } 665 }
668 }, 666 },
669 selectStyle : { 667 selectStyle : {
670 value: function(styleIndex) { 668 value: function(styleIndex) {
671 //console.log("Layer.selectStyle ", styleIndex); 669 console.log("Layer.selectStyle ", styleIndex);
672 670
673 // Select a style based on its index. 671 // Select a style based on its index.
674 // use layerIndex = false to deselect all styles. 672 // use layerIndex = false to deselect all styles.
@@ -771,7 +769,9 @@ var Layer = exports.Layer = Montage.create(Component, {
771 }, 769 },
772 handleMousedown: { 770 handleMousedown: {
773 value: function(event) { 771 value: function(event) {
774 //console.log("Layer.handleMousedown") 772 if (event.target.classList.contains("button-delete")) {
773 return;
774 }
775 this.layerData.isActive = true; 775 this.layerData.isActive = true;
776 var ptrParent = nj.queryParentSelector(event.target, ".content-style"), 776 var ptrParent = nj.queryParentSelector(event.target, ".content-style"),
777 activeStyleIndex = this.getActiveStyleIndex(); 777 activeStyleIndex = this.getActiveStyleIndex();
@@ -783,7 +783,6 @@ var Layer = exports.Layer = Montage.create(Component, {
783 }, 783 },
784 handleLayerClick : { 784 handleLayerClick : {
785 value: function(event) { 785 value: function(event) {
786 //console.log("Layer.handleLayerClick")
787 var ptrParent = nj.queryParentSelector(event.target, ".content-style"); 786 var ptrParent = nj.queryParentSelector(event.target, ".content-style");
788 if (ptrParent !== false) { 787 if (ptrParent !== false) {
789 var myIndex = this.getActiveStyleIndex(); 788 var myIndex = this.getActiveStyleIndex();
diff --git a/js/panels/Timeline/Style.reel/Style.js b/js/panels/Timeline/Style.reel/Style.js
index d712f2bd..185c9bb0 100644
--- a/js/panels/Timeline/Style.reel/Style.js
+++ b/js/panels/Timeline/Style.reel/Style.js
@@ -35,7 +35,7 @@ var LayerStyle = exports.LayerStyle = Montage.create(Component, {
35 return this._isSelected; 35 return this._isSelected;
36 }, 36 },
37 set: function(newVal) { 37 set: function(newVal) {
38 console.log("Style["+this.styleID+"].isSelected.set ", newVal) 38 //console.log("Style["+this.styleID+"].isSelected.set ", newVal)
39 if (newVal !== this._isSelected) { 39 if (newVal !== this._isSelected) {
40 this._isSelected = newVal; 40 this._isSelected = newVal;
41 this.needsDraw = true; 41 this.needsDraw = true;
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index a3965eb2..9f9a747a 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -919,6 +919,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
919 for (i = 0; i < arrLayersLength; i++) { 919 for (i = 0; i < arrLayersLength; i++) {
920 if (this.arrLayers[i].layerData.isSelected === true) { 920 if (this.arrLayers[i].layerData.isSelected === true) {
921 if (arrSelectedIndexes.indexOf(i) < 0) { 921 if (arrSelectedIndexes.indexOf(i) < 0) {
922 console.log("TimelinePanel.selectLayers, deselecting ", i);
922 this.arrLayers[i].layerData.isSelected = false; 923 this.arrLayers[i].layerData.isSelected = false;
923 this.triggerLayerBinding(i); 924 this.triggerLayerBinding(i);
924 } 925 }
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index 8dc19958..6b66bda9 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -969,8 +969,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
969 this.arrStyleTracks.push(restoredStyleTrack); 969 this.arrStyleTracks.push(restoredStyleTrack);
970 } 970 }
971 else if (layerEvent.layerEventType === "deleteStyle") { 971 else if (layerEvent.layerEventType === "deleteStyle") {
972 // TODO: Delete the right track. Index can be passed in event object, use that for splice(). 972 // We are deleting a style, so delete the associated track
973 this.arrStyleTracks.pop(); 973 this.arrStyleTracks.splice(layerEvent._event.selectedStyleIndex, 1);
974 } 974 }
975 } 975 }
976 }, 976 },