mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Zoom to tiny text
This commit is contained in:
parent
d107215564
commit
d45dc931ee
1 changed files with 8 additions and 1 deletions
|
@ -135,12 +135,17 @@ export const SearchMenu = () => {
|
||||||
if (match) {
|
if (match) {
|
||||||
const matchAsElement = newTextElement({
|
const matchAsElement = newTextElement({
|
||||||
text: match.keyword,
|
text: match.keyword,
|
||||||
|
rawText: match.keyword,
|
||||||
x: match.textElement.x + (match.matchedLines[0]?.offsetX ?? 0),
|
x: match.textElement.x + (match.matchedLines[0]?.offsetX ?? 0),
|
||||||
y: match.textElement.y + (match.matchedLines[0]?.offsetY ?? 0),
|
y: match.textElement.y + (match.matchedLines[0]?.offsetY ?? 0),
|
||||||
width: match.matchedLines[0]?.width,
|
width: match.matchedLines[0]?.width,
|
||||||
height: match.matchedLines[0]?.height,
|
height: match.matchedLines[0]?.height,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const isTinyText =
|
||||||
|
app.state.zoom.value *
|
||||||
|
searchMatches.items[focusIndex].textElement.fontSize <
|
||||||
|
16;
|
||||||
if (
|
if (
|
||||||
!isElementCompletelyInViewport(
|
!isElementCompletelyInViewport(
|
||||||
[matchAsElement],
|
[matchAsElement],
|
||||||
|
@ -155,12 +160,14 @@ export const SearchMenu = () => {
|
||||||
},
|
},
|
||||||
app.scene.getNonDeletedElementsMap(),
|
app.scene.getNonDeletedElementsMap(),
|
||||||
app.getEditorUIOffsets(),
|
app.getEditorUIOffsets(),
|
||||||
)
|
) ||
|
||||||
|
isTinyText
|
||||||
) {
|
) {
|
||||||
app.scrollToContent(matchAsElement, {
|
app.scrollToContent(matchAsElement, {
|
||||||
fitToContent: true,
|
fitToContent: true,
|
||||||
animate: true,
|
animate: true,
|
||||||
duration: 300,
|
duration: 300,
|
||||||
|
...(isTinyText ? { viewportZoomFactor: 1 } : {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue