Mercurial > hg > orthanc-wsi
changeset 593:33c77ee9d573 annotations
fix rendering of selected arrows
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Mon, 07 Sep 2026 10:50:46 +0200 |
| parents | 53b0cc4006ea |
| children | be8f2691d1f0 |
| files | ViewerPlugin/WebApplication/viewer.js |
| diffstat | 1 files changed, 22 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/ViewerPlugin/WebApplication/viewer.js Mon Sep 07 10:46:30 2026 +0200 +++ b/ViewerPlugin/WebApplication/viewer.js Mon Sep 07 10:50:46 2026 +0200 @@ -924,11 +924,7 @@ style: function(feature, resolution) { var layer = GetLayerOfFeature(feature); if (layer.visible) { - if (feature.get('type') === 'arrow') { - return CreateArrowStyle(feature, resolution, layer.color); - } else { - return CreateLayerStyle(layer.color); - } + return CreateFeatureStyle(feature, resolution, layer.color); } else { return null; } @@ -947,11 +943,7 @@ return null; } - if (feature.get('type') === 'arrow') { - return CreateArrowStyle(feature, resolution, entry.color); - } else { - return CreateLayerStyle(entry.color); - } + return CreateFeatureStyle(feature, resolution, entry.color); } }); this.map.addLayer(this.drawImportedLayer); @@ -999,7 +991,9 @@ return ol.events.condition.singleClick(e) && app.activeDrawTool === 'select'; }, hitTolerance: 5, /* pixels around the feature that count as a hit */ - style: CreateLayerStyle('#0000ff') /* selected annotation is in blue */ + style: function(feature, resolution) { + return CreateFeatureStyle(feature, resolution, '#0000ff'); /* selected annotations are in blue */ + } }); @@ -1450,13 +1444,29 @@ } +function IsArrowFeature(feature) +{ + return feature.get('type') === 'arrow'; +} + + +function CreateFeatureStyle(feature, resolution, color) +{ + if (IsArrowFeature(feature)) { + return CreateArrowStyle(feature, resolution, color); + } else { + return CreateLayerStyle(color); + } +} + + function SerializeFeature(feature) { var type = feature.getGeometry().getType(); if (type === 'LineString') { var s; - if (feature.get('type') === 'arrow') { + if (IsArrowFeature(feature)) { s = 'arrow'; } else { s = 'polyline';
