Skip to content

Commit dbfae00

Browse files
authored
V0.3.7 (#43)
* version 0.3.7 : Bugfix : clicking inside the circle around first point of a polygon always sometimes created a new point instead of closing the shape
1 parent fe0daa6 commit dbfae00

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@thetribe/react-components",
3-
"version": "0.3.6",
3+
"version": "0.3.7",
44
"description": "Library of generic React components",
55
"main": "dist/bundle.js",
66
"types": "dist/index.d.ts",

src/annotation-engine/use-annotation-engine.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const useAnnotationEngine = ({
139139
const annotationToEditPointsRef = useRef<Coordinates[]>([]);
140140
const annotationsPathsRef = useRef<AnnotationPathDataById>(new Map());
141141
const annotationToEditStyleRef = useRef<AnnotationStyle>(defaultStyle);
142-
const MOVE_ON_EXISTING_POINTS_RADIUS_DETECTION = 8;
142+
const EXISTING_POINT_RADIUS_DETECTION = 8;
143143

144144
const canvasCoordinateOf = (canvas: HTMLCanvasElement, event: MouseEvent): Coordinates => {
145145
const rect = canvas.getBoundingClientRect();
@@ -187,7 +187,7 @@ const useAnnotationEngine = ({
187187
return coords
188188
.map((coordinate, idx) => ({ coordinate, idx }))
189189
.filter(({ coordinate }) =>
190-
areCoordinatesInsideCircle(coordinate, moveOn, MOVE_ON_EXISTING_POINTS_RADIUS_DETECTION),
190+
areCoordinatesInsideCircle(coordinate, moveOn, EXISTING_POINT_RADIUS_DETECTION),
191191
)
192192
.map(({ idx }) => idx);
193193
};
@@ -282,7 +282,7 @@ const useAnnotationEngine = ({
282282

283283
return newCoordinates
284284
.map((coordinate, idx) => ({ coordinate, idx }))
285-
.filter(({ coordinate }) => areCoordinatesInsideCircle(coordinate, clickAt, 7))
285+
.filter(({ coordinate }) => areCoordinatesInsideCircle(coordinate, clickAt, EXISTING_POINT_RADIUS_DETECTION))
286286
.map(({ idx }) => idx);
287287
}
288288

0 commit comments

Comments
 (0)