From 8a261a2836f47e4703c7fab800de6d5309c2d221 Mon Sep 17 00:00:00 2001 From: Danny Brown Date: Tue, 17 Nov 2020 23:07:15 -0500 Subject: [PATCH] fix: moveNewHandle should call endHandler with success: false when the measurement is removed by `anyHandleOutsideImage` check (#1328) --- src/manipulators/moveNewHandle.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/manipulators/moveNewHandle.js b/src/manipulators/moveNewHandle.js index a2fb04a3b..89b28b98c 100644 --- a/src/manipulators/moveNewHandle.js +++ b/src/manipulators/moveNewHandle.js @@ -236,6 +236,7 @@ function _moveEndHandler( ) { const eventData = evt.detail; const { element, currentPoints } = eventData; + let moveNewHandleSuccessful = true; if (options.hasMoved === false) { return; @@ -289,6 +290,7 @@ function _moveEndHandler( anyHandlesOutsideImage(evt.detail, annotation.handles) ) { annotation.cancelled = true; + moveNewHandleSuccessful = false; removeToolState(element, toolName, annotation); } @@ -301,7 +303,7 @@ function _moveEndHandler( moveEndHandler, }, doneMovingCallback, - true + moveNewHandleSuccessful ); }