From bd46eee87a4f84871169546c10795678131f9ed9 Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Tue, 19 Jun 2012 10:56:14 -0700 Subject: Lock Elements Signed-off-by: Kruti Shah --- js/panels/Timeline/Layer.reel/Layer.js | 106 +++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) (limited to 'js/panels/Timeline') diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js index 0abd97be..f6d75dca 100644 --- a/js/panels/Timeline/Layer.reel/Layer.js +++ b/js/panels/Timeline/Layer.reel/Layer.js @@ -368,6 +368,41 @@ var Layer = exports.Layer = Montage.create(Component, { this.layerData.isVisible = value; } }, + + _isLock:{ + value: false + }, + + isLock:{ + get:function(){ + return this._isLock; + }, + set:function(value){ + if (this._isLock !== value) { + this._isLock = value; + + } + this.layerData.isLock = value; + } + }, + + _isHidden:{ + value: false + }, + + isHidden:{ + get:function(){ + return this._isHidden; + }, + set:function(value){ + if (this._isHidden !== value) { + this._isHidden = value; + + } + this.layerData._isHidden = value; + } + }, + _justAdded: { value: false @@ -1223,6 +1258,77 @@ var Layer = exports.Layer = Montage.create(Component, { } }, + handleLayerLock: { + value: function() { + var i = 0; + var arrlength = this.application.ninja.timeline.arrLayers.length; + var lockElementArrLength = this.application.ninja.currentDocument.lockedElements.length; + if(!this.layerData.isLock){ + for(i = 0; i < arrlength; i++){ + if(this.application.ninja.timeline.arrLayers[i].layerData.isLock){ + this.application.ninja.timeline.arrLayers[i].layerData.isLock = false; + this.application.ninja.timeline.arrLayers[i].layerData.isSelected = false; + for(var k = 0; k < lockElementArrLength; k++){ + if(this.application.ninja.currentDocument.lockedElements[k] === this.application.ninja.timeline.arrLayers[i].layerData.elementsList[0]){ + this.application.ninja.currentDocument.lockedElements.splice(k,1); + break; + } + } + } + } + this.layerData.isSelected = false; + this.application.ninja.timeline.selectLayers([]); + this.application.ninja.currentDocument.lockedElements.push(this.layerData.elementsList[0]); + } else { + this.layerData.isSelected = true; + for(k = 0; k