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