feat: include frame names in canvas searches (#9484)

* fix frame name clipping on zooming

* include assistant font

* default frame name

* extend search to frame names

* add a simple test

* collpase search match items

* id check out of loop

* fix frame name check

* include focusedId for small perf improvement

* optionally show and hide collapse icon

* update section title

* fix tests

* rename `serverSide` -> `private`

* revert: do not reset zoom on zoom change

* feat: do not close menu on repeated ctrl+f

* remove collapsible

* tweak results CSS

* remove redundant check

* set `appState.searchMatches` to null if empty

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
Ryan Di 2025-05-10 02:32:16 +10:00 committed by GitHub
parent ff2ed5d26a
commit a30e1b25c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 502 additions and 241 deletions

View File

@ -143,6 +143,7 @@ export const FONT_FAMILY = {
"Lilita One": 7, "Lilita One": 7,
"Comic Shanns": 8, "Comic Shanns": 8,
"Liberation Sans": 9, "Liberation Sans": 9,
Assistant: 10,
}; };
export const FONT_FAMILY_FALLBACKS = { export const FONT_FAMILY_FALLBACKS = {

View File

@ -22,8 +22,10 @@ export interface FontMetadata {
}; };
/** flag to indicate a deprecated font */ /** flag to indicate a deprecated font */
deprecated?: true; deprecated?: true;
/** flag to indicate a server-side only font */ /**
serverSide?: true; * whether this is a font that users can use (= shown in font picker)
*/
private?: true;
/** flag to indiccate a local-only font */ /** flag to indiccate a local-only font */
local?: true; local?: true;
/** flag to indicate a fallback font */ /** flag to indicate a fallback font */
@ -98,7 +100,16 @@ export const FONT_METADATA: Record<number, FontMetadata> = {
descender: -434, descender: -434,
lineHeight: 1.15, lineHeight: 1.15,
}, },
serverSide: true, private: true,
},
[FONT_FAMILY.Assistant]: {
metrics: {
unitsPerEm: 2048,
ascender: 1021,
descender: -287,
lineHeight: 1.25,
},
private: true,
}, },
[FONT_FAMILY_FALLBACKS.Xiaolai]: { [FONT_FAMILY_FALLBACKS.Xiaolai]: {
metrics: { metrics: {

View File

@ -905,13 +905,16 @@ export const shouldApplyFrameClip = (
return false; return false;
}; };
export const getFrameLikeTitle = (element: ExcalidrawFrameLikeElement) => { const DEFAULT_FRAME_NAME = "Frame";
const DEFAULT_AI_FRAME_NAME = "AI Frame";
export const getDefaultFrameName = (element: ExcalidrawFrameLikeElement) => {
// TODO name frames "AI" only if specific to AI frames // TODO name frames "AI" only if specific to AI frames
return element.name === null return isFrameElement(element) ? DEFAULT_FRAME_NAME : DEFAULT_AI_FRAME_NAME;
? isFrameElement(element) };
? "Frame"
: "AI Frame" export const getFrameLikeTitle = (element: ExcalidrawFrameLikeElement) => {
: element.name; return element.name === null ? getDefaultFrameName(element) : element.name;
}; };
export const getElementsOverlappingFrame = ( export const getElementsOverlappingFrame = (

View File

@ -34,13 +34,6 @@ export const actionToggleSearchMenu = register({
`.${CLASSES.SEARCH_MENU_INPUT_WRAPPER} input`, `.${CLASSES.SEARCH_MENU_INPUT_WRAPPER} input`,
); );
if (searchInput?.matches(":focus")) {
return {
appState: { ...appState, openSidebar: null },
captureUpdate: CaptureUpdateAction.EVENTUALLY,
};
}
searchInput?.focus(); searchInput?.focus();
searchInput?.select(); searchInput?.select();
return false; return false;

View File

@ -121,7 +121,7 @@ export const getDefaultAppState = (): Omit<
followedBy: new Set(), followedBy: new Set(),
isCropping: false, isCropping: false,
croppingElementId: null, croppingElementId: null,
searchMatches: [], searchMatches: null,
}; };
}; };

View File

@ -1417,8 +1417,19 @@ class App extends React.Component<AppProps, AppState> {
} }
const isDarkTheme = this.state.theme === THEME.DARK; const isDarkTheme = this.state.theme === THEME.DARK;
const nonDeletedFramesLikes = this.scene.getNonDeletedFramesLikes();
return this.scene.getNonDeletedFramesLikes().map((f) => { const focusedSearchMatch =
nonDeletedFramesLikes.length > 0
? this.state.searchMatches?.focusedId &&
isFrameLikeElement(
this.scene.getElement(this.state.searchMatches.focusedId),
)
? this.state.searchMatches.matches.find((sm) => sm.focus)
: null
: null;
return nonDeletedFramesLikes.map((f) => {
if ( if (
!isElementInViewport( !isElementInViewport(
f, f,
@ -1484,7 +1495,7 @@ class App extends React.Component<AppProps, AppState> {
borderRadius: 4, borderRadius: 4,
boxShadow: "inset 0 0 0 1px var(--color-primary)", boxShadow: "inset 0 0 0 1px var(--color-primary)",
fontFamily: "Assistant", fontFamily: "Assistant",
fontSize: "14px", fontSize: `${FRAME_STYLE.nameFontSize}px`,
transform: `translate(-${FRAME_NAME_EDIT_PADDING}px, ${FRAME_NAME_EDIT_PADDING}px)`, transform: `translate(-${FRAME_NAME_EDIT_PADDING}px, ${FRAME_NAME_EDIT_PADDING}px)`,
color: "var(--color-gray-80)", color: "var(--color-gray-80)",
overflow: "hidden", overflow: "hidden",
@ -1528,7 +1539,10 @@ class App extends React.Component<AppProps, AppState> {
: FRAME_STYLE.nameColorLightTheme, : FRAME_STYLE.nameColorLightTheme,
lineHeight: FRAME_STYLE.nameLineHeight, lineHeight: FRAME_STYLE.nameLineHeight,
width: "max-content", width: "max-content",
maxWidth: `${f.width}px`, maxWidth:
focusedSearchMatch?.id === f.id && focusedSearchMatch?.focus
? "none"
: `${f.width * this.state.zoom.value}px`,
overflow: f.id === this.state.editingFrame ? "visible" : "hidden", overflow: f.id === this.state.editingFrame ? "visible" : "hidden",
whiteSpace: "nowrap", whiteSpace: "nowrap",
textOverflow: "ellipsis", textOverflow: "ellipsis",
@ -6405,12 +6419,17 @@ class App extends React.Component<AppProps, AppState> {
this.maybeUnfollowRemoteUser(); this.maybeUnfollowRemoteUser();
if (this.state.searchMatches) { if (this.state.searchMatches) {
this.setState((state) => ({ this.setState((state) => {
searchMatches: state.searchMatches.map((searchMatch) => ({ return {
searchMatches: state.searchMatches && {
focusedId: null,
matches: state.searchMatches.matches.map((searchMatch) => ({
...searchMatch, ...searchMatch,
focus: false, focus: false,
})), })),
})); },
};
});
this.updateEditorAtom(searchItemInFocusAtom, null); this.updateEditorAtom(searchItemInFocusAtom, null);
} }

View File

@ -99,7 +99,7 @@ export const FontPickerList = React.memo(
() => () =>
Array.from(Fonts.registered.entries()) Array.from(Fonts.registered.entries())
.filter( .filter(
([_, { metadata }]) => !metadata.serverSide && !metadata.fallback, ([_, { metadata }]) => !metadata.private && !metadata.fallback,
) )
.map(([familyId, { metadata, fontFaces }]) => { .map(([familyId, { metadata, fontFaces }]) => {
const fontDescriptor = { const fontDescriptor = {

View File

@ -39,7 +39,7 @@ const getHints = ({
if ( if (
appState.openSidebar?.name === DEFAULT_SIDEBAR.name && appState.openSidebar?.name === DEFAULT_SIDEBAR.name &&
appState.openSidebar.tab === CANVAS_SEARCH_TAB && appState.openSidebar.tab === CANVAS_SEARCH_TAB &&
appState.searchMatches?.length appState.searchMatches?.matches.length
) { ) {
return t("hints.dismissSearch"); return t("hints.dismissSearch");
} }

View File

@ -1,4 +1,5 @@
@import "open-color/open-color"; @import "open-color/open-color";
@import "../css//variables.module.scss";
.excalidraw { .excalidraw {
.layer-ui__search { .layer-ui__search {
@ -64,21 +65,51 @@
flex: 1 1 0; flex: 1 1 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 0 0.75rem;
gap: 0.125rem; gap: 0.125rem;
} }
.layer-ui__search .collapsible-items {
gap: 2px;
}
.layer-ui__search-result-title {
font-size: 0.875rem;
margin-bottom: 0.25rem;
display: flex;
align-items: center;
gap: 0.25rem;
font-weight: 700;
.title-icon {
width: 0.875rem;
height: 0.875rem;
margin-right: 0.25rem;
svg g {
stroke-width: 1.25;
}
}
}
.layer-ui__divider {
width: 100%;
margin-top: 0.25rem;
margin-bottom: 1rem;
position: relative;
}
.layer-ui__result-item { .layer-ui__result-item {
display: flex; display: flex;
align-items: center; align-items: center;
min-height: 2rem; min-height: 1.875rem;
flex: 0 0 auto; flex: 0 0 auto;
padding: 0.25rem 0.75rem; padding: 0.25rem 0.75rem;
cursor: pointer; cursor: pointer;
border: 1px solid transparent; border: 1px solid transparent;
outline: none; outline: none;
font-size: 16px;
margin: 0 0.75rem;
border-radius: var(--border-radius-md); border-radius: var(--border-radius-md);
.text-icon { .text-icon {

View File

@ -1,9 +1,15 @@
import { round } from "@excalidraw/math"; import { round } from "@excalidraw/math";
import clsx from "clsx"; import clsx from "clsx";
import debounce from "lodash.debounce"; import debounce from "lodash.debounce";
import { Fragment, memo, useEffect, useRef, useState } from "react"; import { Fragment, memo, useEffect, useMemo, useRef, useState } from "react";
import { CLASSES, EVENT } from "@excalidraw/common"; import {
CLASSES,
EVENT,
FONT_FAMILY,
FRAME_STYLE,
getLineHeight,
} from "@excalidraw/common";
import { isElementCompletelyInViewport } from "@excalidraw/element/sizeHelpers"; import { isElementCompletelyInViewport } from "@excalidraw/element/sizeHelpers";
@ -17,9 +23,17 @@ import {
} from "@excalidraw/common"; } from "@excalidraw/common";
import { newTextElement } from "@excalidraw/element/newElement"; import { newTextElement } from "@excalidraw/element/newElement";
import { isTextElement } from "@excalidraw/element/typeChecks"; import {
isFrameLikeElement,
isTextElement,
} from "@excalidraw/element/typeChecks";
import type { ExcalidrawTextElement } from "@excalidraw/element/types"; import { getDefaultFrameName } from "@excalidraw/element/frame";
import type {
ExcalidrawFrameLikeElement,
ExcalidrawTextElement,
} from "@excalidraw/element/types";
import { atom, useAtom } from "../editor-jotai"; import { atom, useAtom } from "../editor-jotai";
@ -29,11 +43,17 @@ import { t } from "../i18n";
import { useApp, useExcalidrawSetAppState } from "./App"; import { useApp, useExcalidrawSetAppState } from "./App";
import { Button } from "./Button"; import { Button } from "./Button";
import { TextField } from "./TextField"; import { TextField } from "./TextField";
import { collapseDownIcon, upIcon, searchIcon } from "./icons"; import {
collapseDownIcon,
upIcon,
searchIcon,
frameToolIcon,
TextIcon,
} from "./icons";
import "./SearchMenu.scss"; import "./SearchMenu.scss";
import type { AppClassProperties } from "../types"; import type { AppClassProperties, SearchMatch } from "../types";
const searchQueryAtom = atom<string>(""); const searchQueryAtom = atom<string>("");
export const searchItemInFocusAtom = atom<number | null>(null); export const searchItemInFocusAtom = atom<number | null>(null);
@ -41,7 +61,7 @@ export const searchItemInFocusAtom = atom<number | null>(null);
const SEARCH_DEBOUNCE = 350; const SEARCH_DEBOUNCE = 350;
type SearchMatchItem = { type SearchMatchItem = {
textElement: ExcalidrawTextElement; element: ExcalidrawTextElement | ExcalidrawFrameLikeElement;
searchQuery: SearchQuery; searchQuery: SearchQuery;
index: number; index: number;
preview: { preview: {
@ -50,12 +70,7 @@ type SearchMatchItem = {
moreBefore: boolean; moreBefore: boolean;
moreAfter: boolean; moreAfter: boolean;
}; };
matchedLines: { matchedLines: SearchMatch["matchedLines"];
offsetX: number;
offsetY: number;
width: number;
height: number;
}[];
}; };
type SearchMatches = { type SearchMatches = {
@ -103,11 +118,16 @@ export const SearchMenu = () => {
searchedQueryRef.current = searchQuery; searchedQueryRef.current = searchQuery;
lastSceneNonceRef.current = app.scene.getSceneNonce(); lastSceneNonceRef.current = app.scene.getSceneNonce();
setAppState({ setAppState({
searchMatches: matchItems.map((searchMatch) => ({ searchMatches: matchItems.length
id: searchMatch.textElement.id, ? {
focusedId: null,
matches: matchItems.map((searchMatch) => ({
id: searchMatch.element.id,
focus: false, focus: false,
matchedLines: searchMatch.matchedLines, matchedLines: searchMatch.matchedLines,
})), })),
}
: null,
}); });
}); });
} }
@ -149,13 +169,25 @@ export const SearchMenu = () => {
useEffect(() => { useEffect(() => {
setAppState((state) => { setAppState((state) => {
if (!state.searchMatches) {
return null;
}
const focusedId =
focusIndex !== null
? state.searchMatches?.matches[focusIndex]?.id || null
: null;
return { return {
searchMatches: state.searchMatches.map((match, index) => { searchMatches: {
focusedId,
matches: state.searchMatches.matches.map((match, index) => {
if (index === focusIndex) { if (index === focusIndex) {
return { ...match, focus: true }; return { ...match, focus: true };
} }
return { ...match, focus: false }; return { ...match, focus: false };
}), }),
},
}; };
}); });
}, [focusIndex, setAppState]); }, [focusIndex, setAppState]);
@ -169,17 +201,21 @@ export const SearchMenu = () => {
const matchAsElement = newTextElement({ const matchAsElement = newTextElement({
text: match.searchQuery, text: match.searchQuery,
x: match.textElement.x + (match.matchedLines[0]?.offsetX ?? 0), x: match.element.x + (match.matchedLines[0]?.offsetX ?? 0),
y: match.textElement.y + (match.matchedLines[0]?.offsetY ?? 0), y: match.element.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,
fontSize: match.textElement.fontSize, fontSize: isFrameLikeElement(match.element)
fontFamily: match.textElement.fontFamily, ? FRAME_STYLE.nameFontSize
: match.element.fontSize,
fontFamily: isFrameLikeElement(match.element)
? FONT_FAMILY.Assistant
: match.element.fontFamily,
}); });
const FONT_SIZE_LEGIBILITY_THRESHOLD = 14; const FONT_SIZE_LEGIBILITY_THRESHOLD = 14;
const fontSize = match.textElement.fontSize; const fontSize = matchAsElement.fontSize;
const isTextTiny = const isTextTiny =
fontSize * zoomValue < FONT_SIZE_LEGIBILITY_THRESHOLD; fontSize * zoomValue < FONT_SIZE_LEGIBILITY_THRESHOLD;
@ -233,7 +269,7 @@ export const SearchMenu = () => {
searchedQueryRef.current = null; searchedQueryRef.current = null;
lastSceneNonceRef.current = undefined; lastSceneNonceRef.current = undefined;
setAppState({ setAppState({
searchMatches: [], searchMatches: null,
}); });
setIsSearching(false); setIsSearching(false);
}; };
@ -272,10 +308,6 @@ export const SearchMenu = () => {
} }
searchInputRef.current?.focus(); searchInputRef.current?.focus();
searchInputRef.current?.select(); searchInputRef.current?.select();
} else {
setAppState({
openSidebar: null,
});
} }
} }
@ -336,11 +368,16 @@ export const SearchMenu = () => {
searchedQueryRef.current = searchQuery; searchedQueryRef.current = searchQuery;
lastSceneNonceRef.current = app.scene.getSceneNonce(); lastSceneNonceRef.current = app.scene.getSceneNonce();
setAppState({ setAppState({
searchMatches: matchItems.map((searchMatch) => ({ searchMatches: matchItems.length
id: searchMatch.textElement.id, ? {
focusedId: null,
matches: matchItems.map((searchMatch) => ({
id: searchMatch.element.id,
focus: false, focus: false,
matchedLines: searchMatch.matchedLines, matchedLines: searchMatch.matchedLines,
})), })),
}
: null,
}); });
setIsSearching(false); setIsSearching(false);
@ -447,17 +484,56 @@ interface MatchListProps {
} }
const MatchListBase = (props: MatchListProps) => { const MatchListBase = (props: MatchListProps) => {
const frameNameMatches = useMemo(
() =>
props.matches.items.filter((match) => isFrameLikeElement(match.element)),
[props.matches],
);
const textMatches = useMemo(
() => props.matches.items.filter((match) => isTextElement(match.element)),
[props.matches],
);
return ( return (
<div>
{frameNameMatches.length > 0 && (
<div className="layer-ui__search-result-container"> <div className="layer-ui__search-result-container">
{props.matches.items.map((searchMatch, index) => ( <div className="layer-ui__search-result-title">
<div className="title-icon">{frameToolIcon}</div>
<div>{t("search.frames")}</div>
</div>
{frameNameMatches.map((searchMatch, index) => (
<ListItem <ListItem
key={searchMatch.textElement.id + searchMatch.index} key={searchMatch.element.id + searchMatch.index}
searchQuery={props.searchQuery} searchQuery={props.searchQuery}
preview={searchMatch.preview} preview={searchMatch.preview}
highlighted={index === props.focusIndex} highlighted={index === props.focusIndex}
onClick={() => props.onItemClick(index)} onClick={() => props.onItemClick(index)}
/> />
))} ))}
{textMatches.length > 0 && <div className="layer-ui__divider" />}
</div>
)}
{textMatches.length > 0 && (
<div className="layer-ui__search-result-container">
<div className="layer-ui__search-result-title">
<div className="title-icon">{TextIcon}</div>
<div>{t("search.texts")}</div>
</div>
{textMatches.map((searchMatch, index) => (
<ListItem
key={searchMatch.element.id + searchMatch.index}
searchQuery={props.searchQuery}
preview={searchMatch.preview}
highlighted={index + frameNameMatches.length === props.focusIndex}
onClick={() => props.onItemClick(index + frameNameMatches.length)}
/>
))}
</div>
)}
</div> </div>
); );
}; };
@ -592,12 +668,7 @@ const getMatchedLines = (
index, index,
index + searchQuery.length, index + searchQuery.length,
); );
const matchedLines: { const matchedLines: SearchMatch["matchedLines"] = [];
offsetX: number;
offsetY: number;
width: number;
height: number;
}[] = [];
for (const lineIndexRange of lineIndexRanges) { for (const lineIndexRange of lineIndexRanges) {
if (remainingQuery === "") { if (remainingQuery === "") {
@ -657,6 +728,7 @@ const getMatchedLines = (
offsetY, offsetY,
width, width,
height, height,
showOnCanvas: true,
}); });
startIndex += matchCapacity; startIndex += matchCapacity;
@ -666,6 +738,47 @@ const getMatchedLines = (
return matchedLines; return matchedLines;
}; };
const getMatchInFrame = (
frame: ExcalidrawFrameLikeElement,
searchQuery: SearchQuery,
index: number,
zoomValue: number,
): SearchMatch["matchedLines"] => {
const text = frame.name ?? getDefaultFrameName(frame);
const matchedText = text.slice(index, index + searchQuery.length);
const prefixText = text.slice(0, index);
const font = getFontString({
fontSize: FRAME_STYLE.nameFontSize,
fontFamily: FONT_FAMILY.Assistant,
});
const lineHeight = getLineHeight(FONT_FAMILY.Assistant);
const offset = measureText(prefixText, font, lineHeight);
// Correct non-zero width for empty string
if (prefixText === "") {
offset.width = 0;
}
const matchedMetrics = measureText(matchedText, font, lineHeight);
const offsetX = offset.width;
const offsetY = -offset.height - FRAME_STYLE.strokeWidth;
const width = matchedMetrics.width;
return [
{
offsetX,
offsetY,
width,
height: matchedMetrics.height,
showOnCanvas: offsetX + width <= frame.width * zoomValue,
},
];
};
const escapeSpecialCharacters = (string: string) => { const escapeSpecialCharacters = (string: string) => {
return string.replace(/[.*+?^${}()|[\]\\-]/g, "\\$&"); return string.replace(/[.*+?^${}()|[\]\\-]/g, "\\$&");
}; };
@ -686,9 +799,14 @@ const handleSearch = debounce(
isTextElement(el), isTextElement(el),
) as ExcalidrawTextElement[]; ) as ExcalidrawTextElement[];
texts.sort((a, b) => a.y - b.y); const frames = elements.filter((el) =>
isFrameLikeElement(el),
) as ExcalidrawFrameLikeElement[];
const matchItems: SearchMatchItem[] = []; texts.sort((a, b) => a.y - b.y);
frames.sort((a, b) => a.y - b.y);
const textMatches: SearchMatchItem[] = [];
const regex = new RegExp(escapeSpecialCharacters(searchQuery), "gi"); const regex = new RegExp(escapeSpecialCharacters(searchQuery), "gi");
@ -701,8 +819,35 @@ const handleSearch = debounce(
const matchedLines = getMatchedLines(textEl, searchQuery, match.index); const matchedLines = getMatchedLines(textEl, searchQuery, match.index);
if (matchedLines.length > 0) { if (matchedLines.length > 0) {
matchItems.push({ textMatches.push({
textElement: textEl, element: textEl,
searchQuery,
preview,
index: match.index,
matchedLines,
});
}
}
}
const frameMatches: SearchMatchItem[] = [];
for (const frame of frames) {
let match = null;
const name = frame.name ?? getDefaultFrameName(frame);
while ((match = regex.exec(name)) !== null) {
const preview = getMatchPreview(name, match.index, searchQuery);
const matchedLines = getMatchInFrame(
frame,
searchQuery,
match.index,
app.state.zoom.value,
);
if (matchedLines.length > 0) {
frameMatches.push({
element: frame,
searchQuery, searchQuery,
preview, preview,
index: match.index, index: match.index,
@ -716,9 +861,12 @@ const handleSearch = debounce(
app.visibleElements.map((visibleElement) => visibleElement.id), app.visibleElements.map((visibleElement) => visibleElement.id),
); );
// putting frame matches first
const matchItems: SearchMatchItem[] = [...frameMatches, ...textMatches];
const focusIndex = const focusIndex =
matchItems.findIndex((matchItem) => matchItems.findIndex((matchItem) =>
visibleIds.has(matchItem.textElement.id), visibleIds.has(matchItem.element.id),
) ?? null; ) ?? null;
cb(matchItems, focusIndex); cb(matchItems, focusIndex);

View File

@ -10,6 +10,7 @@ interface CollapsibleProps {
openTrigger: () => void; openTrigger: () => void;
children: React.ReactNode; children: React.ReactNode;
className?: string; className?: string;
showCollapsedIcon?: boolean;
} }
const Collapsible = ({ const Collapsible = ({
@ -18,6 +19,7 @@ const Collapsible = ({
openTrigger, openTrigger,
children, children,
className, className,
showCollapsedIcon = true,
}: CollapsibleProps) => { }: CollapsibleProps) => {
return ( return (
<> <>
@ -32,7 +34,9 @@ const Collapsible = ({
onClick={openTrigger} onClick={openTrigger}
> >
{label} {label}
{showCollapsedIcon && (
<InlineIcon icon={open ? collapseUpIcon : collapseDownIcon} /> <InlineIcon icon={open ? collapseUpIcon : collapseDownIcon} />
)}
</div> </div>
{open && ( {open && (
<div style={{ display: "flex", flexDirection: "column" }}> <div style={{ display: "flex", flexDirection: "column" }}>

View File

@ -184,7 +184,9 @@
"noMatch": "No matches found...", "noMatch": "No matches found...",
"singleResult": "result", "singleResult": "result",
"multipleResults": "results", "multipleResults": "results",
"placeholder": "Find text on canvas..." "placeholder": "Find text on canvas...",
"frames": "Frames",
"texts": "Texts"
}, },
"buttons": { "buttons": {
"clearReset": "Reset the canvas", "clearReset": "Reset the canvas",

View File

@ -1040,10 +1040,10 @@ const _renderInteractiveScene = ({
context.restore(); context.restore();
} }
appState.searchMatches.forEach(({ id, focus, matchedLines }) => { appState.searchMatches?.matches.forEach(({ id, focus, matchedLines }) => {
const element = elementsMap.get(id); const element = elementsMap.get(id);
if (element && isTextElement(element)) { if (element) {
const [elementX1, elementY1, , , cx, cy] = getElementAbsoluteCoords( const [elementX1, elementY1, , , cx, cy] = getElementAbsoluteCoords(
element, element,
elementsMap, elementsMap,
@ -1063,16 +1063,19 @@ const _renderInteractiveScene = ({
context.fillStyle = "rgba(99, 52, 0, 0.4)"; context.fillStyle = "rgba(99, 52, 0, 0.4)";
} }
const zoomFactor = isFrameLikeElement(element) ? appState.zoom.value : 1;
context.translate(appState.scrollX, appState.scrollY); context.translate(appState.scrollX, appState.scrollY);
context.translate(cx, cy); context.translate(cx, cy);
context.rotate(element.angle); context.rotate(element.angle);
matchedLines.forEach((matchedLine) => { matchedLines.forEach((matchedLine) => {
(matchedLine.showOnCanvas || focus) &&
context.fillRect( context.fillRect(
elementX1 + matchedLine.offsetX - cx, elementX1 + matchedLine.offsetX / zoomFactor - cx,
elementY1 + matchedLine.offsetY - cy, elementY1 + matchedLine.offsetY / zoomFactor - cy,
matchedLine.width, matchedLine.width / zoomFactor,
matchedLine.height, matchedLine.height / zoomFactor,
); );
}); });

View File

@ -961,7 +961,7 @@ exports[`contextMenu element > right-clicking on a group should select whole gro
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id1": true, "id1": true,
@ -1159,7 +1159,7 @@ exports[`contextMenu element > selecting 'Add to library' in context menu adds e
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -1373,7 +1373,7 @@ exports[`contextMenu element > selecting 'Bring forward' in context menu brings
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -1704,7 +1704,7 @@ exports[`contextMenu element > selecting 'Bring to front' in context menu brings
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -2035,7 +2035,7 @@ exports[`contextMenu element > selecting 'Copy styles' in context menu copies st
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -2249,7 +2249,7 @@ exports[`contextMenu element > selecting 'Delete' in context menu deletes elemen
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -2488,7 +2488,7 @@ exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id3": true, "id3": true,
}, },
@ -2790,7 +2790,7 @@ exports[`contextMenu element > selecting 'Group selection' in context menu group
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id3": true, "id3": true,
@ -3158,7 +3158,7 @@ exports[`contextMenu element > selecting 'Paste styles' in context menu pastes s
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -3639,7 +3639,7 @@ exports[`contextMenu element > selecting 'Send backward' in context menu sends e
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id3": true, "id3": true,
}, },
@ -3962,7 +3962,7 @@ exports[`contextMenu element > selecting 'Send to back' in context menu sends el
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id3": true, "id3": true,
}, },
@ -4287,7 +4287,7 @@ exports[`contextMenu element > selecting 'Ungroup selection' in context menu ung
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id3": true, "id3": true,
@ -5566,7 +5566,7 @@ exports[`contextMenu element > shows 'Group selection' in context menu for multi
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id3": true, "id3": true,
@ -6785,7 +6785,7 @@ exports[`contextMenu element > shows 'Ungroup selection' in context menu for gro
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id3": true, "id3": true,
@ -7719,7 +7719,7 @@ exports[`contextMenu element > shows context menu for canvas > [end of test] app
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -8714,7 +8714,7 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -9706,7 +9706,7 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id1": true, "id1": true,
}, },

View File

@ -84,7 +84,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id691": true, "id691": true,
}, },
@ -673,7 +673,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id668": true, "id668": true,
}, },
@ -1181,7 +1181,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -1547,7 +1547,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -1914,7 +1914,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -2176,7 +2176,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id740": true, "id740": true,
}, },
@ -2614,7 +2614,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -2911,7 +2911,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -3193,7 +3193,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -3485,7 +3485,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -3769,7 +3769,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -4002,7 +4002,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -4259,7 +4259,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -4530,7 +4530,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -4759,7 +4759,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -4988,7 +4988,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -5215,7 +5215,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -5442,7 +5442,7 @@ exports[`history > multiplayer undo/redo > conflicts in frames and their childre
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -5699,7 +5699,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -6030,7 +6030,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -6457,7 +6457,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id433": true, "id433": true,
"id434": true, "id434": true,
@ -6836,7 +6836,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id452": true, "id452": true,
"id453": true, "id453": true,
@ -7151,7 +7151,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id486": true, "id486": true,
}, },
@ -7450,7 +7450,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -7678,7 +7678,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -8032,7 +8032,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -8389,7 +8389,7 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id542": true, "id542": true,
"id545": true, "id545": true,
@ -8792,7 +8792,7 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -9077,7 +9077,7 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id531": true, "id531": true,
}, },
@ -9341,7 +9341,7 @@ exports[`history > multiplayer undo/redo > should not override remote changes on
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id333": true, "id333": true,
}, },
@ -9606,7 +9606,7 @@ exports[`history > multiplayer undo/redo > should not override remote changes on
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id342": true, "id342": true,
}, },
@ -9839,7 +9839,7 @@ exports[`history > multiplayer undo/redo > should override remotely added groups
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -10135,7 +10135,7 @@ exports[`history > multiplayer undo/redo > should override remotely added points
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id379": true, "id379": true,
}, },
@ -10475,7 +10475,7 @@ exports[`history > multiplayer undo/redo > should redistribute deltas when eleme
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -10712,7 +10712,7 @@ exports[`history > multiplayer undo/redo > should redraw arrows on undo > [end o
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -11157,7 +11157,7 @@ exports[`history > multiplayer undo/redo > should update history entries after r
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id349": true, "id349": true,
}, },
@ -11413,7 +11413,7 @@ exports[`history > singleplayer undo/redo > remounting undo/redo buttons should
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -11650,7 +11650,7 @@ exports[`history > singleplayer undo/redo > should clear the redo stack on eleme
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id50": true, "id50": true,
}, },
@ -11889,7 +11889,7 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -12293,7 +12293,7 @@ exports[`history > singleplayer undo/redo > should create new history entry on s
"resizingElement": null, "resizingElement": null,
"scrollX": -50, "scrollX": -50,
"scrollY": -50, "scrollY": -50,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -12535,7 +12535,7 @@ exports[`history > singleplayer undo/redo > should disable undo/redo buttons whe
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id323": true, "id323": true,
}, },
@ -12774,7 +12774,7 @@ exports[`history > singleplayer undo/redo > should end up with no history entry
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id70": true, "id70": true,
}, },
@ -13015,7 +13015,7 @@ exports[`history > singleplayer undo/redo > should iterate through the history w
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -13260,7 +13260,7 @@ exports[`history > singleplayer undo/redo > should not clear the redo stack on s
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id18": true, "id18": true,
}, },
@ -13596,7 +13596,7 @@ exports[`history > singleplayer undo/redo > should not collapse when applying co
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -13763,7 +13763,7 @@ exports[`history > singleplayer undo/redo > should not end up with history entry
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id4": true, "id4": true,
"id5": true, "id5": true,
@ -14052,7 +14052,7 @@ exports[`history > singleplayer undo/redo > should not end up with history entry
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -14316,7 +14316,7 @@ exports[`history > singleplayer undo/redo > should not override appstate changes
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id29": true, "id29": true,
}, },
@ -14595,7 +14595,7 @@ exports[`history > singleplayer undo/redo > should support appstate name or view
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -14754,7 +14754,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id243": true, "id243": true,
}, },
@ -15453,7 +15453,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id225": true, "id225": true,
}, },
@ -16071,7 +16071,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id262": true, "id262": true,
}, },
@ -16687,7 +16687,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id275": true, "id275": true,
}, },
@ -17402,7 +17402,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id297": true, "id297": true,
"id299": true, "id299": true,
@ -18153,7 +18153,7 @@ exports[`history > singleplayer undo/redo > should support changes in elements'
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id189": true, "id189": true,
"id195": true, "id195": true,
@ -18631,7 +18631,7 @@ exports[`history > singleplayer undo/redo > should support duplication of groups
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id184": true, "id184": true,
"id186": true, "id186": true,
@ -19152,7 +19152,7 @@ exports[`history > singleplayer undo/redo > should support element creation, del
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -19611,7 +19611,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati
"resizingElement": null, "resizingElement": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id119": true, "id119": true,
}, },

View File

@ -88,7 +88,7 @@ exports[`given element A and group of elements B and given both are selected whe
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id6": true, "id6": true,
@ -508,7 +508,7 @@ exports[`given element A and group of elements B and given both are selected whe
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id3": true, "id3": true,
}, },
@ -914,7 +914,7 @@ exports[`regression tests > Cmd/Ctrl-click exclusively select element under poin
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id19": true, "id19": true,
}, },
@ -1468,7 +1468,7 @@ exports[`regression tests > Drags selected element when hitting only bounding bo
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -1673,7 +1673,7 @@ exports[`regression tests > adjusts z order when grouping > [end of test] appSta
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id6": true, "id6": true,
@ -2051,7 +2051,7 @@ exports[`regression tests > alt-drag duplicates an element > [end of test] appSt
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id4": true, "id4": true,
}, },
@ -2283,7 +2283,7 @@ exports[`regression tests > arrow keys > [end of test] appState 1`] = `
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -2463,7 +2463,7 @@ exports[`regression tests > can drag element that covers another element, while
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id3": true, "id3": true,
}, },
@ -2782,7 +2782,7 @@ exports[`regression tests > change the properties of a shape > [end of test] app
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -3031,7 +3031,7 @@ exports[`regression tests > click on an element and drag it > [dragged] appState
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -3270,7 +3270,7 @@ exports[`regression tests > click on an element and drag it > [end of test] appS
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -3500,7 +3500,7 @@ exports[`regression tests > click to select a shape > [end of test] appState 1`]
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -3756,7 +3756,7 @@ exports[`regression tests > click-drag to select a group > [end of test] appStat
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id3": true, "id3": true,
@ -4066,7 +4066,7 @@ exports[`regression tests > deleting last but one element in editing group shoul
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id3": true, "id3": true,
}, },
@ -4497,7 +4497,7 @@ exports[`regression tests > deselects group of selected elements on pointer down
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -4780,7 +4780,7 @@ exports[`regression tests > deselects group of selected elements on pointer up w
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -5032,7 +5032,7 @@ exports[`regression tests > deselects selected element on pointer down when poin
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -5240,7 +5240,7 @@ exports[`regression tests > deselects selected element, on pointer up, when clic
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -5436,7 +5436,7 @@ exports[`regression tests > double click to edit a group > [end of test] appStat
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id6": true, "id6": true,
}, },
@ -5824,7 +5824,7 @@ exports[`regression tests > drags selected elements from point inside common bou
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id3": true, "id3": true,
@ -6112,7 +6112,7 @@ exports[`regression tests > draw every type of shape > [end of test] appState 1`
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -6933,7 +6933,7 @@ exports[`regression tests > given a group of selected elements with an element t
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id3": true, "id3": true,
}, },
@ -7264,7 +7264,7 @@ exports[`regression tests > given a selected element A and a not selected elemen
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id3": true, "id3": true,
@ -7541,7 +7541,7 @@ exports[`regression tests > given selected element A with lower z-index than uns
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id1": true, "id1": true,
}, },
@ -7774,7 +7774,7 @@ exports[`regression tests > given selected element A with lower z-index than uns
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -8008,7 +8008,7 @@ exports[`regression tests > key 2 selects rectangle tool > [end of test] appStat
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -8186,7 +8186,7 @@ exports[`regression tests > key 3 selects diamond tool > [end of test] appState
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -8364,7 +8364,7 @@ exports[`regression tests > key 4 selects ellipse tool > [end of test] appState
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -8542,7 +8542,7 @@ exports[`regression tests > key 5 selects arrow tool > [end of test] appState 1`
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -8763,7 +8763,7 @@ exports[`regression tests > key 6 selects line tool > [end of test] appState 1`]
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -8983,7 +8983,7 @@ exports[`regression tests > key 7 selects freedraw tool > [end of test] appState
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -9175,7 +9175,7 @@ exports[`regression tests > key a selects arrow tool > [end of test] appState 1`
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -9396,7 +9396,7 @@ exports[`regression tests > key d selects diamond tool > [end of test] appState
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -9574,7 +9574,7 @@ exports[`regression tests > key l selects line tool > [end of test] appState 1`]
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -9794,7 +9794,7 @@ exports[`regression tests > key o selects ellipse tool > [end of test] appState
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -9972,7 +9972,7 @@ exports[`regression tests > key p selects freedraw tool > [end of test] appState
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -10164,7 +10164,7 @@ exports[`regression tests > key r selects rectangle tool > [end of test] appStat
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -10346,7 +10346,7 @@ exports[`regression tests > make a group and duplicate it > [end of test] appSta
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id16": true, "id16": true,
"id18": true, "id18": true,
@ -10842,7 +10842,7 @@ exports[`regression tests > noop interaction after undo shouldn't create history
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id3": true, "id3": true,
}, },
@ -11118,7 +11118,7 @@ exports[`regression tests > pinch-to-zoom works > [end of test] appState 1`] = `
"scrollX": "-6.25000", "scrollX": "-6.25000",
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -11241,7 +11241,7 @@ exports[`regression tests > shift click on selected element should deselect it o
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -11440,7 +11440,7 @@ exports[`regression tests > shift-click to multiselect, then drag > [end of test
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id3": true, "id3": true,
@ -11754,7 +11754,7 @@ exports[`regression tests > should group elements and ungroup them > [end of tes
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id3": true, "id3": true,
@ -12170,7 +12170,7 @@ exports[`regression tests > single-clicking on a subgroup of a selected group sh
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
"id15": true, "id15": true,
@ -12790,7 +12790,7 @@ exports[`regression tests > spacebar + drag scrolls the canvas > [end of test] a
"scrollX": 60, "scrollX": 60,
"scrollY": 60, "scrollY": 60,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -12913,7 +12913,7 @@ exports[`regression tests > supports nested groups > [end of test] appState 1`]
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id3": true, "id3": true,
}, },
@ -13508,7 +13508,7 @@ exports[`regression tests > switches from group of selected elements to another
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -13846,7 +13846,7 @@ exports[`regression tests > switches selected element on pointer down > [end of
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id0": true, "id0": true,
}, },
@ -14108,7 +14108,7 @@ exports[`regression tests > two-finger scroll works > [end of test] appState 1`]
"scrollX": 20, "scrollX": 20,
"scrollY": "-18.53553", "scrollY": "-18.53553",
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -14229,7 +14229,7 @@ exports[`regression tests > undo/redo drawing an element > [end of test] appStat
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": { "selectedElementIds": {
"id3": true, "id3": true,
}, },
@ -14612,7 +14612,7 @@ exports[`regression tests > updates fontSize & fontFamily appState > [end of tes
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},
@ -14736,7 +14736,7 @@ exports[`regression tests > zoom hotkeys > [end of test] appState 1`] = `
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},

View File

@ -7,7 +7,10 @@ import {
KEYS, KEYS,
} from "@excalidraw/common"; } from "@excalidraw/common";
import type { ExcalidrawTextElement } from "@excalidraw/element/types"; import type {
ExcalidrawFrameLikeElement,
ExcalidrawTextElement,
} from "@excalidraw/element/types";
import { Excalidraw } from "../index"; import { Excalidraw } from "../index";
@ -97,17 +100,17 @@ describe("search", () => {
updateTextEditor(searchInput, "test"); updateTextEditor(searchInput, "test");
await waitFor(() => { await waitFor(() => {
expect(h.app.state.searchMatches.length).toBe(2); expect(h.app.state.searchMatches?.matches.length).toBe(2);
expect(h.app.state.searchMatches[0].focus).toBe(true); expect(h.app.state.searchMatches?.matches[0].focus).toBe(true);
}); });
Keyboard.keyPress(KEYS.ENTER, searchInput); Keyboard.keyPress(KEYS.ENTER, searchInput);
expect(h.app.state.searchMatches[0].focus).toBe(false); expect(h.app.state.searchMatches?.matches[0].focus).toBe(false);
expect(h.app.state.searchMatches[1].focus).toBe(true); expect(h.app.state.searchMatches?.matches[1].focus).toBe(true);
Keyboard.keyPress(KEYS.ENTER, searchInput); Keyboard.keyPress(KEYS.ENTER, searchInput);
expect(h.app.state.searchMatches[0].focus).toBe(true); expect(h.app.state.searchMatches?.matches[0].focus).toBe(true);
expect(h.app.state.searchMatches[1].focus).toBe(false); expect(h.app.state.searchMatches?.matches[1].focus).toBe(false);
}); });
it("should match text split across multiple lines", async () => { it("should match text split across multiple lines", async () => {
@ -142,15 +145,53 @@ describe("search", () => {
updateTextEditor(searchInput, "test"); updateTextEditor(searchInput, "test");
await waitFor(() => { await waitFor(() => {
expect(h.app.state.searchMatches.length).toBe(1); expect(h.app.state.searchMatches?.matches.length).toBe(1);
expect(h.app.state.searchMatches[0]?.matchedLines?.length).toBe(4); expect(h.app.state.searchMatches?.matches[0]?.matchedLines?.length).toBe(
4,
);
}); });
updateTextEditor(searchInput, "ext spli"); updateTextEditor(searchInput, "ext spli");
await waitFor(() => { await waitFor(() => {
expect(h.app.state.searchMatches.length).toBe(1); expect(h.app.state.searchMatches?.matches.length).toBe(1);
expect(h.app.state.searchMatches[0]?.matchedLines?.length).toBe(6); expect(h.app.state.searchMatches?.matches[0]?.matchedLines?.length).toBe(
6,
);
});
});
it("should match frame names", async () => {
const scrollIntoViewMock = jest.fn();
window.HTMLElement.prototype.scrollIntoView = scrollIntoViewMock;
API.setElements([
API.createElement({
type: "frame",
}),
]);
API.updateElement(h.elements[0] as ExcalidrawFrameLikeElement, {
name: "Frame: name test for frame, yes, frame!",
});
expect(h.app.state.openSidebar).toBeNull();
Keyboard.withModifierKeys({ ctrl: true }, () => {
Keyboard.keyPress(KEYS.F);
});
expect(h.app.state.openSidebar).not.toBeNull();
expect(h.app.state.openSidebar?.name).toBe(DEFAULT_SIDEBAR.name);
expect(h.app.state.openSidebar?.tab).toBe(CANVAS_SEARCH_TAB);
const searchInput = await querySearchInput();
expect(searchInput.matches(":focus")).toBe(true);
updateTextEditor(searchInput, "frame");
await waitFor(() => {
expect(h.app.state.searchMatches?.matches.length).toBe(3);
}); });
}); });
}); });

View File

@ -432,10 +432,14 @@ export interface AppState {
isCropping: boolean; isCropping: boolean;
croppingElementId: ExcalidrawElement["id"] | null; croppingElementId: ExcalidrawElement["id"] | null;
searchMatches: readonly SearchMatch[]; /** null if no search matches found / search closed */
searchMatches: Readonly<{
focusedId: ExcalidrawElement["id"] | null;
matches: readonly SearchMatch[];
}> | null;
} }
type SearchMatch = { export type SearchMatch = {
id: string; id: string;
focus: boolean; focus: boolean;
matchedLines: { matchedLines: {
@ -443,6 +447,7 @@ type SearchMatch = {
offsetY: number; offsetY: number;
width: number; width: number;
height: number; height: number;
showOnCanvas: boolean;
}[]; }[];
}; };

View File

@ -85,7 +85,7 @@ exports[`exportToSvg > with default arguments 1`] = `
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"scrolledOutside": false, "scrolledOutside": false,
"searchMatches": [], "searchMatches": null,
"selectedElementIds": {}, "selectedElementIds": {},
"selectedElementsAreBeingDragged": false, "selectedElementsAreBeingDragged": false,
"selectedGroupIds": {}, "selectedGroupIds": {},