diff --git a/components/canvas/shape.tsx b/components/canvas/shape.tsx index 08fbbd62b..7a7dfa437 100644 --- a/components/canvas/shape.tsx +++ b/components/canvas/shape.tsx @@ -68,7 +68,7 @@ function Shape({ id, isSelecting, parentPoint }: ShapeProps): JSX.Element { device={isMobileDevice ? 'mobile' : 'desktop'} {...events} > - {!isShy && ( + {isSelecting && !isShy && ( <> {isForeignObject ? ( (...args: Parameters) { - const session = this.#current - - if (session === undefined) return this - - session.complete.call(this.#current, ...args) + this.#current?.complete.call(this.#current, ...args) this.#current = undefined return this } @@ -89,7 +85,7 @@ class SessionManager { * ``` */ cancel(...args: Parameters) { - this.#current.cancel.call(this.#current, ...args) + this.#current?.cancel.call(this.#current, ...args) this.#current = undefined return this }