diff --git a/packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/SingleImageViewer/SingleImageViewer.js b/packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/SingleImageViewer/SingleImageViewer.js index 442e6418e4..5cf940f6af 100644 --- a/packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/SingleImageViewer/SingleImageViewer.js +++ b/packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/SingleImageViewer/SingleImageViewer.js @@ -34,10 +34,12 @@ function SingleImageViewer({ zoomControlFn = null, zooming = false }) { + const canvasLayer = useRef() + const canvas = canvasLayer.current const transform = `rotate(${rotate} ${width / 2} ${height / 2})` return ( - + {zoomControlFn && ( {children} diff --git a/packages/lib-classifier/src/plugins/drawingTools/components/draggable/draggable.js b/packages/lib-classifier/src/plugins/drawingTools/components/draggable/draggable.js index 35e142e7c6..ee56d721af 100644 --- a/packages/lib-classifier/src/plugins/drawingTools/components/draggable/draggable.js +++ b/packages/lib-classifier/src/plugins/drawingTools/components/draggable/draggable.js @@ -16,8 +16,9 @@ function createPoint(event) { function getEventOffset(event, canvas) { const svgPoint = createPoint(event) - const svgEventOffset = svgPoint.matrixTransform - ? svgPoint.matrixTransform(canvas.getScreenCTM().inverse()) + const ctm = canvas?.getScreenCTM() + const svgEventOffset = ctm && svgPoint.matrixTransform + ? svgPoint.matrixTransform(ctm.inverse()) : svgPoint return svgEventOffset }