Fixed: Failed to execute removChild.. (#1405)

main
Boris Sekachev 6 years ago committed by GitHub
parent 018925d535
commit 43bb4b27fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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);
}
}
},
},

@ -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

Loading…
Cancel
Save