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
|
// Register zoom plugin with configuration
|
||||||
createPluginRegistration(ZoomPluginPackage, {
|
createPluginRegistration(ZoomPluginPackage, {
|
||||||
defaultZoomLevel: 1.0, // Start at exactly 100% zoom
|
defaultZoomLevel: 1.4, // Start at 140% zoom for better readability
|
||||||
minZoom: 0.2,
|
minZoom: 0.2,
|
||||||
maxZoom: 3.0,
|
maxZoom: 3.0,
|
||||||
}),
|
}),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
import { useZoom } from '@embedpdf/plugin-zoom/react';
|
import { useZoom } from '@embedpdf/plugin-zoom/react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -6,17 +6,30 @@ import { useZoom } from '@embedpdf/plugin-zoom/react';
|
|||||||
*/
|
*/
|
||||||
export function ZoomAPIBridge() {
|
export function ZoomAPIBridge() {
|
||||||
const { provides: zoom, state: zoomState } = useZoom();
|
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(() => {
|
useEffect(() => {
|
||||||
if (zoom) {
|
if (zoom) {
|
||||||
|
|
||||||
// Export zoom controls to global window for right rail access
|
// Export zoom controls to global window for right rail access
|
||||||
(window as any).embedPdfZoom = {
|
(window as any).embedPdfZoom = {
|
||||||
zoomIn: () => zoom.zoomIn(),
|
zoomIn: () => zoom.zoomIn(),
|
||||||
zoomOut: () => zoom.zoomOut(),
|
zoomOut: () => zoom.zoomOut(),
|
||||||
toggleMarqueeZoom: () => zoom.toggleMarqueeZoom(),
|
toggleMarqueeZoom: () => zoom.toggleMarqueeZoom(),
|
||||||
requestZoom: (level: any) => zoom.requestZoom(level),
|
requestZoom: (level: any) => zoom.requestZoom(level),
|
||||||
currentZoom: zoomState?.currentZoomLevel || 1,
|
currentZoom: zoomState?.currentZoomLevel || 1.4,
|
||||||
zoomPercent: Math.round((zoomState?.currentZoomLevel || 1) * 100),
|
zoomPercent: Math.round((zoomState?.currentZoomLevel || 1.4) * 100),
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user