mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1403563 - Allow multiple wheel events to accelerate scrollbox scrolling. r=dao
MozReview-Commit-ID: Lo7HxK6TGwd --HG-- extra : rebase_source : 342735b8c6d8fcd9de49ce2a713972082cab68e7
This commit is contained in:
parent
0648f86b7f
commit
265d540422
@ -150,6 +150,14 @@
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="scrollPosition" readonly="true">
|
||||
<getter><![CDATA[
|
||||
return this.orient == "vertical" ?
|
||||
this._scrollbox.scrollTop :
|
||||
this._scrollbox.scrollLeft;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<field name="_startEndProps"><![CDATA[
|
||||
this.orient == "vertical" ? ["top", "bottom"] : ["left", "right"];
|
||||
]]></field>
|
||||
@ -404,6 +412,10 @@
|
||||
});
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<field name="_isScrolling">false</field>
|
||||
<field name="_destination">0</field>
|
||||
<field name="_direction">0</field>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
@ -450,6 +462,17 @@
|
||||
}
|
||||
|
||||
if (doScroll) {
|
||||
let direction = scrollAmount < 0 ? -1 : 1;
|
||||
let startPos = this.scrollPosition;
|
||||
|
||||
if (!this._isScrolling || this._direction != direction) {
|
||||
this._destination = startPos + scrollAmount;
|
||||
this._direction = direction;
|
||||
} else {
|
||||
// We were already in the process of scrolling in this direction
|
||||
this._destination = this._destination + scrollAmount;
|
||||
scrollAmount = this._destination - startPos;
|
||||
}
|
||||
this.scrollByPixels(scrollAmount, instant);
|
||||
}
|
||||
|
||||
@ -536,8 +559,15 @@
|
||||
]]></handler>
|
||||
|
||||
<handler event="scroll"><![CDATA[
|
||||
this._isScrolling = true;
|
||||
this._updateScrollButtonsDisabledState();
|
||||
]]></handler>
|
||||
|
||||
<handler event="scrollend"><![CDATA[
|
||||
this._isScrolling = false;
|
||||
this._destination = 0;
|
||||
this._direction = 0;
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user