Skip to content
Design System
GitHub

0.68 migration

0.68 lets people edit annotated-image's marks by hand. One change can break a build: a shape may now be a four-point quad.

Who has to change something

Code of your own that reads AnnotationShape with an exhaustive switch (shape.type) stops compiling: add a case "quad" that draws or exports the four points as a closed outline, or a default. Drawing with annotated-image needs nothing: it draws quads itself. Editing is off unless you pass onAnnotationsChange.

AnnotationShape
// 0.68: a shape may be a quad, four corners in order (a licence plate seen at an angle)
function outline(shape: AnnotationShape) {
  switch (shape.type) {
    case "box": /* … */
    case "point": /* … */
    case "polygon": /* … */
    case "keypoints": /* … */
    case "quad":
      return shape.points // a closed outline through the four corners
  }
}
Find what to change
# Run from your project's root: code that switches over every annotation shape.
grep -rnE 'shape\.type|case "polygon"' src