Skip to main content

drawShape

  • Signature : (stage: Stage, shapeId: string | number, config: Config) => void

Update shape config and redraw the shapes layer (the canvas on which we draw shapes)

How to get stage object ?

You can get the stage object using the getStage available on AnnotationViewer and AnnotationLens

Example#

const stageObject = useRef<Stage | null>(null)
const onMouseClick = (shape: AnnotationShape) => {  drawShape(stageObject.current, shape.id, { fill: 'red' })}
return (  <AnnotationViewer    getStage={getStage}    onMouseClick={onMouseClick}    // other props  />)