Skip to content

Commit

Permalink
fix: don't stop roll if grid cannot scroll in given direction
Browse files Browse the repository at this point in the history
  • Loading branch information
WillsterJohnsonAtZenesis committed Apr 11, 2024
1 parent dc07721 commit d22c75a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source/class/qxl/datagrid/DataGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,23 +358,29 @@ qx.Class.define("qxl.datagrid.DataGrid", {
* @returns
*/
_onRoll(e) {
e.stop();
const SCROLLING_SPEED = 0.08;
// only wheel and touch
if (e.getPointerType() == "mouse") {
e.stop();
return;
}

if (this.__cancelRoll && e.getMomentum()) {
e.stopMomentum();
this.__cancelRoll = null;
e.stop();
return;
}

let rowCount = this.getDataSourceSize().getRow();
var newStartRowIndex = this.getStartRowIndex() + Math.floor(e.getDelta().y * SCROLLING_SPEED);
let maxRows = this.getMaxRows();
newStartRowIndex = qxl.datagrid.util.Math.clamp(0, Math.max(0, rowCount - maxRows), newStartRowIndex);

const isAtScrollLimit = newStartRowIndex == this.getStartRowIndex();
if (!isAtScrollLimit) {
e.stop();
}
this.setStartRowIndex(newStartRowIndex);
},

Expand Down

0 comments on commit d22c75a

Please sign in to comment.