refactor: default-tool box selection (#11800)

### Changed
- Rewrite box selection in `default-tool`, the view can decide whether to be selected in box selection by return a boolean value in `onBoxSelected` method
- Cleanup unnecessary states in `default-tool` and some naming problem
This commit is contained in:
doouding
2025-04-22 08:18:25 +00:00
parent 1d58792631
commit b59f6ebde0
16 changed files with 209 additions and 150 deletions

View File

@@ -22,7 +22,7 @@ const dragBetweenViewCoords = async (
end: number[]
) => {
// dragging slowly may drop frame if mindmap is existed, so for test we drag quickly
await _dragBetweenViewCoords(page, start, end, { steps: 2 });
await _dragBetweenViewCoords(page, start, end, { steps: 10 });
await waitNextFrame(page);
};

View File

@@ -1,6 +1,6 @@
import { expect } from '@playwright/test';
import { clickView } from '../utils/actions/click.js';
import { click, clickView } from '../utils/actions/click.js';
import { dragBetweenCoords } from '../utils/actions/drag.js';
import {
addBasicRectShapeElement,
@@ -272,7 +272,7 @@ test('drag root node should layout in real time', async ({ page }) => {
// assert when dragging is in progress
await waitNextFrame(page, 500);
await assertMindMapNodesPosition(50, 50);
await assertMindMapNodesPosition(54, 54);
await page.mouse.up();
});
@@ -297,6 +297,7 @@ test('drag node out of mind map should detach the node and create a new mind map
});
const { rect } = await getMindMapNode(page, mindmapId, [0, 1]);
await click(page, { x: rect.x + rect.w / 2, y: rect.y + rect.h / 2 });
await dragBetweenCoords(
page,
{