From 214fb40a61856c6b82a83e217f5f2b44748137c2 Mon Sep 17 00:00:00 2001 From: Birm Date: Thu, 14 Sep 2023 13:06:52 -0400 Subject: [PATCH] mpp alert on load, not on annot save --- apps/labeling/pitfalls.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/labeling/pitfalls.js b/apps/labeling/pitfalls.js index f9b9cfb9f..66a099aba 100644 --- a/apps/labeling/pitfalls.js +++ b/apps/labeling/pitfalls.js @@ -195,6 +195,11 @@ async function initialize() { }); // add dbl click handler $CAMIC.viewer.addHandler('canvas-double-click', addAnnot); + // alert and return if no mpp + if (!$CAMIC.slideData.mpp){ + alert("This image doesn't have the microns per pixel (mpp) defined. Please resolve this issue before working with this image."); + window.location = `./pitfallsTable.html?collectionId=${$D.params.collectionId}`; + } } }, 500); } @@ -1379,10 +1384,6 @@ function addAnnot(e) { if ($CAMIC.slideData.mpp){ halfWidth = Math.floor(250/$CAMIC.slideData.mpp); halfHeight = Math.floor(250/$CAMIC.slideData.mpp); - } else { - // alert and return - alert("This image doesn't have the microns per pixel (mpp) defined. Please resolve this issue before working with this image."); - window.location = `./pitfallsTable.html?collectionId=${$D.params.collectionId}`; } let ctr = $CAMIC.viewer.viewport.viewportToImageCoordinates($CAMIC.viewer.viewport.pointFromPixel(e.position, true)); let xCtr = Math.round(ctr.x);