diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 90 |
1 files changed, 84 insertions, 6 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index a67de4cc..e06fb422 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -580,6 +580,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
580 | // Bind the handlers for the config menu | 580 | // Bind the handlers for the config menu |
581 | this.checkable_animated.addEventListener("click", this.handleAnimatedClick.bind(this), false); | 581 | this.checkable_animated.addEventListener("click", this.handleAnimatedClick.bind(this), false); |
582 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); | 582 | this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); |
583 | this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false); | ||
584 | this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false); | ||
583 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); | 585 | document.addEventListener("click", this.handleDocumentClick.bind(this), false); |
584 | 586 | ||
585 | this.addPropertyChangeListener("currentDocument.model.domContainer", this); | 587 | this.addPropertyChangeListener("currentDocument.model.domContainer", this); |
@@ -731,6 +733,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
731 | this.application.ninja.currentDocument.tlCurrentLayerSelected = false; | 733 | this.application.ninja.currentDocument.tlCurrentLayerSelected = false; |
732 | this.application.ninja.currentDocument.tlCurrentLayersSelected = false; | 734 | this.application.ninja.currentDocument.tlCurrentLayersSelected = false; |
733 | this.application.ninja.currentDocument.tlCurrentElementsSelected = []; | 735 | this.application.ninja.currentDocument.tlCurrentElementsSelected = []; |
736 | this.application.ninja.currentDocument.lockedElements = []; | ||
734 | } | 737 | } |
735 | }, | 738 | }, |
736 | 739 | ||
@@ -1120,7 +1123,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1120 | for (i = 0; i < arrLayersLength; i++) { | 1123 | for (i = 0; i < arrLayersLength; i++) { |
1121 | if (this.arrLayers[i].layerData.isSelected === true) { | 1124 | if (this.arrLayers[i].layerData.isSelected === true) { |
1122 | if (arrSelectedIndexes.indexOf(i) < 0) { | 1125 | if (arrSelectedIndexes.indexOf(i) < 0) { |
1123 | |||
1124 | this.arrLayers[i].layerData.isSelected = false; | 1126 | this.arrLayers[i].layerData.isSelected = false; |
1125 | this.triggerLayerBinding(i); | 1127 | this.triggerLayerBinding(i); |
1126 | } | 1128 | } |
@@ -1138,11 +1140,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1138 | // Loop through arrLayers and do the selection. | 1140 | // Loop through arrLayers and do the selection. |
1139 | for (i = 0; i < arrLayersLength; i++) { | 1141 | for (i = 0; i < arrLayersLength; i++) { |
1140 | if (arrSelectedIndexes.indexOf(i) > -1) { | 1142 | if (arrSelectedIndexes.indexOf(i) > -1) { |
1141 | this.arrLayers[i].layerData.isSelected = true; | 1143 | if(!this.arrLayers[i].layerData.isLock){ |
1142 | this.arrLayers[i].isSelected = true; | 1144 | this.arrLayers[i].layerData.isSelected = true; |
1143 | this.triggerLayerBinding(i); | 1145 | this.arrLayers[i].isSelected = true; |
1144 | arrSelectedLayers.push(i); | 1146 | this.triggerLayerBinding(i); |
1145 | arrCurrentElementsSelected.push(this.arrLayers[i].layerData.stageElement); | 1147 | arrSelectedLayers.push(i); |
1148 | arrCurrentElementsSelected.push(this.arrLayers[i].layerData.stageElement); | ||
1149 | }else{ | ||
1150 | this.arrLayers[i].layerData.isSelected = false; | ||
1151 | this.triggerLayerBinding(i); | ||
1152 | } | ||
1146 | } | 1153 | } |
1147 | } | 1154 | } |
1148 | 1155 | ||
@@ -1396,6 +1403,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1396 | thingToPush.layerData._isFirstDraw = true; | 1403 | thingToPush.layerData._isFirstDraw = true; |
1397 | thingToPush.layerData.created = true; | 1404 | thingToPush.layerData.created = true; |
1398 | thingToPush.layerData.stageElement = object; | 1405 | thingToPush.layerData.stageElement = object; |
1406 | thingToPush.layerData.isLock = false; | ||
1407 | thingToPush.layerData.isHidden = false; | ||
1408 | |||
1399 | 1409 | ||
1400 | if (this.checkable_animated.classList.contains("checked")) { | 1410 | if (this.checkable_animated.classList.contains("checked")) { |
1401 | thingToPush.layerData.isVisible = false; | 1411 | thingToPush.layerData.isVisible = false; |
@@ -1713,6 +1723,74 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1713 | } | 1723 | } |
1714 | }, | 1724 | }, |
1715 | 1725 | ||
1726 | handleLockLayerClick:{ | ||
1727 | value:function(event){ | ||
1728 | |||
1729 | var arrLayersLength = this.arrLayers.length; | ||
1730 | var lockElementArrLength = this.application.ninja.currentDocument.lockedElements.length; | ||
1731 | var i = 0; | ||
1732 | |||
1733 | if(event.currentTarget.classList.contains("checked")){ | ||
1734 | event.currentTarget.classList.remove("checked"); | ||
1735 | for(i=0;i<arrLayersLength;i++){ | ||
1736 | this.arrLayers[i].layerData.isLock = false; | ||
1737 | this.arrLayers[i].layerData.isSelected = true; | ||
1738 | for(var k = 0; k<lockElementArrLength; k++){ | ||
1739 | if(this.application.ninja.currentDocument.lockedElements[k] === this.application.ninja.timeline.arrLayers[i].layerData.stageElement){ | ||
1740 | this.application.ninja.currentDocument.lockedElements.splice(k,1); | ||
1741 | break; | ||
1742 | } | ||
1743 | } | ||
1744 | |||
1745 | } | ||
1746 | } else { | ||
1747 | for(i = 0;i < arrLayersLength;i++){ | ||
1748 | if(!this.arrLayers[i].layerData.isLock){ | ||
1749 | this.arrLayers[i].layerData.isLock = true; | ||
1750 | this.arrLayers[i].layerData.isSelected = false; | ||
1751 | this.application.ninja.currentDocument.lockedElements.push(this.arrLayers[i].layerData.stageElement); | ||
1752 | } | ||
1753 | this.selectLayers([]); | ||
1754 | |||
1755 | } | ||
1756 | event.currentTarget.classList.add("checked"); | ||
1757 | } | ||
1758 | } | ||
1759 | }, | ||
1760 | |||
1761 | handleLayerVisibleClick:{ | ||
1762 | value:function(event){ | ||
1763 | var arrLayersLength = this.arrLayers.length; | ||
1764 | var lockElementArrLength = this.application.ninja.currentDocument.lockedElements.length; | ||
1765 | var i = 0; | ||
1766 | |||
1767 | if(event.currentTarget.classList.contains("checked")){ | ||
1768 | event.currentTarget.classList.remove("checked"); | ||
1769 | for(i = 0; i < arrLayersLength; i++){ | ||
1770 | this.arrLayers[i].layerData.isHidden = false; | ||
1771 | this.arrLayers[i].layerData.stageElement.style.visibility = "visible"; | ||
1772 | for(var k=0;k<lockElementArrLength;k++){ | ||
1773 | if(this.application.ninja.currentDocument.lockedElements[k] === this.application.ninja.timeline.arrLayers[i].layerData.stageElement){ | ||
1774 | this.application.ninja.currentDocument.lockedElements.splice(k,1); | ||
1775 | break; | ||
1776 | } | ||
1777 | } | ||
1778 | |||
1779 | } | ||
1780 | } else { | ||
1781 | for(i = 0; i < arrLayersLength; i++){ | ||
1782 | if(!this.arrLayers[i].layerData.isHidden){ | ||
1783 | this.arrLayers[i].layerData.isHidden = true; | ||
1784 | this.arrLayers[i].layerData.stageElement.style.visibility = "hidden"; | ||
1785 | this.application.ninja.currentDocument.lockedElements.push(this.arrLayers[i].layerData.stageElement); | ||
1786 | } | ||
1787 | |||
1788 | } | ||
1789 | event.currentTarget.classList.add("checked"); | ||
1790 | } | ||
1791 | } | ||
1792 | }, | ||
1793 | |||
1716 | // A layer's ID has been updated in the property panel. We need to update | 1794 | // A layer's ID has been updated in the property panel. We need to update |
1717 | // our layer. | 1795 | // our layer. |
1718 | handleLayerIdUpdate: { | 1796 | handleLayerIdUpdate: { |