nodebb-plugin-pdf-secure2 1.4.7 → 1.4.8
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 +1 -1
- package/static/viewer-app.js +10 -5
- package/static/viewer.html +14 -5
package/package.json
CHANGED
package/static/viewer-app.js
CHANGED
|
@@ -2787,18 +2787,23 @@
|
|
|
2787
2787
|
|
|
2788
2788
|
|
|
2789
2789
|
// Mouse wheel / touchpad pinch zoom with Ctrl (clamped 0.5x-5x)
|
|
2790
|
+
// Touchpad pinch fires 60+ small events/sec → must heavily dampen.
|
|
2791
|
+
// Mouse wheel fires fewer large events → needs separate handling.
|
|
2790
2792
|
let zoomAccumulator = 0;
|
|
2791
2793
|
let zoomRafId = null;
|
|
2792
2794
|
container.addEventListener('wheel', (e) => {
|
|
2793
2795
|
if (!e.ctrlKey) return;
|
|
2794
2796
|
e.preventDefault();
|
|
2795
2797
|
|
|
2796
|
-
// Touchpad pinch sends small deltaY values; mouse wheel sends large ones (100+)
|
|
2797
|
-
// Normalize: clamp large mouse wheel jumps, keep touchpad's fine granularity
|
|
2798
2798
|
const raw = e.deltaY;
|
|
2799
|
-
const
|
|
2800
|
-
|
|
2801
|
-
|
|
2799
|
+
const isMouseWheel = Math.abs(raw) >= 50;
|
|
2800
|
+
if (isMouseWheel) {
|
|
2801
|
+
zoomAccumulator += (raw < 0 ? 0.08 : -0.08);
|
|
2802
|
+
} else {
|
|
2803
|
+
const clamped = Math.max(-5, Math.min(5, raw));
|
|
2804
|
+
zoomAccumulator -= clamped * 0.002;
|
|
2805
|
+
}
|
|
2806
|
+
zoomAccumulator = Math.max(-0.04, Math.min(0.04, zoomAccumulator));
|
|
2802
2807
|
|
|
2803
2808
|
if (!zoomRafId) {
|
|
2804
2809
|
zoomRafId = requestAnimationFrame(() => {
|
package/static/viewer.html
CHANGED
|
@@ -7581,8 +7581,8 @@
|
|
|
7581
7581
|
|
|
7582
7582
|
|
|
7583
7583
|
// Mouse wheel / touchpad pinch zoom with Ctrl (clamped 0.5x–5x)
|
|
7584
|
-
// Touchpad pinch
|
|
7585
|
-
//
|
|
7584
|
+
// Touchpad pinch fires 60+ small events/sec → must heavily dampen.
|
|
7585
|
+
// Mouse wheel fires fewer large events → needs separate handling.
|
|
7586
7586
|
let zoomAccumulator = 0;
|
|
7587
7587
|
let zoomRafId = null;
|
|
7588
7588
|
container.addEventListener('wheel', (e) => {
|
|
@@ -7590,9 +7590,18 @@
|
|
|
7590
7590
|
e.preventDefault();
|
|
7591
7591
|
|
|
7592
7592
|
const raw = e.deltaY;
|
|
7593
|
-
|
|
7594
|
-
const
|
|
7595
|
-
|
|
7593
|
+
// Detect input type: mouse wheel sends |deltaY| >= 50, touchpad sends < 50
|
|
7594
|
+
const isMouseWheel = Math.abs(raw) >= 50;
|
|
7595
|
+
if (isMouseWheel) {
|
|
7596
|
+
// Mouse wheel: fixed step per click (ignore magnitude)
|
|
7597
|
+
zoomAccumulator += (raw < 0 ? 0.08 : -0.08);
|
|
7598
|
+
} else {
|
|
7599
|
+
// Touchpad: very low sensitivity, clamp individual delta
|
|
7600
|
+
const clamped = Math.max(-5, Math.min(5, raw));
|
|
7601
|
+
zoomAccumulator -= clamped * 0.002;
|
|
7602
|
+
}
|
|
7603
|
+
// Cap total accumulator per frame (max ~4% zoom per frame)
|
|
7604
|
+
zoomAccumulator = Math.max(-0.04, Math.min(0.04, zoomAccumulator));
|
|
7596
7605
|
|
|
7597
7606
|
if (!zoomRafId) {
|
|
7598
7607
|
zoomRafId = requestAnimationFrame(() => {
|