From a36266b640207b3a95aaa145def263a469ecee15 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 5 Apr 2012 11:47:21 -0700 Subject: Timeline: Bit of code cleanup in Layer.js --- js/panels/Timeline/Layer.reel/Layer.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js index b713a197..b8ab1539 100644 --- a/js/panels/Timeline/Layer.reel/Layer.js +++ b/js/panels/Timeline/Layer.reel/Layer.js @@ -480,31 +480,23 @@ var Layer = exports.Layer = Montage.create(Component, { // Initialize myself this.init(); - var that = this; + // Make it editable! this._layerEditable = Hintable.create(); this._layerEditable.element = this.titleSelector; this.titleSelector.identifier = "selectorEditable"; this.titleSelector.addEventListener("click", this, false); - this._layerEditable.addEventListener("blur", function(event) { - that.handleSelectorEditableBlur(event); - }, false); - this._layerEditable.addEventListener("change", function(event) { - that.dynamicLayerName.value = that._layerEditable.value; - this.application.ninja.timeline.currentLayerSelected.layerData.elementsList[0].dataset.storedLayerName = that.dynamicLayerName.value; - that.needsDraw = true; - this.application.ninja.documentController.activeDocument.needsSave = true; - }, false); + this._layerEditable.addEventListener("blur", this.handleSelectorEditableBlur.bind(this), false); + this._layerEditable.addEventListener("change", this.handleLayerNameChange.bind(this), false); this._layerEditable.editingClass = "editable2"; this._layerEditable.value = this.layerName; - //this._layerEditable.needsDraw = true; - + + // Collapser event handlers. this.mainCollapser.clicker.addEventListener("click", this.handleMainCollapserClick.bind(this), false); this.positionCollapser.clicker.addEventListener("click", this.handlePositionCollapserClick.bind(this), false); this.transformCollapser.clicker.addEventListener("click", this.handleTransformCollapserClick.bind(this), false); this.styleCollapser.clicker.addEventListener("click", this.handleStyleCollapserClick.bind(this), false); - // Add event listeners to add and delete style buttons this.buttonAddStyle.addEventListener("click", this.handleAddStyleClick.bind(this), false); this.buttonDeleteStyle.addEventListener("click", this.handleDeleteStyleClick.bind(this), false); @@ -705,6 +697,14 @@ var Layer = exports.Layer = Montage.create(Component, { /* End: Controllers */ /* Begin: Event handlers */ + handleLayerNameChange: { + value: function(event) { + this.dynamicLayerName.value = this._layerEditable.value; + this.application.ninja.timeline.currentLayerSelected.layerData.elementsList[0].dataset.storedLayerName = this.dynamicLayerName.value; + this.needsDraw = true; + this.application.ninja.documentController.activeDocument.needsSave = true; + } + }, handleAddStyleClick: { value: function(event) { this.addStyle(); -- cgit v1.2.3