From 3cd11bef39898fae875ec6088fe593b1be45ecb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFs=20Poujade?= <lois.poujade@tetras-libre.fr> Date: Mon, 16 Jan 2023 08:45:27 +0100 Subject: [PATCH] Fix from reviews Moved and fixed error handling for case where both an image and a video are present on the same canvas + wording --- src/AnnotationDrawing.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/AnnotationDrawing.js b/src/AnnotationDrawing.js index 1b8be54..be5a656 100644 --- a/src/AnnotationDrawing.js +++ b/src/AnnotationDrawing.js @@ -60,10 +60,6 @@ class AnnotationDrawing extends Component { const osdref = OSDReferences.get(windowId); const videoref = VideosReferences.get(windowId); - if (osdref && videoref) { - console.error('Unhandled case: both OpenSeadragon (picture viewer) and video player on the same canvas'); - } - if (osdref) { const { viewport } = osdref.current; const img = osdref.current.world.getItemAt(0); @@ -99,7 +95,7 @@ class AnnotationDrawing extends Component { }; } - throw new Error('Unknown or missing data player, not OpenSeadragon (picture viewer) nor the video player'); + throw new Error('Unknown or missing data player, not OpenSeadragon (image viewer) nor the video player'); } /** Draw SVG on canvas */ @@ -209,6 +205,9 @@ class AnnotationDrawing extends Component { if (!osdref && !videoref) { throw new Error("Unknown or missing data player, didn't found OpenSeadragon (image viewer) nor the video player"); } + if (osdref && videoref) { + throw new Error('Unhandled case: both OpenSeadragon (image viewer) and video player on the same canvas'); + } const container = osdref ? osdref.current.element : videoref.ref.current.parentElement; -- GitLab