mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-25 13:06:12 +00:00
Compare commits
No commits in common. "81c5d8ff46dcc5fc983109fb2348b6d6dfb129d2" and "3755bfde3438c8688e56c028fc4479d64bcfc880" have entirely different histories.
81c5d8ff46
...
3755bfde34
@ -62,26 +62,20 @@ const EmbedPdfViewerContent = ({
|
|||||||
|
|
||||||
// Handle scroll wheel zoom
|
// Handle scroll wheel zoom
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
let accumulator = 0;
|
|
||||||
|
|
||||||
const handleWheel = (event: WheelEvent) => {
|
const handleWheel = (event: WheelEvent) => {
|
||||||
// Check if Ctrl (Windows/Linux) or Cmd (Mac) is pressed
|
// Check if Ctrl (Windows/Linux) or Cmd (Mac) is pressed
|
||||||
if (event.ctrlKey || event.metaKey) {
|
if (event.ctrlKey || event.metaKey) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
// Convert smooth scrolling gestures into discrete notches
|
|
||||||
accumulator += event.deltaY;
|
|
||||||
const threshold = 10;
|
|
||||||
|
|
||||||
const zoomAPI = window.embedPdfZoom;
|
const zoomAPI = window.embedPdfZoom;
|
||||||
if (zoomAPI) {
|
if (zoomAPI) {
|
||||||
if (accumulator <= -threshold) {
|
if (event.deltaY < 0) {
|
||||||
|
// Scroll up - zoom in
|
||||||
zoomAPI.zoomIn();
|
zoomAPI.zoomIn();
|
||||||
accumulator = 0;
|
} else {
|
||||||
} else if (accumulator >= threshold) {
|
// Scroll down - zoom out
|
||||||
zoomAPI.zoomOut();
|
zoomAPI.zoomOut();
|
||||||
accumulator = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,4 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
base: "http://localhost:8080",
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user