From b7402018659cf8058d5646c08b2a916492269e33 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Thu, 23 Feb 2012 07:37:17 -0800 Subject: Timeline Reset to clean Master branch. Code scrub. Fresh copy of ninja-internal/master with Timeline folder copied in to resolved merge issues. Signed-off-by: Jonathan Duran --- js/panels/Timeline/Layer.reel/Layer.js | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'js/panels/Timeline/Layer.reel/Layer.js') diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js index 71a1f01f..2e9a8f1a 100644 --- a/js/panels/Timeline/Layer.reel/Layer.js +++ b/js/panels/Timeline/Layer.reel/Layer.js @@ -80,7 +80,6 @@ var Layer = exports.Layer = Montage.create(Component, { this._layerName = newVal; this._layerEditable.needsDraw = true; this.needsDraw = true; - } } @@ -323,6 +322,7 @@ var Layer = exports.Layer = Montage.create(Component, { this.styleCollapser.myContent = this.contentStyle; this.styleCollapser.element = this.element; this.styleCollapser.isCollapsed = this.isStyleCollapsed; + this.styleCollapser.contentHeight = 20; this.styleCollapser.isAnimated = true; this.styleCollapser.labelClickEvent = function(boolBypass) { var newEvent = document.createEvent("CustomEvent"); @@ -483,8 +483,11 @@ var Layer = exports.Layer = Montage.create(Component, { // Delete the style from the view this.arrLayerStyles.splice(selectedIndex, 1); - } else { - alert('TODO: what should happen when no rule is selected and the user clicks the delete button?') + // Was that the last style? + if (this.arrLayerStyles.length === 0) { + this.buttonDeleteStyle.classList.add("disabled"); + } + } } } @@ -509,8 +512,12 @@ var Layer = exports.Layer = Montage.create(Component, { // Next, update this.styleRepetition.selectedIndexes. if (styleIndex !== false) { this.styleRepetition.selectedIndexes = [styleIndex]; + this.buttonDeleteStyle.classList.remove("disabled"); } else { this.styleRepetition.selectedIndexes = null; + if (typeof(this.buttonDeleteStyle) !== "undefined") { + this.buttonDeleteStyle.classList.add("disabled"); + } } } @@ -537,14 +544,11 @@ var Layer = exports.Layer = Montage.create(Component, { /* Begin: Event handlers */ handleAddStyleClick: { value: function(event) { - // Stop the event propagation - //event.stopPropagation(); this.addStyle(); } }, handleDeleteStyleClick: { value: function(event) { - //event.stopPropagation(); this.deleteStyle(); } }, @@ -566,25 +570,16 @@ var Layer = exports.Layer = Montage.create(Component, { handleMousedown: { value: function(event) { this.isActive = true; - // Check ALL THE CLICKS - // Are they in a particular style? If so, we need to select that style and - // deselect the others. var ptrParent = nj.queryParentSelector(event.target, ".content-style"); if (ptrParent !== false) { - // Why yes, the click was within a layer. But which one? - var myIndex = this.getActiveStyleIndex(); - this.selectStyle(myIndex); + this.selectStyle(this.getActiveStyleIndex()); } } }, handleLayerClick : { value: function(event) { - // Check ALL THE CLICKS - // Are they in a particular style? If so, we need to select that style and - // deselect the others. var ptrParent = nj.queryParentSelector(event.target, ".content-style"); if (ptrParent !== false) { - // Why yes, the click was within a layer. But which one? var myIndex = this.getActiveStyleIndex(); this.selectStyle(myIndex); } -- cgit v1.2.3