From db8314b811c6469e4e21ef07cb8e6201bc02d0c0 Mon Sep 17 00:00:00 2001 From: Gas Giant Date: Mon, 6 Jan 2025 20:00:30 +0530 Subject: [PATCH] fix: emit event on image load progress (#1735) Co-authored-by: scouser --- .../src/imageLoader/internal/xhrRequest.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/dicomImageLoader/src/imageLoader/internal/xhrRequest.ts b/packages/dicomImageLoader/src/imageLoader/internal/xhrRequest.ts index f0f3a53bd..484a43786 100644 --- a/packages/dicomImageLoader/src/imageLoader/internal/xhrRequest.ts +++ b/packages/dicomImageLoader/src/imageLoader/internal/xhrRequest.ts @@ -138,6 +138,16 @@ function xhrRequest( percentComplete = Math.round((loaded / total) * 100); } + const eventData = { + url, + imageId, + loaded, + total, + percentComplete, + }; + + triggerEvent(eventTarget, 'cornerstoneimageloadprogress', eventData); + // Action if (options.onprogress) { options.onprogress(oProgress, params);