mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-18 09:29:24 +00:00
Set zoom to 140%
This commit is contained in:
parent
2834eec3be
commit
3755bfde34
@ -87,7 +87,7 @@ export function LocalEmbedPDF({ file, url, colorScheme }: LocalEmbedPDFProps) {
|
||||
|
||||
// Register zoom plugin with configuration
|
||||
createPluginRegistration(ZoomPluginPackage, {
|
||||
defaultZoomLevel: 1.0, // Start at exactly 100% zoom
|
||||
defaultZoomLevel: 1.4, // Start at 140% zoom for better readability
|
||||
minZoom: 0.2,
|
||||
maxZoom: 3.0,
|
||||
}),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useZoom } from '@embedpdf/plugin-zoom/react';
|
||||
|
||||
/**
|
||||
@ -6,17 +6,30 @@ import { useZoom } from '@embedpdf/plugin-zoom/react';
|
||||
*/
|
||||
export function ZoomAPIBridge() {
|
||||
const { provides: zoom, state: zoomState } = useZoom();
|
||||
const hasSetInitialZoom = useRef(false);
|
||||
|
||||
// Set initial zoom once when plugin is ready
|
||||
useEffect(() => {
|
||||
if (zoom && !hasSetInitialZoom.current) {
|
||||
hasSetInitialZoom.current = true;
|
||||
setTimeout(() => {
|
||||
console.log('Setting initial zoom to 140%');
|
||||
zoom.requestZoom(1.4);
|
||||
}, 50);
|
||||
}
|
||||
}, [zoom]);
|
||||
|
||||
useEffect(() => {
|
||||
if (zoom) {
|
||||
|
||||
// Export zoom controls to global window for right rail access
|
||||
(window as any).embedPdfZoom = {
|
||||
zoomIn: () => zoom.zoomIn(),
|
||||
zoomOut: () => zoom.zoomOut(),
|
||||
toggleMarqueeZoom: () => zoom.toggleMarqueeZoom(),
|
||||
requestZoom: (level: any) => zoom.requestZoom(level),
|
||||
currentZoom: zoomState?.currentZoomLevel || 1,
|
||||
zoomPercent: Math.round((zoomState?.currentZoomLevel || 1) * 100),
|
||||
currentZoom: zoomState?.currentZoomLevel || 1.4,
|
||||
zoomPercent: Math.round((zoomState?.currentZoomLevel || 1.4) * 100),
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user