Skip to content

Commit f55b569

Browse files
authored
Merge pull request #64 from karlvr/selection
Adding Extra Selection methods
2 parents 75a5d9b + ebe2ff7 commit f55b569

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/SketchField.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,17 @@ class SketchField extends PureComponent {
512512
return discarded
513513
};
514514

515+
hasSelection = () => {
516+
let canvas = this._fc;
517+
return !!canvas.getActiveObject();
518+
}
519+
520+
clearSelection = () => {
521+
let canvas = this._fc;
522+
canvas.discardActiveObject();
523+
canvas.requestRenderAll();
524+
}
525+
515526
/**
516527
* Remove selected object from the canvas
517528
*/

types/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ declare module 'react-sketch' {
175175
*/
176176
clear(propertiesToInclude?: ArrayLike<string>): string
177177

178+
hasSelection(): boolean
179+
clearSelection(): void
180+
178181
/**
179182
* Remove selected object from the canvas
180183
*/

0 commit comments

Comments
 (0)