From edccada0d818c076282f3d2f82ded2422000b7e9 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Mon, 16 May 2022 14:28:27 -0400 Subject: [PATCH] Better handle editing polygons with holes. --- girder/girder_large_image/web_client/package.json | 2 +- .../web_client/annotations/geojs/types/polygon.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/girder/girder_large_image/web_client/package.json b/girder/girder_large_image/web_client/package.json index 8e9a2fe7c..09c98112f 100644 --- a/girder/girder_large_image/web_client/package.json +++ b/girder/girder_large_image/web_client/package.json @@ -17,7 +17,7 @@ "dependencies": { "copy-webpack-plugin": "^4.5.2", "d3": "^3.5.16", - "geojs": "^1.8.0", + "geojs": "^1.8.6", "hammerjs": "^2.0.8", "js-yaml": "^3.14.0", "sinon": "^2.1.0", diff --git a/girder_annotation/girder_large_image_annotation/web_client/annotations/geojs/types/polygon.js b/girder_annotation/girder_large_image_annotation/web_client/annotations/geojs/types/polygon.js index 2d81ad8b4..fa7836209 100644 --- a/girder_annotation/girder_large_image_annotation/web_client/annotations/geojs/types/polygon.js +++ b/girder_annotation/girder_large_image_annotation/web_client/annotations/geojs/types/polygon.js @@ -9,12 +9,15 @@ import array from '../coordinates/array'; */ function polygon(annotation) { const element = common(annotation, 'polyline'); - const coordinates = array(annotation.coordinates()); + let coordinates = annotation.coordinates(); + const holes = coordinates.inner ? coordinates.inner.map((h) => array(h)) : undefined; + coordinates = array(coordinates.outer || coordinates); return _.extend(element, { type: 'polyline', closed: true, - points: coordinates + points: coordinates, + holes }); }