aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/Layer.reel/Layer.js
diff options
context:
space:
mode:
authorEric Guzman2012-02-27 11:13:35 -0800
committerEric Guzman2012-02-27 11:13:35 -0800
commit1a6604a50f6cfbbf0cd6f45ab94b63a001d02162 (patch)
treebbfc75d1be1ff98d22042dbbed4ca93b4a845e0c /js/panels/Timeline/Layer.reel/Layer.js
parent9e8cd4448a6d0f809a55c3bdea8b45ed75339794 (diff)
parent8125c8c6c9431067840d81c46624b6a2dd5eb4a7 (diff)
downloadninja-1a6604a50f6cfbbf0cd6f45ab94b63a001d02162.tar.gz
Merge branch 'refs/heads/master' into CSSPanelUpdates
Diffstat (limited to 'js/panels/Timeline/Layer.reel/Layer.js')
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js33
1 files changed, 17 insertions, 16 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
index 71a1f01f..f62c0b90 100644
--- a/js/panels/Timeline/Layer.reel/Layer.js
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -1,3 +1,9 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
1var Montage = require("montage/core/core").Montage; 7var Montage = require("montage/core/core").Montage;
2var Component = require("montage/ui/component").Component; 8var Component = require("montage/ui/component").Component;
3var Collapser = require("js/panels/Timeline/Collapser").Collapser; 9var Collapser = require("js/panels/Timeline/Collapser").Collapser;
@@ -80,7 +86,6 @@ var Layer = exports.Layer = Montage.create(Component, {
80 this._layerName = newVal; 86 this._layerName = newVal;
81 this._layerEditable.needsDraw = true; 87 this._layerEditable.needsDraw = true;
82 this.needsDraw = true; 88 this.needsDraw = true;
83
84 } 89 }
85 90
86 } 91 }
@@ -323,6 +328,7 @@ var Layer = exports.Layer = Montage.create(Component, {
323 this.styleCollapser.myContent = this.contentStyle; 328 this.styleCollapser.myContent = this.contentStyle;
324 this.styleCollapser.element = this.element; 329 this.styleCollapser.element = this.element;
325 this.styleCollapser.isCollapsed = this.isStyleCollapsed; 330 this.styleCollapser.isCollapsed = this.isStyleCollapsed;
331 this.styleCollapser.contentHeight = 20;
326 this.styleCollapser.isAnimated = true; 332 this.styleCollapser.isAnimated = true;
327 this.styleCollapser.labelClickEvent = function(boolBypass) { 333 this.styleCollapser.labelClickEvent = function(boolBypass) {
328 var newEvent = document.createEvent("CustomEvent"); 334 var newEvent = document.createEvent("CustomEvent");
@@ -483,8 +489,11 @@ var Layer = exports.Layer = Montage.create(Component, {
483 // Delete the style from the view 489 // Delete the style from the view
484 this.arrLayerStyles.splice(selectedIndex, 1); 490 this.arrLayerStyles.splice(selectedIndex, 1);
485 491
486 } else { 492 // Was that the last style?
487 alert('TODO: what should happen when no rule is selected and the user clicks the delete button?') 493 if (this.arrLayerStyles.length === 0) {
494 this.buttonDeleteStyle.classList.add("disabled");
495 }
496
488 } 497 }
489 } 498 }
490 } 499 }
@@ -509,8 +518,12 @@ var Layer = exports.Layer = Montage.create(Component, {
509 // Next, update this.styleRepetition.selectedIndexes. 518 // Next, update this.styleRepetition.selectedIndexes.
510 if (styleIndex !== false) { 519 if (styleIndex !== false) {
511 this.styleRepetition.selectedIndexes = [styleIndex]; 520 this.styleRepetition.selectedIndexes = [styleIndex];
521 this.buttonDeleteStyle.classList.remove("disabled");
512 } else { 522 } else {
513 this.styleRepetition.selectedIndexes = null; 523 this.styleRepetition.selectedIndexes = null;
524 if (typeof(this.buttonDeleteStyle) !== "undefined") {
525 this.buttonDeleteStyle.classList.add("disabled");
526 }
514 } 527 }
515 528
516 } 529 }
@@ -537,14 +550,11 @@ var Layer = exports.Layer = Montage.create(Component, {
537 /* Begin: Event handlers */ 550 /* Begin: Event handlers */
538 handleAddStyleClick: { 551 handleAddStyleClick: {
539 value: function(event) { 552 value: function(event) {
540 // Stop the event propagation
541 //event.stopPropagation();
542 this.addStyle(); 553 this.addStyle();
543 } 554 }
544 }, 555 },
545 handleDeleteStyleClick: { 556 handleDeleteStyleClick: {
546 value: function(event) { 557 value: function(event) {
547 //event.stopPropagation();
548 this.deleteStyle(); 558 this.deleteStyle();
549 } 559 }
550 }, 560 },
@@ -566,25 +576,16 @@ var Layer = exports.Layer = Montage.create(Component, {
566 handleMousedown: { 576 handleMousedown: {
567 value: function(event) { 577 value: function(event) {
568 this.isActive = true; 578 this.isActive = true;
569 // Check ALL THE CLICKS
570 // Are they in a particular style? If so, we need to select that style and
571 // deselect the others.
572 var ptrParent = nj.queryParentSelector(event.target, ".content-style"); 579 var ptrParent = nj.queryParentSelector(event.target, ".content-style");
573 if (ptrParent !== false) { 580 if (ptrParent !== false) {
574 // Why yes, the click was within a layer. But which one? 581 this.selectStyle(this.getActiveStyleIndex());
575 var myIndex = this.getActiveStyleIndex();
576 this.selectStyle(myIndex);
577 } 582 }
578 } 583 }
579 }, 584 },
580 handleLayerClick : { 585 handleLayerClick : {
581 value: function(event) { 586 value: function(event) {
582 // Check ALL THE CLICKS
583 // Are they in a particular style? If so, we need to select that style and
584 // deselect the others.
585 var ptrParent = nj.queryParentSelector(event.target, ".content-style"); 587 var ptrParent = nj.queryParentSelector(event.target, ".content-style");
586 if (ptrParent !== false) { 588 if (ptrParent !== false) {
587 // Why yes, the click was within a layer. But which one?
588 var myIndex = this.getActiveStyleIndex(); 589 var myIndex = this.getActiveStyleIndex();
589 this.selectStyle(myIndex); 590 this.selectStyle(myIndex);
590 } 591 }