From 509092ff335f74517a413cfb2deeb9d2de20f8e3 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 12 Jun 2012 15:13:09 -0700 Subject: Fixing properties panel to support px and % for body and other elements. Signed-off-by: Nivesh Rajbhandari --- js/components/hottext.reel/hottext.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'js/components/hottext.reel/hottext.js') diff --git a/js/components/hottext.reel/hottext.js b/js/components/hottext.reel/hottext.js index 0480597a..93e6e745 100755 --- a/js/components/hottext.reel/hottext.js +++ b/js/components/hottext.reel/hottext.js @@ -121,13 +121,19 @@ var HotText = exports.HotText = Montage.create(SliderBase, { value: 2000 }, + // Flag used to dispatch a single change event if either or both of value and units are changed + _unitsModified: { + enumerable: false, + value: false + }, + value: { serializable: true, enumerable: true, get: function() { return this._value; }, - set: function(value, fromInput) { + set: function(value) { if (isNaN(value)) { this._valueSyncedWithInputField = false; this.needsDraw = true; @@ -149,6 +155,9 @@ var HotText = exports.HotText = Montage.create(SliderBase, { this._valueSyncedWithInputField = false; this.needsDraw = true; this._dispatchActionEvent(); + } else if(this._unitsModified) { + // Need to dispatch change event if units changed + this._dispatchActionEvent(); } } }, @@ -164,7 +173,7 @@ var HotText = exports.HotText = Montage.create(SliderBase, { enumerable: false, value: function() { this._setEventFlags("change", false); - Object.getPropertyDescriptor(this, "value").set.call(this, this.inputFunction(this.element.value), true); + this.value = this.inputFunction(this.element.value); } }, -- cgit v1.2.3