From 43994432117686f18eb1783418ef83744ae01d79 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 17 May 2012 15:43:40 -0700 Subject: Fixed border radius hot-text linking that was broken by update to montage v.10. Signed-off-by: Nivesh Rajbhandari --- .../rect-properties.reel/rect-properties.js | 79 +++++++++------------- 1 file changed, 32 insertions(+), 47 deletions(-) (limited to 'js/components/tools-properties/rect-properties.reel/rect-properties.js') diff --git a/js/components/tools-properties/rect-properties.reel/rect-properties.js b/js/components/tools-properties/rect-properties.reel/rect-properties.js index c1cb3945..2f8ea4dd 100755 --- a/js/components/tools-properties/rect-properties.reel/rect-properties.js +++ b/js/components/tools-properties/rect-properties.reel/rect-properties.js @@ -19,12 +19,6 @@ exports.RectProperties = Montage.create(ToolProperties, { _subPrepare: { value: function() { - this.lockButton.identifier = "lockButton"; - this.lockButton.addEventListener("action", this, false); - - this._setBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]); - this._setCap([this.TLRadiusControl,this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]); - } }, @@ -33,11 +27,8 @@ exports.RectProperties = Montage.create(ToolProperties, { this.TRRadiusControl.enabled = this.BLRadiusControl.enabled = this.BRRadiusControl.enabled = !this.lockButton.pressed; if(this.lockButton.pressed) { - this._setBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]); - } else { - this._removeBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]); + this._syncRadii(this.TLRadiusControl.value, this.TLRadiusControl.units); } - } }, @@ -80,57 +71,51 @@ exports.RectProperties = Montage.create(ToolProperties, { get: function() { return this.base._fillMaterial.value; } }, - _setBindings: { - value: function(els) { - var that = this; - els.forEach(function(el) { - Object.defineBinding(el, "value", { - boundObject: that.TLRadiusControl, - boundObjectPropertyPath: "value", - boundValueMutator: function(value) { - if (typeof value === "string") { - return parseFloat(value); - } - - return value; - } - }); - - Object.defineBinding(el, "units", { - boundObject: that.TLRadiusControl, - boundObjectPropertyPath: "units" - }); - }); - } - }, + handleChanging: { + value: function(event) { + if(event.wasSetByCode) { + return; + } - _removeBindings: { - value: function(els) { - els.forEach(function(el) { - Object.deleteBindings(el); - }); + this._setBorderRadius(event); } }, - _setCap: { - value: function(els) { - var that = this; - els.forEach(function(el) { - el.addEventListener("change", that, false); - }); + handleChange: { + value: function(event) { + if(event.wasSetByCode) { + return; + } + + this._setBorderRadius(event); } }, - handleChange: { + _setBorderRadius: { value: function(event) { var hotTxt = event.currentTarget; if(hotTxt.units === "%") { if(hotTxt.value > 50) { hotTxt.maxValue = 50; } - return hotTxt.value; } - + + if(this.lockButton.pressed && (this.TLRadiusControl === hotTxt)) { + this._syncRadii(hotTxt.value, hotTxt.units); + } + } + }, + + _syncRadii: { + value: function(value, units) { + this.TRRadiusControl.value = value; + this.BLRadiusControl.value = value; + this.BRRadiusControl.value = value; + + this.TRRadiusControl.units = units; + this.BLRadiusControl.units = units; + this.BRRadiusControl.units = units; } } + }); \ No newline at end of file -- cgit v1.2.3