Mercurial > hg > orthanc-wsi
changeset 597:008409bc9978 annotations
refactor unselect
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Mon, 07 Sep 2026 11:34:02 +0200 |
| parents | 0b282bf7ff63 |
| children | 11f795017763 |
| files | ViewerPlugin/WebApplication/viewer.js |
| diffstat | 1 files changed, 21 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/ViewerPlugin/WebApplication/viewer.js Mon Sep 07 11:28:33 2026 +0200 +++ b/ViewerPlugin/WebApplication/viewer.js Mon Sep 07 11:34:02 2026 +0200 @@ -454,6 +454,19 @@ }); }, + ClearAnnotationSelection: function(clearOlSelection) { + if (clearOlSelection === undefined) { + clearOlSelection = true; + } + + if (clearOlSelection && this.selectAnnotation !== null) { + this.selectAnnotation.getFeatures().clear(); + } + + this.selectedFeature = null; + this.annotationProperties = []; + }, + UpdateAnnotationProperty: function(prop) { if (this.selectedFeature && prop.featureProp && @@ -517,12 +530,7 @@ this.activeDrawTool = null; this.map.getViewport().style.cursor = ''; - - if (this.selectAnnotation !== null) { - this.selectAnnotation.getFeatures().clear(); - } - - this.selectedFeature = null; + this.ClearAnnotationSelection(true); }, ToggleSelectTool: function() { @@ -606,8 +614,7 @@ }); selected.clear(); - - this.selectedFeature = null; + this.ClearAnnotationSelection(false); this.modalDeleteAnnotation.hide(); }, @@ -1070,9 +1077,9 @@ this.modifyFeature.on('modifyend', function(e) { that.SaveUserFeatures(); }); this.selectAnnotation.on('select', function(e) { - that.annotationProperties = []; + if (e.selected.length === 1) { + that.annotationProperties = []; - if (e.selected.length === 1) { var feature = e.selected[0]; that.selectedFeature = feature; @@ -1116,7 +1123,7 @@ bootstrap.Offcanvas.getOrCreateInstance(document.getElementById('right-panel')).show(); } else { - that.selectedFeature = null; + that.ClearAnnotationSelection(false); } }); @@ -1316,6 +1323,9 @@ ReloadImportedFeatures: function() { + // Reset current selection when refreshing imported content. + this.ClearAnnotationSelection(true); + console.assert(this.drawImportedSource !== null); // InitializeAnnotations() must have been invoked console.assert(this.workspaceInfo.enabled !== undefined); // LoadLayers() must have been invoked
