How to rotate/flip Annotations by 180 degrees?

Hi Kirin,

You can not set the rotation of AnnotationCreateDistanceMeasurement annotation by setting the rotation property. The rotation property only applies to Stamp, FreeText and Caret annotations. We can however use the functions setStartPoint and setEndPoint to create the desired rotation. Here is an example where any instance of a line annotation (this includes AnnotationCreateDistanceMeasurement) which is horizontal will toggle between 90deg and 0deg rotation.

 const { Annotations, annotManager } = instance;
 
  const annotations = annotManager.getSelectedAnnotations()
      annotations.forEach(annot => {
        if(annot instanceof Annotations.LineAnnotation) {
          const xStart = annot.Start.x;
          const yStart = annot.Start.y;
          const xEnd =  annot.End.x;
          const yEnd =  annot.End.y;
          const xLength = xEnd - xStart;
          const yLength = yEnd - yStart;
          annot.setStartPoint(xStart,yStart);
          annot.setEndPoint(xStart+yLength, yStart+xLength);
          annot.adjustRect();
        
    } 
  });  

Let me know if you have any more questions,

Dustin