From 2cf1e62d283a7f6ce1bad9b0c8a0fbb664a294fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helmut=20Hoffer=20von=20Ankershoffen=20n=C3=A9=20Oertel?= Date: Tue, 12 Nov 2024 22:42:47 +0100 Subject: [PATCH] perf(bulkAnnotations): cache affine (#159) * perf(bulkAnnotations): cache affine * fix: typo --------- Co-authored-by: Helmut (Oertel) Hoffer von Ankershoffen --- src/bulkAnnotations/utils.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bulkAnnotations/utils.js b/src/bulkAnnotations/utils.js index 41824e4..38d5030 100644 --- a/src/bulkAnnotations/utils.js +++ b/src/bulkAnnotations/utils.js @@ -468,6 +468,12 @@ export const getFeaturesFromBulkAnnotations = ({ const { topLeft, bottomRight } = getViewportBoundingBox({ view, pyramid, affine }) + const cachedAffine = getAffineBasedOnPyramidLevel({ + affine, + pyramid, + annotationGroup + }) + const features = [] for ( @@ -492,11 +498,7 @@ export const getFeaturesFromBulkAnnotations = ({ if (annotationCoordinateType === '2D') { firstCoordinate = mapPixelCoordToSlideCoord({ point: [firstCoordinate[0], firstCoordinate[1]], - affine: getAffineBasedOnPyramidLevel({ - affine, - pyramid, - annotationGroup - }) + affine: cachedAffine }) }