Skip to content

Commit

Permalink
Merge pull request #815 from girder/pixelmap-check-fix
Browse files Browse the repository at this point in the history
Fix a range check.
  • Loading branch information
manthey authored Apr 5, 2022
2 parents 976d8d6 + 8eab177 commit 88cb078
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ var GeojsImageViewerWidgetExtension = function (viewer) {
pixelmapData = valuesWithBoundaries;
}
layerParams.data = pixelmapData;
const categoryMap = pixelmapElement.categories;
const boundaries = pixelmapElement.boundaries;
layerParams.style = {
color: (d, i) => {
const categoryMap = pixelmapElement.categories;
const boundaries = pixelmapElement.boundaries;
if (d < 0 || d > categoryMap.length) {
if (d < 0 || d >= categoryMap.length) {
console.warn(`No category found at index ${d} in the category map.`);
return 'rgba(0, 0, 0, 0)';
}
Expand Down Expand Up @@ -390,11 +390,9 @@ var GeojsImageViewerWidgetExtension = function (viewer) {
}
const params = this._generateOverlayLayerParams(response, overlayItemId, overlay);
const layerType = (overlay.type === 'pixelmap') ? 'pixelmap' : 'osm';
const overlayLayer = this.viewer.createLayer(layerType, params);
const proj = this._getOverlayTransformProjString(overlay);

overlayLayer.id(overlay.id);
overlayLayer.gcs(proj);
const overlayLayer = this.viewer.createLayer(layerType, Object.assign({}, params, {id: overlay.id, gcs: proj}));
this.annotationLayer.moveToTop();
this.trigger('g:drawOverlayAnnotation', overlay, overlayLayer);
const featureEvents = geo.event.feature;
overlayLayer.geoOn(
Expand Down

0 comments on commit 88cb078

Please sign in to comment.