diff --git a/src/components/OavVideoStream.tsx b/src/components/OavVideoStream.tsx index 82defa4..585d71f 100644 --- a/src/components/OavVideoStream.tsx +++ b/src/components/OavVideoStream.tsx @@ -137,18 +137,8 @@ function VideoBoxWithOverlay(props: { const canvas = canvasRef.current; if (canvas) { const rect = canvas.getBoundingClientRect(); - // x and y relative to the canvas const [x, y] = [e.clientX - rect.left, e.clientY - rect.top]; - // x and y relative to the crosshair - const [relX, relY] = [x - props.crosshairX, y - props.crosshairY]; - // fraction of the image in x/y * original dimension in pixels - const scaledX = props.originalDims - ? (relX / width) * props.originalDims.width - : x; - const scaledY = props.originalDims - ? (relY / height) * props.originalDims.height - : y; - props.onCoordClick(scaledX, scaledY); + props.onCoordClick(x, y); } } }} diff --git a/src/screens/OavMover/OAVStageController.tsx b/src/screens/OavMover/OAVStageController.tsx index e55204c..29a4fcd 100644 --- a/src/screens/OavMover/OAVStageController.tsx +++ b/src/screens/OavMover/OAVStageController.tsx @@ -10,7 +10,7 @@ import { useMemo } from "react"; export function OavMover() { const DISPLAY_CONFIG_ENDPOINT = - "/dls_sw/i24/software/daq_configuration/display.configuration"; + "/dls_sw/i24/software/daq_configuration/domain/display.configuration"; const beamCenterQuery = useConfigCall(DISPLAY_CONFIG_ENDPOINT); const currentZoomValue = String( useParsedPvConnection({ @@ -39,13 +39,23 @@ export function OavMover() { return [Number(xLine.split(" ")[2]), Number(yLine.split(" ")[2])]; }, [beamCenterQuery.data, zoomIndex]); - // #Issue 86: Remove these constants - https://github.com/DiamondLightSource/mx-daq-ui/issues/86 - const pixelsPerMicron = 1.25; const theme = useTheme(); const bgColor = theme.palette.background.paper; const fullVisit = readVisitFromPv(); + function onCoordClick(x: number, y: number) { + submitAndRunPlanImmediately({ + planName: "move_on_oav_view_click", + planParams: { position: [x, y] }, + instrumentSession: parseInstrumentSession(fullVisit), + }).catch((error) => { + console.log( + `Failed to run plan , see console and logs for full error. Reason: ${error}`, + ); + }); + } + return (