From 5076e9c65e8a2744bc2b5ab4a1107e5bf0c0e474 Mon Sep 17 00:00:00 2001 From: mikefinneran <110622959+mikefinneran@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:48:12 -0400 Subject: [PATCH] Use ctrl as meta key for 'find next' behavior. (#23214) (#23218) (#23219) * Use ctrl as meta key for 'find next' behavior. (#23214) * Use ctrl as meta key for 'find next' behavior. * Bugfix * Fix text layer scale bug. (#23216) --------- Co-authored-by: davywentwortht2it --- client/app/readerprototype/components/ReaderSearchBar.jsx | 4 +++- client/app/readerprototype/components/TextLayer.jsx | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/app/readerprototype/components/ReaderSearchBar.jsx b/client/app/readerprototype/components/ReaderSearchBar.jsx index 725d5f4b565..c6685fd312d 100644 --- a/client/app/readerprototype/components/ReaderSearchBar.jsx +++ b/client/app/readerprototype/components/ReaderSearchBar.jsx @@ -58,7 +58,9 @@ const ReaderSearchBar = () => { // handle keyboard control of search results useEffect(() => { const keyHandler = (event) => { - if (event.metaKey && event.code === 'KeyG') { + const metaKey = navigator.appVersion.includes('Win') ? 'ctrlKey' : 'metaKey'; + + if (event[metaKey] && event.code === 'KeyG') { event.preventDefault(); if (event.shiftKey) { previous(); diff --git a/client/app/readerprototype/components/TextLayer.jsx b/client/app/readerprototype/components/TextLayer.jsx index 81c0b9c24ae..802ff49355b 100644 --- a/client/app/readerprototype/components/TextLayer.jsx +++ b/client/app/readerprototype/components/TextLayer.jsx @@ -12,11 +12,10 @@ const TextLayer = memo((props) => { // tracking this, the search bar will report double the number of found instances const [hasRenderedText, setHasRenderedText] = useState(false); - const viewport = page.getViewport({ scale: zoomLevel / 100 }); + const viewport = page.getViewport({ scale: 1 }); const textLayerRef = useRef(null); let positionX = 0; let positionY = 0; - const fullSizeViewport = page.getViewport({ scale: 1 }); if (rotation.includes('90')) { positionX = viewport.height; @@ -30,8 +29,8 @@ const TextLayer = memo((props) => { } const textLayerStyle = { - width: `${fullSizeViewport.width}px`, - height: `${fullSizeViewport.height}px`, + width: `${viewport.width}px`, + height: `${viewport.height}px`, transformOrigin: 'left top', opacity: 1, position: 'absolute',