Skip to content

Commit

Permalink
fix: use xywh instead of elementBound without rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Titov committed Jan 22, 2025
1 parent c7735b6 commit 2ef92af
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/affine/model/src/elements/brush/brush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,19 @@ export class BrushElementModel extends GfxPrimitiveElementModel<BrushProps> {
instance['_local'].delete('commands');
})
@derive((lineWidth: number, instance: Instance) => {
const oldBound = instance.elementBound;

if (
lineWidth === instance.lineWidth ||
oldBound.w === 0 ||
oldBound.h === 0
instance.w === 0 ||
instance.h === 0
)
return {};

const points = instance.points;
const transformed = transformPointsToNewBound(
points.map(([x, y]) => ({ x, y })),
oldBound,
instance,
instance.lineWidth / 2,
inflateBound(oldBound, lineWidth - instance.lineWidth),
inflateBound(instance, lineWidth - instance.lineWidth),
lineWidth / 2
);

Expand Down

0 comments on commit 2ef92af

Please sign in to comment.