Skip to content

Instantly share code, notes, and snippets.

@radmiraal
Created November 17, 2011 19:43
Show Gist options
  • Save radmiraal/1374229 to your computer and use it in GitHub Desktop.
Save radmiraal/1374229 to your computer and use it in GitHub Desktop.
Recursion issue with binding 2 textfields
imageWidthChange: function() {
var newHeight = Math.ceil(this.get('_imageSizeRatio') * this._imageWidth);
this.set('_imageHeight', newHeight);
}.observes('_imageWidth'),
imageHeightChange: function() {
var newWidth = Math.ceil(this.get('_imageSizeRatio') / this._imageHeight);
this.set('_imageWidth', newWidth);
}.observes('_imageHeight'),
{{view SC.TextField valueBinding="_imageWidth" }}
{{view SC.TextField valueBinding="_imageHeight" }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment