Skip to content
This repository was archived by the owner on May 27, 2024. It is now read-only.

Commit 4db60b6

Browse files
authored
Merge pull request #28 from PsycleResearch/fix/drawzone-bugs
fix: Prevent rect drawing when dragging a rect
2 parents 39162e5 + 0392a82 commit 4db60b6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@psycle/repsycle",
3-
"version": "0.0.20",
3+
"version": "0.0.21",
44
"description": "Psycle Research front-end toolkit",
55
"author": "Psycle Research",
66
"keywords": [

src/draw-zone/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,10 +1161,10 @@ function useDraw(
11611161

11621162
if (
11631163
svg.node.contains(e.target as Node) &&
1164-
svg.node !== e.target &&
1165-
!startPosition
1164+
svg.node !== e.target
11661165
) {
11671166
const element = e.target as unknown as LinkedHTMLElement
1167+
startPosition = null
11681168
element.instance.fire('select')
11691169
return
11701170
} else if (e.target === svg.node) {
@@ -1466,6 +1466,7 @@ function useDraw(
14661466
currentPosition.x = startPosition.x + 50
14671467
currentPosition.y = startPosition.y + 50
14681468
} else {
1469+
startPosition = null
14691470
return
14701471
}
14711472
}

0 commit comments

Comments
 (0)