import React from 'react'; import OuterRect from '../OuterRect'; import { rectCalc, parsePositionForBackend } from '../../helpers/position'; import { AnnotationContainer } from '../../global/otherStyled'; import Img from './styled'; const Image: React.FC = ({ id, obj_type, obj_attr: { src = '', position }, scale, viewport, isCollapse, onUpdate, }: AnnotationElementPropsType) => { const annotRect = rectCalc(position as PositionType, viewport.height, scale); const handleScaleOrMove = ({ top, left, width = 0, height = 0, }: CoordType): void => { const newPosition = { top, left, bottom: top + (height || annotRect.height), right: left + (width || annotRect.width), }; onUpdate({ position: parsePositionForBackend( obj_type, newPosition, viewport.height, scale, ), }); }; return ( <> {!isCollapse ? ( ) : ( '' )} ); }; export default Image;