Skip to main content
Version: Next

shiftRegionPoints

Callable

  • shiftRegionPoints(points: Point2D[], regionType: RegionType, offsetX: number, offsetY: number): Point2D[]

  • Translates a region's control points by the given offset.

    For center-based region types (POINT, RECTANGLE, ELLIPSE, and their annotation equivalents) only the first control point (the center) is shifted; size and shape points remain unchanged. For all other types every control point is shifted.


    Parameters

    • points: Point2D[]

      Control points of the region in image pixel coordinates.

    • regionType: RegionType

      The type of the region.

    • offsetX: number

      Horizontal translation in image pixels.

    • offsetY: number

      Vertical translation in image pixels.

    Returns Point2D[]

    A new array of shifted control points (original array is not mutated).