Skip to content

Instantly share code, notes, and snippets.

@mauritslamers
Created February 7, 2016 16:52
Show Gist options
  • Select an option

  • Save mauritslamers/7184c58a4c2e3e5f4c09 to your computer and use it in GitHub Desktop.

Select an option

Save mauritslamers/7184c58a4c2e3e5f4c09 to your computer and use it in GitHub Desktop.
this fixes text_field_view scrolling
_shouldScroll: function () {
var t = this.$input()[0],
h = this.get('frame').height,
sh = t.scrollHeight,
sTop = t.scrollTop;
if (sh < h) return false;
else {
if (t.scrollTop + h >= sh) {
return false;
}
else if (t.scrollTop !== 0) {
return true;
}
}
return false;
},
/**
Adds mouse wheel support for textareas.
*/
mouseWheel: function (evt) {
if (this.get('isTextArea')) {
evt.allowDefault();
return this._shouldScroll();
} else return false;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment