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 89389469..2cbd9e2b 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -747,6 +747,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
747 | this.application.ninja.currentDocument.tlCurrentLayerSelected = false; | 747 | this.application.ninja.currentDocument.tlCurrentLayerSelected = false; |
748 | this.application.ninja.currentDocument.tlCurrentLayersSelected = false; | 748 | this.application.ninja.currentDocument.tlCurrentLayersSelected = false; |
749 | this.application.ninja.currentDocument.tlCurrentElementsSelected = []; | 749 | this.application.ninja.currentDocument.tlCurrentElementsSelected = []; |
750 | this.application.ninja.currentDocument.lockedElements = []; | ||
750 | } | 751 | } |
751 | }, | 752 | }, |
752 | 753 | ||
@@ -865,6 +866,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
865 | document.addEventListener("keydown", this.timelineLeftPaneKeydown.bind(this), false); | 866 | document.addEventListener("keydown", this.timelineLeftPaneKeydown.bind(this), false); |
866 | document.addEventListener("keyup", this.timelineLeftPaneKeyup.bind(this), false); | 867 | document.addEventListener("keyup", this.timelineLeftPaneKeyup.bind(this), false); |
867 | this.eventManager.addEventListener("updatedID", this.handleLayerIdUpdate.bind(this), false); | 868 | this.eventManager.addEventListener("updatedID", this.handleLayerIdUpdate.bind(this), false); |
869 | this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false); | ||
870 | this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false); | ||
868 | 871 | ||
869 | // Bind some bindings | 872 | // Bind some bindings |
870 | Object.defineBinding(this, "currentSelectedContainer", { | 873 | Object.defineBinding(this, "currentSelectedContainer", { |
@@ -1139,7 +1142,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1139 | for (i = 0; i < arrLayersLength; i++) { | 1142 | for (i = 0; i < arrLayersLength; i++) { |
1140 | if (this.arrLayers[i].layerData.isSelected === true) { | 1143 | if (this.arrLayers[i].layerData.isSelected === true) { |
1141 | if (arrSelectedIndexes.indexOf(i) < 0) { | 1144 | if (arrSelectedIndexes.indexOf(i) < 0) { |
1142 | |||
1143 | this.arrLayers[i].layerData.isSelected = false; | 1145 | this.arrLayers[i].layerData.isSelected = false; |
1144 | this.triggerLayerBinding(i); | 1146 | this.triggerLayerBinding(i); |
1145 | } | 1147 | } |
@@ -1157,11 +1159,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1157 | // Loop through arrLayers and do the selection. | 1159 | // Loop through arrLayers and do the selection. |
1158 | for (i = 0; i < arrLayersLength; i++) { | 1160 | for (i = 0; i < arrLayersLength; i++) { |
1159 | if (arrSelectedIndexes.indexOf(i) > -1) { | 1161 | if (arrSelectedIndexes.indexOf(i) > -1) { |
1160 | this.arrLayers[i].layerData.isSelected = true; | 1162 | if(!this.arrLayers[i].layerData.isLock){ |
1161 | this.arrLayers[i].isSelected = true; | 1163 | this.arrLayers[i].layerData.isSelected = true; |
1162 | this.triggerLayerBinding(i); | 1164 | this.arrLayers[i].isSelected = true; |
1163 | arrSelectedLayers.push(i); | 1165 | this.triggerLayerBinding(i); |
1164 | arrCurrentElementsSelected.push(this.arrLayers[i].layerData.stageElement); | 1166 | arrSelectedLayers.push(i); |
1167 | arrCurrentElementsSelected.push(this.arrLayers[i].layerData.stageElement); | ||
1168 | }else{ | ||
1169 | this.arrLayers[i].layerData.isSelected = false; | ||
1170 | this.triggerLayerBinding(i); | ||
1171 | } | ||
1165 | } | 1172 | } |
1166 | } | 1173 | } |
1167 | 1174 | ||
@@ -1415,6 +1422,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1415 | thingToPush.layerData._isFirstDraw = true; | 1422 | thingToPush.layerData._isFirstDraw = true; |
1416 | thingToPush.layerData.created = true; | 1423 | thingToPush.layerData.created = true; |
1417 | thingToPush.layerData.stageElement = object; | 1424 | thingToPush.layerData.stageElement = object; |
1425 | thingToPush.layerData.isLock = false; | ||
1426 | thingToPush.layerData.isHidden = false; | ||
1427 | |||
1418 | 1428 | ||
1419 | if (this.checkable_animated.classList.contains("checked")) { | 1429 | if (this.checkable_animated.classList.contains("checked")) { |
1420 | thingToPush.layerData.isVisible = false; | 1430 | thingToPush.layerData.isVisible = false; |
@@ -1732,6 +1742,74 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1732 | } | 1742 | } |
1733 | }, | 1743 | }, |
1734 | 1744 | ||
1745 | handleLockLayerClick:{ | ||
1746 | value:function(event){ | ||
1747 | |||
1748 | var arrLayersLength = this.arrLayers.length; | ||
1749 | var lockElementArrLength = this.application.ninja.currentDocument.lockedElements.length; | ||
1750 | var i = 0; | ||
1751 | |||
1752 | if(event.currentTarget.classList.contains("checked")){ | ||
1753 | event.currentTarget.classList.remove("checked"); | ||
1754 | for(i=0;i<arrLayersLength;i++){ | ||
1755 | this.arrLayers[i].layerData.isLock = false; | ||
1756 | this.arrLayers[i].layerData.isSelected = true; | ||
1757 | for(var k = 0; k<lockElementArrLength; k++){ | ||
1758 | if(this.application.ninja.currentDocument.lockedElements[k] === this.application.ninja.timeline.arrLayers[i].layerData.stageElement){ | ||
1759 | this.application.ninja.currentDocument.lockedElements.splice(k,1); | ||
1760 | break; | ||
1761 | } | ||
1762 | } | ||
1763 | |||
1764 | } | ||
1765 | } else { | ||
1766 | for(i = 0;i < arrLayersLength;i++){ | ||
1767 | if(!this.arrLayers[i].layerData.isLock){ | ||
1768 | this.arrLayers[i].layerData.isLock = true; | ||
1769 | this.arrLayers[i].layerData.isSelected = false; | ||
1770 | this.application.ninja.currentDocument.lockedElements.push(this.arrLayers[i].layerData.stageElement); | ||
1771 | } | ||
1772 | this.selectLayers([]); | ||
1773 | |||
1774 | } | ||
1775 | event.currentTarget.classList.add("checked"); | ||
1776 | } | ||
1777 | } | ||
1778 | }, | ||
1779 | |||
1780 | handleLayerVisibleClick:{ | ||
1781 | value:function(event){ | ||
1782 | var arrLayersLength = this.arrLayers.length; | ||
1783 | var lockElementArrLength = this.application.ninja.currentDocument.lockedElements.length; | ||
1784 | var i = 0; | ||
1785 | |||
1786 | if(event.currentTarget.classList.contains("checked")){ | ||
1787 | event.currentTarget.classList.remove("checked"); | ||
1788 | for(i = 0; i < arrLayersLength; i++){ | ||
1789 | this.arrLayers[i].layerData.isHidden = false; | ||
1790 | this.arrLayers[i].layerData.stageElement.style.visibility = "visible"; | ||
1791 | for(var k=0;k<lockElementArrLength;k++){ | ||
1792 | if(this.application.ninja.currentDocument.lockedElements[k] === this.application.ninja.timeline.arrLayers[i].layerData.stageElement){ | ||
1793 | this.application.ninja.currentDocument.lockedElements.splice(k,1); | ||
1794 | break; | ||
1795 | } | ||
1796 | } | ||
1797 | |||
1798 | } | ||
1799 | } else { | ||
1800 | for(i = 0; i < arrLayersLength; i++){ | ||
1801 | if(!this.arrLayers[i].layerData.isHidden){ | ||
1802 | this.arrLayers[i].layerData.isHidden = true; | ||
1803 | this.arrLayers[i].layerData.stageElement.style.visibility = "hidden"; | ||
1804 | this.application.ninja.currentDocument.lockedElements.push(this.arrLayers[i].layerData.stageElement); | ||
1805 | } | ||
1806 | |||
1807 | } | ||
1808 | event.currentTarget.classList.add("checked"); | ||
1809 | } | ||
1810 | } | ||
1811 | }, | ||
1812 | |||
1735 | // A layer's ID has been updated in the property panel. We need to update | 1813 | // A layer's ID has been updated in the property panel. We need to update |
1736 | // our layer. | 1814 | // our layer. |
1737 | handleLayerIdUpdate: { | 1815 | handleLayerIdUpdate: { |