fix(editor): incorrect brush bound with rotation and line width (#11524)

This transfered PR from [BS/#9058](https://github.com/toeverything/blocksuite/pull/9058) fixes an issue where the selection rectangle of a brush element was incorrect after resizing and rotating.
This commit is contained in:
L-Sun
2025-04-08 10:48:12 +00:00
parent 7d4bb5150e
commit 3820186512
2 changed files with 20 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import {
assertEdgelessTool,
deleteAll,
pickColorAtPoints,
rotateElementByHandle,
selectBrushColor,
selectBrushSize,
setEdgelessTool,
@@ -195,3 +196,21 @@ test('change brush element size by component-toolbar', async ({ page }) => {
await updateExistedBrushElementSize(page, 1);
await assertEdgelessSelectedRect(page, [99, 99, 102, 102]);
});
test('rotate brush element and then change size', async ({ page }) => {
await enterPlaygroundRoom(page);
await initEmptyEdgelessState(page);
await switchEditorMode(page);
await zoomResetByKeyboard(page);
const start = { x: 100, y: 100 };
const end = { x: 200, y: 200 };
await addBasicBrushElement(page, start, end);
await page.mouse.click(110, 110);
await rotateElementByHandle(page, 45, 'bottom-right');
// change to line width 12
await updateExistedBrushElementSize(page, 6);
await assertEdgelessSelectedRect(page, [70.8, 70.8, 158.4, 158.4]);
});