From 65d50837dd2d453e82092087d5731be9587843dc Mon Sep 17 00:00:00 2001 From: Timon Engelke Date: Wed, 31 Mar 2021 23:28:18 +0200 Subject: [PATCH] call resetSelection when restoring an annotation that is not in image --- .../static/annotations/js/annotations.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/imagetagger/imagetagger/annotations/static/annotations/js/annotations.js b/imagetagger/imagetagger/annotations/static/annotations/js/annotations.js index e2c29def..d4705757 100644 --- a/imagetagger/imagetagger/annotations/static/annotations/js/annotations.js +++ b/imagetagger/imagetagger/annotations/static/annotations/js/annotations.js @@ -813,19 +813,21 @@ function calculateImageScale() { tool.clear(); if ($('#keep_selection').prop('checked') && restoreAnnotation) { - let annotation_type = $('#annotation_type_id').children('[value=' + restoreAnnotation.annotation_type_id + ']').data(); - let vector_type = annotation_type.vectorType; - let node_count = annotation_type.nodeCount; - tool.restoreSelection({ - vector_type: vector_type, - node_count: node_count, - vector: restoreAnnotation.vector, - }); if (restoreAnnotation.vector === null) { // not in image + tool.resetSelection(); $('#not_in_image').prop('checked', true); $('#coordinate_table').hide(); setupCBCheckboxes(); + } else { + let annotation_type = $('#annotation_type_id').children('[value=' + restoreAnnotation.annotation_type_id + ']').data(); + let vector_type = annotation_type.vectorType; + let node_count = annotation_type.nodeCount; + tool.restoreSelection({ + vector_type: vector_type, + node_count: node_count, + vector: restoreAnnotation.vector, + }); } } else { resetSelection();