Add test for multi-select flip fixedPoint
This commit is contained in:
parent
a4ad4f8f60
commit
86719fc489
|
@ -339,7 +339,7 @@ describe("arrow element", () => {
|
||||||
expect(label.fontSize).toEqual(20);
|
expect(label.fontSize).toEqual(20);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("flips the fixed point binding on negative resize", () => {
|
it("flips the fixed point binding on negative resize for single bindable", () => {
|
||||||
const rectangle = UI.createElement("rectangle", {
|
const rectangle = UI.createElement("rectangle", {
|
||||||
x: -100,
|
x: -100,
|
||||||
y: -75,
|
y: -75,
|
||||||
|
@ -366,6 +366,34 @@ describe("arrow element", () => {
|
||||||
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(-0.05);
|
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(-0.05);
|
||||||
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.25);
|
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.25);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("flips the fixed point binding on negative resize for group selection", () => {
|
||||||
|
const rectangle = UI.createElement("rectangle", {
|
||||||
|
x: -100,
|
||||||
|
y: -75,
|
||||||
|
width: 95,
|
||||||
|
height: 100,
|
||||||
|
});
|
||||||
|
UI.clickTool("arrow");
|
||||||
|
UI.clickOnTestId("elbow-arrow");
|
||||||
|
mouse.reset();
|
||||||
|
mouse.moveTo(-5, 0);
|
||||||
|
mouse.click();
|
||||||
|
mouse.moveTo(120, 200);
|
||||||
|
mouse.click();
|
||||||
|
|
||||||
|
const arrow = h.scene.getSelectedElements(
|
||||||
|
h.state,
|
||||||
|
)[0] as ExcalidrawArrowElement;
|
||||||
|
|
||||||
|
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
|
||||||
|
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.75);
|
||||||
|
|
||||||
|
UI.resize([rectangle, arrow], "nw", [300, 350]);
|
||||||
|
|
||||||
|
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(-0.144, 2);
|
||||||
|
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.25);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("text element", () => {
|
describe("text element", () => {
|
||||||
|
|
Loading…
Reference in New Issue