@opentui/core 0.1.45 → 0.1.47
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/3d.js +1 -1
- package/{index-bd7k864e.js → index-f5t80vp1.js} +51 -25
- package/{index-bd7k864e.js.map → index-f5t80vp1.js.map} +8 -8
- package/index.js +35 -6
- package/index.js.map +3 -3
- package/lib/KeyHandler.d.ts +0 -3
- package/package.json +7 -7
- package/renderables/ScrollBox.d.ts +3 -0
- package/testing.js +6 -3
- package/testing.js.map +4 -4
- package/zig.d.ts +2 -0
package/index.js
CHANGED
|
@@ -136,7 +136,7 @@ import {
|
|
|
136
136
|
white,
|
|
137
137
|
wrapWithDelegates,
|
|
138
138
|
yellow
|
|
139
|
-
} from "./index-
|
|
139
|
+
} from "./index-f5t80vp1.js";
|
|
140
140
|
// src/text-buffer-view.ts
|
|
141
141
|
class TextBufferView {
|
|
142
142
|
lib;
|
|
@@ -4100,6 +4100,8 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4100
4100
|
cachedAutoScrollSpeed = 3;
|
|
4101
4101
|
autoScrollAccumulatorX = 0;
|
|
4102
4102
|
autoScrollAccumulatorY = 0;
|
|
4103
|
+
scrollAccumulatorX = 0;
|
|
4104
|
+
scrollAccumulatorY = 0;
|
|
4103
4105
|
_stickyScroll;
|
|
4104
4106
|
_stickyScrollTop = false;
|
|
4105
4107
|
_stickyScrollBottom = false;
|
|
@@ -4375,14 +4377,35 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4375
4377
|
const baseDelta = event.scroll?.delta ?? 0;
|
|
4376
4378
|
const now = Date.now();
|
|
4377
4379
|
const multiplier = this.scrollAccel.tick(now);
|
|
4380
|
+
const scrollAmount = baseDelta * multiplier;
|
|
4378
4381
|
if (dir === "up") {
|
|
4379
|
-
this.
|
|
4382
|
+
this.scrollAccumulatorY -= scrollAmount;
|
|
4383
|
+
const integerScroll = Math.trunc(this.scrollAccumulatorY);
|
|
4384
|
+
if (integerScroll !== 0) {
|
|
4385
|
+
this.scrollTop += integerScroll;
|
|
4386
|
+
this.scrollAccumulatorY -= integerScroll;
|
|
4387
|
+
}
|
|
4380
4388
|
} else if (dir === "down") {
|
|
4381
|
-
this.
|
|
4389
|
+
this.scrollAccumulatorY += scrollAmount;
|
|
4390
|
+
const integerScroll = Math.trunc(this.scrollAccumulatorY);
|
|
4391
|
+
if (integerScroll !== 0) {
|
|
4392
|
+
this.scrollTop += integerScroll;
|
|
4393
|
+
this.scrollAccumulatorY -= integerScroll;
|
|
4394
|
+
}
|
|
4382
4395
|
} else if (dir === "left") {
|
|
4383
|
-
this.
|
|
4396
|
+
this.scrollAccumulatorX -= scrollAmount;
|
|
4397
|
+
const integerScroll = Math.trunc(this.scrollAccumulatorX);
|
|
4398
|
+
if (integerScroll !== 0) {
|
|
4399
|
+
this.scrollLeft += integerScroll;
|
|
4400
|
+
this.scrollAccumulatorX -= integerScroll;
|
|
4401
|
+
}
|
|
4384
4402
|
} else if (dir === "right") {
|
|
4385
|
-
this.
|
|
4403
|
+
this.scrollAccumulatorX += scrollAmount;
|
|
4404
|
+
const integerScroll = Math.trunc(this.scrollAccumulatorX);
|
|
4405
|
+
if (integerScroll !== 0) {
|
|
4406
|
+
this.scrollLeft += integerScroll;
|
|
4407
|
+
this.scrollAccumulatorX -= integerScroll;
|
|
4408
|
+
}
|
|
4386
4409
|
}
|
|
4387
4410
|
const maxScrollTop = Math.max(0, this.scrollHeight - this.viewport.height);
|
|
4388
4411
|
const maxScrollLeft = Math.max(0, this.scrollWidth - this.viewport.width);
|
|
@@ -4400,15 +4423,21 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
4400
4423
|
if (this.verticalScrollBar.handleKeyPress(key)) {
|
|
4401
4424
|
this._hasManualScroll = true;
|
|
4402
4425
|
this.scrollAccel.reset();
|
|
4426
|
+
this.resetScrollAccumulators();
|
|
4403
4427
|
return true;
|
|
4404
4428
|
}
|
|
4405
4429
|
if (this.horizontalScrollBar.handleKeyPress(key)) {
|
|
4406
4430
|
this._hasManualScroll = true;
|
|
4407
4431
|
this.scrollAccel.reset();
|
|
4432
|
+
this.resetScrollAccumulators();
|
|
4408
4433
|
return true;
|
|
4409
4434
|
}
|
|
4410
4435
|
return false;
|
|
4411
4436
|
}
|
|
4437
|
+
resetScrollAccumulators() {
|
|
4438
|
+
this.scrollAccumulatorX = 0;
|
|
4439
|
+
this.scrollAccumulatorY = 0;
|
|
4440
|
+
}
|
|
4412
4441
|
startAutoScroll(mouseX, mouseY) {
|
|
4413
4442
|
this.stopAutoScroll();
|
|
4414
4443
|
this.autoScrollMouseX = mouseX;
|
|
@@ -6422,5 +6451,5 @@ export {
|
|
|
6422
6451
|
ASCIIFont
|
|
6423
6452
|
};
|
|
6424
6453
|
|
|
6425
|
-
//# debugId=
|
|
6454
|
+
//# debugId=BF93FD4926B5BA4964756E2164756E21
|
|
6426
6455
|
//# sourceMappingURL=index.js.map
|