fix: connector issues (#12308)

Fixes [BS-3161](https://linear.app/affine-design/issue/BS-3161/发现已连接的connector会响应对齐线)
Fixes [BS-3337](https://linear.app/affine-design/issue/BS-3337/connector你肿么了)
Fixes [BS-3334](https://linear.app/affine-design/issue/BS-3334/connector-不应该能够被拖拽)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Bug Fixes**
	- Corrected typos related to label editing state, ensuring more reliable label editing and display for connectors.
	- Fixed logic in the auto-complete overlay, improving when overlays appear during hover actions.

- **New Features**
	- Improved connector label handling by ensuring label state is preserved and restored during editing.
	- Enhanced connector movement behavior, allowing connectors to be moved only when appropriate elements are selected.

- **Tests**
	- Added end-to-end tests to verify connector movement and selection behaviors for improved reliability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
doouding
2025-05-16 09:49:22 +00:00
parent 8ed4f14380
commit 5eca722edf
6 changed files with 80 additions and 5 deletions

View File

@@ -278,7 +278,13 @@ export class ConnectorElementModel extends GfxPrimitiveElementModel<ConnectorEle
}
hasLabel() {
return Boolean(!this.lableEditing && this.labelDisplay && this.labelXYWH);
return Boolean(
!this.labelEditing &&
this.labelDisplay &&
this.labelXYWH &&
this.text &&
this.text.length
);
}
override includesPoint(
@@ -450,7 +456,7 @@ export class ConnectorElementModel extends GfxPrimitiveElementModel<ConnectorEle
* Local control display and hide, mainly used in editing scenarios.
*/
@local()
accessor lableEditing: boolean = false;
accessor labelEditing: boolean = false;
@field()
accessor mode: ConnectorMode = DEFAULT_CONNECTOR_MODE;