Skip to content

Commit ebe2ff7

Browse files
committed
Add clearSelection() method
1 parent 246a60f commit ebe2ff7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/SketchField.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,12 @@ class SketchField extends PureComponent {
462462
return !!canvas.getActiveObject();
463463
}
464464

465+
clearSelection = () => {
466+
let canvas = this._fc;
467+
canvas.discardActiveObject();
468+
canvas.requestRenderAll();
469+
}
470+
465471
/**
466472
* Remove selected object from the canvas
467473
*/

types/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ declare module 'react-sketch' {
155155
clear(propertiesToInclude?: ArrayLike<string>): string
156156

157157
hasSelection(): boolean
158-
158+
clearSelection(): void
159+
159160
/**
160161
* Remove selected object from the canvas
161162
*/

0 commit comments

Comments
 (0)