There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(editor): incorrect brush bound with rotation and line width (#11524)
L-Sun38201865127d
diff --git a/blocksuite/affine/model/src/elements/brush/brush.ts b/blocksuite/affine/model/src/elements/brush/brush.tsindex 8c78e7238d..604e08cc33 100644--- a/blocksuite/affine/model/src/elements/brush/brush.ts+++ b/blocksuite/affine/model/src/elements/brush/brush.ts@@ -130,7 +130,7 @@ export class BrushElementModel extends GfxPrimitiveElementModel<BrushProps> {instance['_local'].delete('commands');})@derive((lineWidth: number, instance: Instance) => {- const oldBound = instance.elementBound;+ const oldBound = Bound.fromXYWH(instance.deserializedXYWH);if (lineWidth === instance.lineWidth ||diff --git a/tests/blocksuite/e2e/edgeless/brush.spec.ts b/tests/blocksuite/e2e/edgeless/brush.spec.tsindex a12b3e03ba..38902071f0 100644--- a/tests/blocksuite/e2e/edgeless/brush.spec.ts+++ b/tests/blocksuite/e2e/edgeless/brush.spec.ts@@ -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]);+});