From 43bb4b27fb2b0b1320c839e346d635d17f1087d4 Mon Sep 17 00:00:00 2001 From: Boris Sekachev <40690378+bsekachev@users.noreply.github.com> Date: Wed, 15 Apr 2020 12:02:00 +0300 Subject: [PATCH] Fixed: Failed to execute removChild.. (#1405) --- cvat-ui/src/utils/dextr-utils.ts | 4 +++- cvat/apps/dextr_segmentation/dextr.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cvat-ui/src/utils/dextr-utils.ts b/cvat-ui/src/utils/dextr-utils.ts index 9e815374..2a0b1e03 100644 --- a/cvat-ui/src/utils/dextr-utils.ts +++ b/cvat-ui/src/utils/dextr-utils.ts @@ -199,7 +199,9 @@ const plugin: DEXTRPlugin = { // eslint-disable-next-line no-param-reassign self.data.canceled = false; antModalButton.disabled = true; - document.body.removeChild(antModalRoot); + if (antModalRoot.parentElement === document.body) { + document.body.removeChild(antModalRoot); + } } }, }, diff --git a/cvat/apps/dextr_segmentation/dextr.py b/cvat/apps/dextr_segmentation/dextr.py index c51eeaba..9bb3f3ba 100644 --- a/cvat/apps/dextr_segmentation/dextr.py +++ b/cvat/apps/dextr_segmentation/dextr.py @@ -50,7 +50,7 @@ class DEXTR_HANDLER: points = np.asarray([[int(p["x"]), int(p["y"])] for p in points], dtype=int) # Padding mustn't be more than the closest distance to an edge of an image - [width, height] = numpy_image.shape[:2] + [height, width] = numpy_image.shape[:2] x_values = points[:, 0] y_values = points[:, 1] [min_x, max_x] = [np.min(x_values), np.max(x_values)] @@ -59,8 +59,8 @@ class DEXTR_HANDLER: bounding_box = ( max(min(points[:, 0]) - padding, 0), max(min(points[:, 1]) - padding, 0), - min(max(points[:, 0]) + padding, numpy_image.shape[1] - 1), - min(max(points[:, 1]) + padding, numpy_image.shape[0] - 1) + min(max(points[:, 0]) + padding, width - 1), + min(max(points[:, 1]) + padding, height - 1) ) # Prepare an image