From 55585e03cbaa8243915381f87e7ba37e99ca374b Mon Sep 17 00:00:00 2001 From: Timon Engelke Date: Sun, 6 Dec 2020 19:42:56 +0100 Subject: [PATCH] verification view: wait for image before drawing annotations --- .../annotations/static/annotations/js/verification.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/imagetagger/imagetagger/annotations/static/annotations/js/verification.js b/imagetagger/imagetagger/annotations/static/annotations/js/verification.js index fdd7e61f..1cecc324 100644 --- a/imagetagger/imagetagger/annotations/static/annotations/js/verification.js +++ b/imagetagger/imagetagger/annotations/static/annotations/js/verification.js @@ -413,6 +413,13 @@ function calculateImageScale() { if (tool) { tool.clear(); } + // wait for image + let image = $('#image')[0]; + if (!(image.complete && image.naturalHeight !== 0)) { + window.setTimeout(() => drawAnnotations(annotations, current), 50); + return; + } + // image is loaded let annotation = annotations[0]; if (!tool || tool.annotationTypeId !== annotation.annotation_type.id || (tool.vector_type === 5 && tool.node_count !== annotation.annotation_type.node_count)) {