nodebb-plugin-pdf-secure2 1.4.6 → 1.4.7
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.html +21 -9
package/package.json
CHANGED
package/static/viewer.html
CHANGED
|
@@ -7580,16 +7580,28 @@
|
|
|
7580
7580
|
|
|
7581
7581
|
|
|
7582
7582
|
|
|
7583
|
-
// Mouse wheel zoom with Ctrl
|
|
7583
|
+
// Mouse wheel / touchpad pinch zoom with Ctrl (clamped 0.5x–5x)
|
|
7584
|
+
// Touchpad pinch sends many small deltaY events; mouse wheel sends large ones (100+).
|
|
7585
|
+
// We accumulate deltas and apply once per frame to keep zoom smooth on both.
|
|
7586
|
+
let zoomAccumulator = 0;
|
|
7587
|
+
let zoomRafId = null;
|
|
7584
7588
|
container.addEventListener('wheel', (e) => {
|
|
7585
|
-
if (e.ctrlKey)
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7589
|
+
if (!e.ctrlKey) return;
|
|
7590
|
+
e.preventDefault();
|
|
7591
|
+
|
|
7592
|
+
const raw = e.deltaY;
|
|
7593
|
+
const clamped = Math.max(-10, Math.min(10, raw));
|
|
7594
|
+
const sensitivity = 0.008;
|
|
7595
|
+
zoomAccumulator -= clamped * sensitivity;
|
|
7596
|
+
|
|
7597
|
+
if (!zoomRafId) {
|
|
7598
|
+
zoomRafId = requestAnimationFrame(() => {
|
|
7599
|
+
const newScale = pdfViewer.currentScale * (1 + zoomAccumulator);
|
|
7600
|
+
pdfViewer.currentScale = Math.max(0.5, Math.min(5, newScale));
|
|
7601
|
+
zoomAccumulator = 0;
|
|
7602
|
+
zoomRafId = null;
|
|
7603
|
+
updateAllWatermarkScales();
|
|
7604
|
+
});
|
|
7593
7605
|
}
|
|
7594
7606
|
}, { passive: false });
|
|
7595
7607
|
|