scroll-system 1.1.0 → 1.1.1
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/dist/hooks/useWheelHandler.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.mjs +18 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWheelHandler.d.ts","sourceRoot":"","sources":["../../hooks/useWheelHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"useWheelHandler.d.ts","sourceRoot":"","sources":["../../hooks/useWheelHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,wBAAgB,eAAe,SA2F9B"}
|
package/dist/index.js
CHANGED
|
@@ -324,6 +324,24 @@ function useWheelHandler() {
|
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
326
326
|
const normalized = normalizeWheel(event);
|
|
327
|
+
const activeView = state.views[state.activeIndex];
|
|
328
|
+
if (activeView?.capability === "internal") {
|
|
329
|
+
const scrollContainer = document.querySelector(
|
|
330
|
+
`[data-view-type="scroll-locked"][data-active="true"] > div`
|
|
331
|
+
);
|
|
332
|
+
if (scrollContainer) {
|
|
333
|
+
const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
|
|
334
|
+
const maxScroll = scrollHeight - clientHeight;
|
|
335
|
+
const isScrollingDown = normalized.pixelY > 0;
|
|
336
|
+
const isScrollingUp = normalized.pixelY < 0;
|
|
337
|
+
const isAtBottom = scrollTop >= maxScroll - 1;
|
|
338
|
+
const isAtTop = scrollTop <= 1;
|
|
339
|
+
if (isScrollingDown && !isAtBottom || isScrollingUp && !isAtTop) {
|
|
340
|
+
scrollAccumulator.current = 0;
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
327
345
|
const delta = normalized.pixelY;
|
|
328
346
|
scrollAccumulator.current += delta;
|
|
329
347
|
const now = Date.now();
|
package/dist/index.mjs
CHANGED
|
@@ -322,6 +322,24 @@ function useWheelHandler() {
|
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
324
|
const normalized = normalizeWheel(event);
|
|
325
|
+
const activeView = state.views[state.activeIndex];
|
|
326
|
+
if (activeView?.capability === "internal") {
|
|
327
|
+
const scrollContainer = document.querySelector(
|
|
328
|
+
`[data-view-type="scroll-locked"][data-active="true"] > div`
|
|
329
|
+
);
|
|
330
|
+
if (scrollContainer) {
|
|
331
|
+
const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
|
|
332
|
+
const maxScroll = scrollHeight - clientHeight;
|
|
333
|
+
const isScrollingDown = normalized.pixelY > 0;
|
|
334
|
+
const isScrollingUp = normalized.pixelY < 0;
|
|
335
|
+
const isAtBottom = scrollTop >= maxScroll - 1;
|
|
336
|
+
const isAtTop = scrollTop <= 1;
|
|
337
|
+
if (isScrollingDown && !isAtBottom || isScrollingUp && !isAtTop) {
|
|
338
|
+
scrollAccumulator.current = 0;
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
325
343
|
const delta = normalized.pixelY;
|
|
326
344
|
scrollAccumulator.current += delta;
|
|
327
345
|
const now = Date.now();
|
package/package.json
CHANGED