Skip to content

Commit

Permalink
fix(image): emit unselected event asynchronous #506
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-Shen committed Oct 25, 2024
1 parent 939a9a6 commit 0feadb7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/image/src/drafts/Draft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,15 @@ export class Draft<
private _handleRightMouseUp = (e: MouseEvent) => {
const isUnderCursor = this.isUnderCursor({ x: e.offsetX, y: e.offsetY });

if (!isUnderCursor && !axis?.isMoved) {
this.group.emit(EInternalEvent.UnSelect, e, this);
}
/**
* 因为清除isMoved是异步的
* see https://github.com/opendatalab/labelU-Kit/blob/main/packages/image/src/core/Axis.ts#L230
*/
setTimeout(() => {
if (!isUnderCursor && !axis?.isMoved) {
this.group.emit(EInternalEvent.UnSelect, e, this);
}
});
};

private _handleLeftMouseUp = (e: MouseEvent) => {
Expand Down

0 comments on commit 0feadb7

Please sign in to comment.