Skip to main content
Version: Next

getPasteRegionOffset

Callable

  • getPasteRegionOffset(pasteOffsetUnit: PasteOffsetUnit, zoomLevel: number): number

  • Converts the abstract PASTE_OFFSET constant into an image-pixel offset appropriate for the current zoom level and user preference.

    • ScreenPixel: returns PASTE_OFFSET / zoomLevel so the on-screen distance is always the same regardless of zoom.
    • ImagePixel: returns PASTE_OFFSET so the image-space offset stays fixed.
    • Auto with zoomLevel < 1: same as ScreenPixel (zoomed out, keep visible gap).
    • Auto with zoomLevel >= 1: divides by ceil(zoomLevel / 5) so the offset shrinks in steps as the user zooms in; minimum returned value is 1.

    Parameters

    • pasteOffsetUnit: PasteOffsetUnit

      The unit mode chosen in user preferences.

    • zoomLevel: number

      The current image zoom level (image pixels per screen pixel).

    Returns number

    The paste offset in image pixels.