import {Image, ImageCrop, ImageHotspot} from '@sanity/types' import React from 'react' import {DiffTooltip, ObjectDiff, useDiffAnnotationColor} from '../../../diff' import {hexToRgba} from './helpers' interface HotspotCropSVGProps { crop?: ImageCrop diff: ObjectDiff hash: string hotspot?: ImageHotspot width?: number height?: number } export function HotspotCropSVG( props: HotspotCropSVGProps & Omit, 'ref' | 'width' | 'height'> ) { const {crop, diff, hash, hotspot, width = 100, height = 100, ...restProps} = props const cropColor = useDiffAnnotationColor(diff, 'crop') const hotspotColor = useDiffAnnotationColor(diff, 'hotspot') return ( {crop && hotspot && ( )} {crop && ( )} {hotspot && ( )} ) } function CropSVG({ crop, width, height, ...restProps }: {crop: ImageCrop; width: number; height: number} & Omit< React.SVGProps, 'width' | 'height' >) { const rectProps = { x: crop.left * width, y: crop.top * height, width: (1 - crop.right - crop.left) * width, height: (1 - crop.bottom - crop.top) * height, } return } function HotspotSVG({ hotspot, offset = 0, width, height, ...restProps }: {hotspot: ImageHotspot; offset?: number; width: number; height: number} & Omit< React.SVGProps, 'width' | 'height' >) { const ellipseProps = { cx: hotspot.x * width, cy: hotspot.y * height, rx: (hotspot.width / 2) * width + offset, ry: (hotspot.height / 2) * height + offset, } return }