import { forwardRef } from 'react'; import { withBluefish, withBluefishFn, BBox } from '../bluefish'; import { NewBBox } from '../NewBBox'; export type RectProps = React.SVGProps; export const Rect = withBluefishFn( ({ x, y, width, height }: RectProps) => { return () => { console.log('measuring rect', x, y, width, height); return { left: x !== undefined ? +x : undefined, top: y !== undefined ? +y : undefined, width: width !== undefined ? +width : undefined, height: height !== undefined ? +height : undefined, }; }; }, forwardRef((props: RectProps & { $bbox?: Partial }, ref: any) => { console.log('rect props', props, props.$bbox); const { $bbox, ...rest } = props; return ( // translate and scale based on $bbox.coord ); }), ); Rect.displayName = 'Rect';