Skip to main content
Version: Next

getPasteShiftDelta

Callable

  • getPasteShiftDelta(points: Point2D[], regionType: RegionType, pasteOffset?: number): Point2D

  • Computes the translation delta used to offset a pasted region away from its source position.

    For line-like regions (LINE, ANNLINE, ANNVECTOR, ANNRULER) the shift is perpendicular to the line direction: the direction vector is rotated 90° clockwise and scaled so its dominant component equals pasteOffset. For all other region types the shift is the fixed diagonal {x: pasteOffset, y: -pasteOffset}.


    Parameters

    • points: Point2D[]

      Control points of the region in image pixel coordinates.

    • regionType: RegionType

      The type of the region.

    • pasteOffset: number = PASTE_OFFSET

      Desired offset magnitude in image pixels. Defaults to PASTE_OFFSET.

    Returns Point2D

    Translation delta {x, y} to apply to the region's control points.