Skip to content

Commit

Permalink
fix(Polyline): safeguard points arg from options (#9855)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 authored May 6, 2024
1 parent a504fd9 commit ca171ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [next]

- fix(Polyline): safeguard points arg from options [#9855](https://github.com/fabricjs/fabric.js/pull/9855)
- feat(IText): Adjust cursor blinking for better feedback [#9823](https://github.com/fabricjs/fabric.js/pull/9823)
- feat(FabricObject): pass `e` to `shouldStartDragging` [#9843](https://github.com/fabricjs/fabric.js/pull/9843)
- fix(Canvas): mouse move before event data [#9849](https://github.com/fabricjs/fabric.js/pull/9849)
Expand Down
8 changes: 8 additions & 0 deletions src/shapes/Polyline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,12 @@ describe('Polyline', () => {
});
});
});

it('should safeguard passing points in options', () => {
expect(new Polyline(points, { points: [{ x: 1, y: 1 }] })).toEqual(
expect.objectContaining({
points: points,
})
);
});
});
2 changes: 1 addition & 1 deletion src/shapes/Polyline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class Polyline<
* });
*/
constructor(points: XY[] = [], options: Props = {} as Props) {
super({ points, ...options });
super({ ...options, points });
const { left, top } = options;
this.initialized = true;
this.setBoundingBox(true);
Expand Down

0 comments on commit ca171ae

Please sign in to comment.