restore smooth scrolling by fixing mouseevent-filtered
This commit is contained in:
parent
aba23fc3e7
commit
b825d8ec41
16
select2.js
16
select2.js
@ -154,6 +154,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).delegate("*", "mousemove", function (e) {
|
||||
$(document).data("select2-lastpos", {x: e.pageX, y: e.pageY});
|
||||
});
|
||||
|
||||
/**
|
||||
* filters mouse events so an event is fired only if the mouse moved.
|
||||
*
|
||||
@ -161,12 +165,8 @@
|
||||
* the elements under the pointer are scrolled.
|
||||
*/
|
||||
function installFilteredMouseMove(element) {
|
||||
var context = $(element[0].document);
|
||||
context.on("mousemove", function (e) {
|
||||
context.data("select2-lastpos", {x: e.pageX, y: e.pageY});
|
||||
});
|
||||
element.bind("mousemove", function (e) {
|
||||
var lastpos = context.data("select2-lastpos");
|
||||
element.bind("mousemove", function (e) {
|
||||
var lastpos = $(document).data("select2-lastpos");
|
||||
if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
|
||||
$(e.target).trigger("mousemove-filtered", e);
|
||||
}
|
||||
@ -422,8 +422,8 @@
|
||||
// initialize the container
|
||||
this.initContainer();
|
||||
|
||||
//installFilteredMouseMove(this.results);
|
||||
this.dropdown.delegate(resultsSelector, "mouseover", this.bind(this.highlightUnderEvent));
|
||||
installFilteredMouseMove(this.results);
|
||||
this.dropdown.delegate(resultsSelector, "mousemove-filtered", this.bind(this.highlightUnderEvent));
|
||||
|
||||
installDebouncedScroll(80, this.results);
|
||||
this.dropdown.delegate(resultsSelector, "scroll-debounced", this.bind(this.loadMoreIfNeeded));
|
||||
|
Loading…
Reference in New Issue
Block a user