fix: Test hook usage in production code (#9645)

This commit is contained in:
Márk Tolmács 2025-06-12 10:39:50 +02:00 committed by GitHub
parent f42e1ab64e
commit 9f3fdf5505
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 10 deletions

View File

@ -16,6 +16,7 @@ import {
} from "@excalidraw/math";
import type {
ElementsMap,
ExcalidrawDiamondElement,
ExcalidrawRectanguloidElement,
} from "@excalidraw/element/types";
@ -128,14 +129,12 @@ function drawCatmullRomCubicApprox(
export const drawHighlightForRectWithRotation = (
context: CanvasRenderingContext2D,
element: ExcalidrawRectanguloidElement,
elementsMap: ElementsMap,
padding: number,
) => {
const [x, y] = pointRotateRads(
pointFrom<GlobalPoint>(element.x, element.y),
elementCenterPoint(
element,
window.h.app.scene.getElementsMapIncludingDeleted(),
),
elementCenterPoint(element, elementsMap),
element.angle,
);
@ -289,13 +288,11 @@ export const drawHighlightForDiamondWithRotation = (
context: CanvasRenderingContext2D,
padding: number,
element: ExcalidrawDiamondElement,
elementsMap: ElementsMap,
) => {
const [x, y] = pointRotateRads(
pointFrom<GlobalPoint>(element.x, element.y),
elementCenterPoint(
element,
window.h.app.scene.getElementsMapIncludingDeleted(),
),
elementCenterPoint(element, elementsMap),
element.angle,
);
context.save();

View File

@ -205,10 +205,15 @@ const renderBindingHighlightForBindableElement = (
case "embeddable":
case "frame":
case "magicframe":
drawHighlightForRectWithRotation(context, element, padding);
drawHighlightForRectWithRotation(context, element, elementsMap, padding);
break;
case "diamond":
drawHighlightForDiamondWithRotation(context, padding, element);
drawHighlightForDiamondWithRotation(
context,
padding,
element,
elementsMap,
);
break;
case "ellipse": {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element, elementsMap);