mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-03-24 16:18:39 +08:00
fix(editor): should record edgeless connector mode (#12426)
Close [BS-3355](https://linear.app/affine-design/issue/BS-3355/白板快捷键c没有记住上次用的connector形状) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added the ability to cycle through connector modes (Curve, Orthogonal, Straight) using the 'c' keyboard shortcut when the connector tool is active. - **Bug Fixes** - Improved the logic for remembering and restoring the last used connector mode when switching between tools. - **Tests** - Introduced a new end-to-end test to verify correct cycling and restoration of connector modes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -3,12 +3,10 @@ import {
|
||||
DefaultTool,
|
||||
OverlayIdentifier,
|
||||
} from '@blocksuite/affine-block-surface';
|
||||
import type {
|
||||
Connection,
|
||||
ConnectorElementModel,
|
||||
ConnectorMode,
|
||||
} from '@blocksuite/affine-model';
|
||||
import {
|
||||
type Connection,
|
||||
type ConnectorElementModel,
|
||||
ConnectorMode,
|
||||
GroupElementModel,
|
||||
ShapeElementModel,
|
||||
ShapeType,
|
||||
@@ -223,4 +221,15 @@ export class ConnectorTool extends BaseTool<ConnectorToolOptions> {
|
||||
|
||||
this.findTargetByPoint(point);
|
||||
}
|
||||
|
||||
getNextMode() {
|
||||
switch (this.activatedOption.mode) {
|
||||
case ConnectorMode.Curve:
|
||||
return ConnectorMode.Orthogonal;
|
||||
case ConnectorMode.Orthogonal:
|
||||
return ConnectorMode.Straight;
|
||||
case ConnectorMode.Straight:
|
||||
return ConnectorMode.Curve;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user