diff options
Diffstat (limited to 'js/panels')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 85 |
1 files changed, 41 insertions, 44 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index e1f0a21c..1afb9e5a 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -363,11 +363,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
363 | if(this.application.ninja.currentDocument.documentRoot.children[0]) { | 363 | if(this.application.ninja.currentDocument.documentRoot.children[0]) { |
364 | // Yes, it has DOM elements. Loop through them and create a new | 364 | // Yes, it has DOM elements. Loop through them and create a new |
365 | // object for each. | 365 | // object for each. |
366 | myIndex=0; | 366 | for(myIndex=0;this.application.ninja.currentDocument.documentRoot.children[myIndex];myIndex++) { |
367 | while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) { | ||
368 | this._openDoc=true; | 367 | this._openDoc=true; |
369 | this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); | 368 | this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); |
370 | myIndex++; | ||
371 | } | 369 | } |
372 | } else { | 370 | } else { |
373 | // No, it has no DOM elements. Build an empty layer object. | 371 | // No, it has no DOM elements. Build an empty layer object. |
@@ -641,28 +639,26 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
641 | if (object._undoStatus) { | 639 | if (object._undoStatus) { |
642 | if (object._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { | 640 | if (object._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { |
643 | dLayer = this.hashInstance.getItem(object._el.parentElementUUID); | 641 | dLayer = this.hashInstance.getItem(object._el.parentElementUUID); |
644 | while (dLayer[hashVariable]) { | 642 | for(hashVariable=0;dLayer[hashVariable];hashVariable++) { |
645 | if (dLayer[hashVariable].layerData._layerID === object._el._layerID) { | 643 | if (dLayer[hashVariable]._layerID === object._el._layerID) { |
646 | dLayer[hashVariable].layerData.deleted = false; | 644 | dLayer[hashVariable].deleted = false; |
647 | parentNode = dLayer[hashVariable].parentElement; | 645 | parentNode = dLayer[hashVariable].parentElement; |
648 | break; | 646 | break; |
649 | } | 647 | } |
650 | hashVariable++; | ||
651 | } | 648 | } |
652 | this.application.ninja.currentSelectedContainer = parentNode; | 649 | this.application.ninja.currentSelectedContainer = parentNode; |
653 | this.LayerBinding(parentNode); | 650 | this.LayerBinding(parentNode); |
654 | } else { | 651 | } else { |
655 | dLayer = this.hashInstance.getItem(object._el.parentElementUUID); | 652 | dLayer = this.hashInstance.getItem(object._el.parentElementUUID); |
656 | while (dLayer[hashVariable].layerData) { | 653 | for(hashVariable=0;dLayer[hashVariable];hashVariable++) { |
657 | if (dLayer[hashVariable].layerData._layerID === object._el._layerID) { | 654 | if (dLayer[hashVariable]._layerID === object._el._layerID) { |
658 | dLayer[hashVariable].layerData.deleted = false; | 655 | dLayer[hashVariable].deleted = false; |
659 | 656 | ||
660 | this.arrLayers.splice(object._layerPosition, 0, object._el); | 657 | this.arrLayers.splice(object._layerPosition, 0, object._el); |
661 | this.selectLayer(object._layerPosition); | 658 | this.selectLayer(object._layerPosition); |
662 | break; | 659 | break; |
663 | 660 | ||
664 | } | 661 | } |
665 | hashVariable++; | ||
666 | } | 662 | } |
667 | } | 663 | } |
668 | } else { | 664 | } else { |
@@ -720,12 +716,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
720 | value:function (ele) { | 716 | value:function (ele) { |
721 | var hashIndex = 0 ,layerResult; | 717 | var hashIndex = 0 ,layerResult; |
722 | if (this._hashFind) { | 718 | if (this._hashFind) { |
723 | while (layerResult = this.returnedObject[hashIndex]) { | 719 | for (layerResult = this.returnedObject[hashIndex];layerResult;hashIndex++) { |
724 | if (layerResult.layerData.deleted !== true) { | 720 | if (layerResult.layerData.deleted !== true) { |
725 | this.arrLayers.push(layerResult); | 721 | this.arrLayers.push(layerResult); |
726 | 722 | ||
727 | } | 723 | } |
728 | hashIndex++; | ||
729 | } | 724 | } |
730 | this._hashFind = false; | 725 | this._hashFind = false; |
731 | }else { | 726 | }else { |
@@ -746,10 +741,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
746 | thingToPush.layerData.elementsList.push(ele); | 741 | thingToPush.layerData.elementsList.push(ele); |
747 | } | 742 | } |
748 | 743 | ||
749 | 744 | this.temparrLayers.push(thingToPush); | |
750 | thingToPush.layerData.trackPosition = this.temparrLayers.length - 1; | 745 | thingToPush.layerData.trackPosition = this.temparrLayers.length - 1; |
751 | thingToPush.layerData.layerPosition = this.temparrLayers.length - 1; | 746 | thingToPush.layerData.layerPosition = this.temparrLayers.length - 1; |
752 | this.temparrLayers.push(thingToPush); | ||
753 | this.hashInstance.setItem(this.hashKey, thingToPush.layerData, thingToPush.layerData.layerPosition); | 747 | this.hashInstance.setItem(this.hashKey, thingToPush.layerData, thingToPush.layerData.layerPosition); |
754 | 748 | ||
755 | if(this._openDoc) { | 749 | if(this._openDoc) { |
@@ -768,31 +762,30 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
768 | 762 | ||
769 | deleteLayer:{ | 763 | deleteLayer:{ |
770 | value:function (object) { | 764 | value:function (object) { |
771 | var dLayer,parentNode, hashVariable = 0, k = 0, index = 0, j = 0; | 765 | var dLayer,parentNode, hashVariable = 0, k = 0, index = 0, j = 0,a=0; |
772 | if (this.arrLayers.length > 0) { | 766 | if (this.arrLayers.length > 0) { |
773 | if (object._undoStatus) { | 767 | if (object._undoStatus) { |
774 | if (object._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { | 768 | if (object._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { |
775 | dLayer = this.hashInstance.getItem(object._el.parentElementUUID); | 769 | dLayer = this.hashInstance.getItem(object._el.parentElementUUID); |
776 | while (dLayer[hashVariable].layerData) { | 770 | for(hashVariable=0;dLayer[hashVariable];hashVariable++) { |
777 | if (dLayer[hashVariable].layerData._layerID === object._el._layerID) { | 771 | if (dLayer[hashVariable]._layerID === object._el._layerID) { |
778 | dLayer[hashVariable].layerData.deleted = true; | 772 | dLayer[hashVariable].deleted = true; |
779 | parentNode = dLayer[hashVariable].parentElement; | 773 | parentNode = dLayer[hashVariable].parentElement; |
780 | break; | 774 | break; |
781 | } | 775 | } |
782 | hashVariable++; | ||
783 | } | 776 | } |
784 | this.application.ninja.currentSelectedContainer = parentNode; | 777 | this.application.ninja.currentSelectedContainer = parentNode; |
785 | this.LayerBinding(parentNode); | 778 | this.LayerBinding(parentNode); |
786 | } | 779 | } |
787 | else { | 780 | else { |
788 | dLayer = this.hashInstance.getItem(object._el.parentElementUUID); | 781 | dLayer = this.hashInstance.getItem(object._el.parentElementUUID); |
789 | while (dLayer[hashVariable].layerData) { | 782 | for(hashVariable=0;dLayer[hashVariable];hashVariable++) { |
790 | if (dLayer[hashVariable].layerData.deleted === true) { | 783 | if (dLayer[hashVariable].deleted === true) { |
791 | 784 | ||
792 | } else if (dLayer[hashVariable].layerData._layerID === object._el._layerID) { | 785 | } else if (dLayer[hashVariable]._layerID === object._el._layerID) { |
793 | while (this.arrLayers.length) { | 786 | while (this.arrLayers.length) { |
794 | if (dLayer[hashVariable].layerData._layerID === this.arrLayers[k].layerData._layerID) { | 787 | if (dLayer[hashVariable]._layerID === this.arrLayers[k].layerData._layerID) { |
795 | dLayer[hashVariable].layerData.deleted = true; | 788 | dLayer[hashVariable].deleted = true; |
796 | this.arrLayers.splice(k, 1); | 789 | this.arrLayers.splice(k, 1); |
797 | if(k>0){ | 790 | if(k>0){ |
798 | this.selectLayer(k-1); | 791 | this.selectLayer(k-1); |
@@ -804,7 +797,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
804 | k++; | 797 | k++; |
805 | } | 798 | } |
806 | } | 799 | } |
807 | hashVariable++; | ||
808 | } | 800 | } |
809 | } | 801 | } |
810 | } else { | 802 | } else { |
@@ -814,16 +806,24 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
814 | var myIndex = this.layerRepetition.selectedIndexes[0]; | 806 | var myIndex = this.layerRepetition.selectedIndexes[0]; |
815 | this._LayerUndoObject = this.arrLayers[myIndex]; | 807 | this._LayerUndoObject = this.arrLayers[myIndex]; |
816 | 808 | ||
817 | // Deleting a layer should delete associated elements, | 809 | dLayer = this.hashInstance.getItem(this.hashKey); |
818 | // But the hash tables are messed up. | 810 | |
819 | // TODO: Kruti can you fix this? | 811 | for(hashVariable=0;dLayer[hashVariable];hashVariable++){ |
820 | //dLayer = this.hashInstance.getItem(this.hashKey); | 812 | if(this.currentLayerSelected.layerData.layerID===dLayer[hashVariable].layerID){ |
821 | //dLayer[myIndex].layerData.deleted = true; | 813 | var arrLayerLength=this.arrLayers.length; |
822 | // ElementMediator.deleteElements(dLayer[myIndex].layerData.elementsList); | 814 | for(var index=0;index<arrLayerLength;index++){ |
815 | if(this.arrLayers[index].layerData.layerID===dLayer[hashVariable].layerID){ | ||
816 | dLayer[hashVariable].deleted = true; | ||
817 | ElementMediator.deleteElements(dLayer[hashVariable].elementsList); | ||
818 | this.arrLayers.splice(index, 1); | ||
819 | break; | ||
820 | } | ||
821 | } | ||
823 | 822 | ||
824 | this.arrLayers.splice(myIndex, 1); | 823 | } |
825 | this._LayerUndoIndex = this._LayerUndoObject.layerData.layerID; | 824 | } |
826 | this._LayerUndoPosition = myIndex; | 825 | // this._LayerUndoIndex = this._LayerUndoObject.layerData.layerID; |
826 | // this._LayerUndoPosition = myIndex; | ||
827 | } | 827 | } |
828 | } | 828 | } |
829 | } | 829 | } |
@@ -851,10 +851,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
851 | 851 | ||
852 | handleElementDeleted:{ | 852 | handleElementDeleted:{ |
853 | value:function (event) { | 853 | value:function (event) { |
854 | var length; | 854 | var length,lengthVal; |
855 | this.deleteElement = event.detail; |