supervision 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mask-preparation.worker.js.map +1 -1
- package/dist/tracking.worker.js.map +1 -1
- package/node_modules/supervision-js-core/dist/index.js +10 -3
- package/node_modules/supervision-js-core/dist/index.js.map +1 -1
- package/node_modules/supervision-js-core/dist/interactions/annotation-editing-engine.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/editing.d.ts +2 -0
- package/node_modules/supervision-js-core/dist/types/editing.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -5528,6 +5528,8 @@ function createAnnotationEditingEngine(options = {}) {
|
|
|
5528
5528
|
return {
|
|
5529
5529
|
getState: () => state,
|
|
5530
5530
|
setCreationTool(nextTool) {
|
|
5531
|
+
if (nextTool === tool)
|
|
5532
|
+
return;
|
|
5531
5533
|
if (gesture)
|
|
5532
5534
|
cancel();
|
|
5533
5535
|
tool = nextTool;
|
|
@@ -5611,11 +5613,11 @@ function createAnnotationEditingEngine(options = {}) {
|
|
|
5611
5613
|
rect.width < 1 ||
|
|
5612
5614
|
rect.height < 1 ||
|
|
5613
5615
|
(duration < CLICK_CANCEL_MS && diagonal <= CLICK_CANCEL_DIAGONAL)) {
|
|
5614
|
-
|
|
5616
|
+
rejectCreation();
|
|
5615
5617
|
return;
|
|
5616
5618
|
}
|
|
5617
5619
|
if (tool?.shouldCommit?.(rect) === false) {
|
|
5618
|
-
|
|
5620
|
+
rejectCreation();
|
|
5619
5621
|
return;
|
|
5620
5622
|
}
|
|
5621
5623
|
commit(preview, null);
|
|
@@ -5624,7 +5626,7 @@ function createAnnotationEditingEngine(options = {}) {
|
|
|
5624
5626
|
if (active.kind === "freehand") {
|
|
5625
5627
|
const points = [...active.points, input.point];
|
|
5626
5628
|
if (points.length < 2 || tool?.shouldCommit?.(points) === false) {
|
|
5627
|
-
|
|
5629
|
+
rejectCreation();
|
|
5628
5630
|
return;
|
|
5629
5631
|
}
|
|
5630
5632
|
commit(tool.createDetection(points), null);
|
|
@@ -5828,6 +5830,11 @@ function createAnnotationEditingEngine(options = {}) {
|
|
|
5828
5830
|
preview,
|
|
5829
5831
|
});
|
|
5830
5832
|
}
|
|
5833
|
+
function rejectCreation() {
|
|
5834
|
+
const onRejected = tool?.onRejected;
|
|
5835
|
+
cancel();
|
|
5836
|
+
onRejected?.();
|
|
5837
|
+
}
|
|
5831
5838
|
function cancel() {
|
|
5832
5839
|
const pointerId = gesture && "start" in gesture
|
|
5833
5840
|
? gesture.start.pointerId
|