react-x11 2.22.2 → 2.22.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-x11",
3
- "version": "2.22.2",
3
+ "version": "2.22.3",
4
4
  "description": "react renderer with X11 as a target",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -942,7 +942,16 @@ export const Scrollable = (Base) =>
942
942
  const ny = ev.nativeEvent?.y ?? ev.y * this.scale;
943
943
  const at = along(bar, nx, ny) - this._barGrab.offset - bar.trackStart;
944
944
  const from = bar.reversed ? bar.travel - at : at;
945
- const to = (from / bar.travel) * bar.range;
945
+ // Whole device pixels, as a wheel's default action moves (events.js).
946
+ // The pointer's share of the travel times the range is a fraction at
947
+ // almost every position, and a fractional offset costs the scroll blit,
948
+ // which can only shift by whole pixels, and draws everything in the
949
+ // pane off the pixel grid, where the X11 backend fills an edge or a
950
+ // rounded box through a coverage mask it uploads shape by shape. A
951
+ // thumb dragged through a 100,000-row table ran at 25 fps on XQuartz,
952
+ // with two thirds of the server's time in those masks, and at 52 once
953
+ // the offset was whole.
954
+ const to = Math.round((from / bar.travel) * bar.range);
946
955
  this._scrollToDevice(bar.axis === 'x' ? { x: to } : { y: to });
947
956
  }
948
957