mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
fix: connector should remain the same when its target or source switch to other
shape type (#11369) Fixes [BS-1431](https://linear.app/affine-design/issue/BS-1431/改变-shape-形状后,connector-丢失)
This commit is contained in:
@@ -1082,6 +1082,19 @@ type Action =
|
||||
| 'autoArrange'
|
||||
| 'autoResize';
|
||||
|
||||
export async function triggerShapeSwitch(
|
||||
page: Page,
|
||||
type: 'Square' | 'Ellipse' | 'Diamond' | 'Triangle' | 'Rounded rectangle'
|
||||
) {
|
||||
const button = locatorComponentToolbar(page)
|
||||
.getByLabel('Switch shape type')
|
||||
.first();
|
||||
await button.click();
|
||||
|
||||
const shapeButton = locatorComponentToolbar(page).getByLabel(type);
|
||||
await shapeButton.click();
|
||||
}
|
||||
|
||||
export async function triggerComponentToolbarAction(
|
||||
page: Page,
|
||||
action: Action
|
||||
@@ -1598,6 +1611,31 @@ export async function getConnectorPath(page: Page, index = 0): Promise<IVec[]> {
|
||||
);
|
||||
}
|
||||
|
||||
export async function getConnectorPathWithInOut(
|
||||
page: Page,
|
||||
index = 0
|
||||
): Promise<
|
||||
{
|
||||
point: IVec;
|
||||
in: IVec;
|
||||
out: IVec;
|
||||
}[]
|
||||
> {
|
||||
return page.evaluate(
|
||||
([index]) => {
|
||||
const container = document.querySelector('affine-edgeless-root');
|
||||
if (!container) throw new Error('container not found');
|
||||
const connectors = container.service.crud.getElementsByType('connector');
|
||||
return connectors[index].absolutePath.map(path => ({
|
||||
point: [path[0], path[1]],
|
||||
in: path.in,
|
||||
out: path.out,
|
||||
}));
|
||||
},
|
||||
[index]
|
||||
);
|
||||
}
|
||||
|
||||
export async function getEdgelessElementBound(
|
||||
page: Page,
|
||||
elementId: string
|
||||
|
||||
Reference in New Issue
Block a user