mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-25 04:56:13 +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
|
||||
React.useEffect(() => {
|
||||
let accumulator = 0;
|
||||
|
||||
const handleWheel = (event: WheelEvent) => {
|
||||
// Check if Ctrl (Windows/Linux) or Cmd (Mac) is pressed
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
// Convert smooth scrolling gestures into discrete notches
|
||||
accumulator += event.deltaY;
|
||||
const threshold = 10;
|
||||
|
||||
const zoomAPI = window.embedPdfZoom;
|
||||
if (zoomAPI) {
|
||||
if (accumulator <= -threshold) {
|
||||
if (event.deltaY < 0) {
|
||||
// Scroll up - zoom in
|
||||
zoomAPI.zoomIn();
|
||||
accumulator = 0;
|
||||
} else if (accumulator >= threshold) {
|
||||
} else {
|
||||
// Scroll down - zoom out
|
||||
zoomAPI.zoomOut();
|
||||
accumulator = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,5 +12,4 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
base: "http://localhost:8080",
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user