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

View File

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