Compare commits

...

2 Commits

Author SHA1 Message Date
James Brunton
81c5d8ff46 Potential fix for mime type issues 2025-09-16 16:06:40 +01:00
James Brunton
a67f5199d3 Improvements for scroll gestures 2025-09-16 16:06:27 +01:00
2 changed files with 21 additions and 14 deletions

View File

@ -62,20 +62,26 @@ 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 (event.deltaY < 0) {
// Scroll up - zoom in
if (accumulator <= -threshold) {
zoomAPI.zoomIn();
} else {
// Scroll down - zoom out
accumulator = 0;
} else if (accumulator >= threshold) {
zoomAPI.zoomOut();
accumulator = 0;
}
}
}

View File

@ -12,4 +12,5 @@ export default defineConfig({
},
},
},
base: "http://localhost:8080",
});