Test fixes

This commit is contained in:
Mark Tolmacs 2025-04-28 19:49:19 +02:00
parent 28066034d7
commit 541725ff5a
No known key found for this signature in database
2 changed files with 20 additions and 24 deletions

View file

@ -1345,29 +1345,25 @@ const getElbowArrowData = (
: [10, 10, 10, 10], : [10, 10, 10, 10],
hoveredEndElement ? aabbForElement(hoveredEndElement) : [10, 10, 10, 10], hoveredEndElement ? aabbForElement(hoveredEndElement) : [10, 10, 10, 10],
); );
const startOffsets = offsetFromHeading(
startHeading,
arrow.startArrowhead
? FIXED_BINDING_DISTANCE * 4
: FIXED_BINDING_DISTANCE * 2,
1,
);
const endOffsets = offsetFromHeading(
endHeading,
arrow.endArrowhead
? FIXED_BINDING_DISTANCE * 4
: FIXED_BINDING_DISTANCE * 2,
1,
);
const startElementBounds = hoveredStartElement const startElementBounds = hoveredStartElement
? aabbForElement( ? aabbForElement(hoveredStartElement, startOffsets)
hoveredStartElement,
offsetFromHeading(
startHeading,
arrow.startArrowhead
? FIXED_BINDING_DISTANCE
: FIXED_BINDING_DISTANCE * 2,
1,
),
)
: startPointBounds; : startPointBounds;
const endElementBounds = hoveredEndElement const endElementBounds = hoveredEndElement
? aabbForElement( ? aabbForElement(hoveredEndElement, endOffsets)
hoveredEndElement,
offsetFromHeading(
endHeading,
arrow.endArrowhead
? FIXED_BINDING_DISTANCE
: FIXED_BINDING_DISTANCE * 2,
1,
),
)
: endPointBounds; : endPointBounds;
const boundsOverlap = const boundsOverlap =
pointInsideBounds( pointInsideBounds(

View file

@ -73,12 +73,12 @@ describe("flipping re-centers selection", () => {
API.executeAction(actionFlipHorizontal); API.executeAction(actionFlipHorizontal);
const rec1 = h.elements.find((el) => el.id === "rec1")!; const rec1 = h.elements.find((el) => el.id === "rec1")!;
expect(rec1.x).toBeCloseTo(100, 0); expect(rec1.x).toBeCloseTo(97.8678, 0);
expect(rec1.y).toBeCloseTo(100, 0); expect(rec1.y).toBeCloseTo(97.444, 0);
const rec2 = h.elements.find((el) => el.id === "rec2")!; const rec2 = h.elements.find((el) => el.id === "rec2")!;
expect(rec2.x).toBeCloseTo(220, 0); expect(rec2.x).toBeCloseTo(218, 0);
expect(rec2.y).toBeCloseTo(250, 0); expect(rec2.y).toBeCloseTo(247, 0);
}); });
}); });