aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKruti Shah2012-06-19 10:56:14 -0700
committerKruti Shah2012-06-19 10:56:14 -0700
commitbd46eee87a4f84871169546c10795678131f9ed9 (patch)
tree2a6e59dc76a8b7b012bf3272ab2fd540d1c741b2
parentf036558a70468a8ce0910843e413012f8f779604 (diff)
downloadninja-bd46eee87a4f84871169546c10795678131f9ed9.tar.gz
Lock Elements
Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js106
1 files changed, 106 insertions, 0 deletions
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, {
368 this.layerData.isVisible = value; 368 this.layerData.isVisible = value;
369 } 369 }
370 }, 370 },
371
372 _isLock:{
373 value: false
374 },
375
376 isLock:{
377 get:function(){
378 return this._isLock;
379 },
380 set:function(value){
381 if (this._isLock !== value) {
382 this._isLock = value;
383
384 }
385 this.layerData.isLock = value;
386 }
387 },
388
389 _isHidden:{
390 value: false
391 },
392
393 isHidden:{
394 get:function(){
395 return this._isHidden;
396 },
397 set:function(value){
398 if (this._isHidden !== value) {
399 this._isHidden = value;
400
401 }
402 this.layerData._isHidden = value;
403 }
404 },
405
371 406
372 _justAdded: { 407 _justAdded: {
373 value: false 408 value: false
@@ -1223,6 +1258,77 @@ var Layer = exports.Layer = Montage.create(Component, {
1223 } 1258 }
1224 }, 1259 },
1225 1260
1261 handleLayerLock: {
1262 value: function() {
1263 var i = 0;
1264 var arrlength = this.application.ninja.timeline.arrLayers.length;
1265 var lockElementArrLength = this.application.ninja.currentDocument.lockedElements.length;
1266 if(!this.layerData.isLock){
1267 for(i = 0; i < arrlength; i++){
1268 if(this.application.ninja.timeline.arrLayers[i].layerData.isLock){
1269 this.application.ninja.timeline.arrLayers[i].layerData.isLock = false;
1270 this.application.ninja.timeline.arrLayers[i].layerData.isSelected = false;
1271 for(var k = 0; k < lockElementArrLength; k++){
1272 if(this.application.ninja.currentDocument.lockedElements[k] === this.application.ninja.timeline.arrLayers[i].layerData.elementsList[0]){
1273 this.application.ninja.currentDocument.lockedElements.splice(k,1);
1274 break;
1275 }
1276 }
1277 }
1278 }
1279 this.layerData.isSelected = false;
1280 this.application.ninja.timeline.selectLayers([]);
1281 this.application.ninja.currentDocument.lockedElements.push(this.layerData.elementsList[0]);
1282 } else {
1283 this.layerData.isSelected = true;
1284 for(k = 0; k<lockElementArrLength; k++){
1285 if(this.application.ninja.currentDocument.lockedElements[k] === this.layerData.elementsList[0]){
1286 this.application.ninja.currentDocument.lockedElements.splice(k,1);
1287 break;
1288 }
1289 }
1290 }
1291 this.layerData.isLock = !this.layerData.isLock;
1292
1293 }
1294 },
1295
1296 handleLayerVisibility:{
1297 value:function(){
1298 var i = 0;
1299 var arrlength = this.application.ninja.timeline.arrLayers.length;
1300 var lockElementArrLength=this.application.ninja.currentDocument.lockedElements.length;
1301 if(!this.layerData.isHidden){
1302 for(i = 0; i<arrlength; i++){
1303 if(this.application.ninja.timeline.arrLayers[i].layerData.isHidden){
1304 this.application.ninja.timeline.arrLayers[i].layerData.isHidden = false;
1305 this.application.ninja.timeline.arrLayers[i].layerData.elementsList[0].style.visibility = "visible";
1306 for(var k = 0;k < lockElementArrLength;k++){
1307 if(this.application.ninja.currentDocument.lockedElements[k] === this.application.ninja.timeline.arrLayers[i].layerData.elementsList[0]){
1308 this.application.ninja.currentDocument.lockedElements.splice(k,1);
1309 break;
1310 }
1311 }
1312 }
1313
1314 }
1315 this.layerData.elementsList[0].style.visibility = "hidden";
1316 this.application.ninja.currentDocument.lockedElements.push(this.layerData.elementsList[0]);
1317
1318 } else {
1319 this.layerData.elementsList[0].style.visibility = "visible";
1320 for(var k = 0; k < lockElementArrLength; k++){
1321 if(this.application.ninja.currentDocument.lockedElements[k] === this.application.ninja.timeline.arrLayers[i].layerData.elementsList[0]){
1322 this.application.ninja.currentDocument.lockedElements.splice(k,1);
1323 break;
1324 }
1325 }
1326 }
1327 this.layerData.isHidden = !this.layerData.isHidden;
1328
1329 }
1330 },
1331
1226 1332
1227 /* End: Event handlers */ 1333 /* End: Event handlers */
1228 1334