Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PanHandler

Hierarchy

  • PanHandler

Index

Constructors

Accessors

Methods

Constructors

constructor

Accessors

currentZoom

  • get currentZoom(): number

Methods

clear

  • clear(): void
  • Clears the canvas. Should be called before each redraw after modifying zoom or pan.

    Returns void

incrementZoom

  • incrementZoom(delta: number): void
  • Increments the current zoom by a specific amount Note: Limited by max_zoom and min_zoom

    panHandler.zoom(3);
    // Zoom is now set to 3x magnification
    
    panHandler.incrementZoom(0.5);
    // Zoom is now set to 3.5x magnification
    
    panHandler.incrementZoom(-3);
    // Zoom is now set to 0.5x magnification

    Parameters

    • delta: number

    Returns void

pan

  • pan(diffX: number, diffY: number): void
  • Pans the canvas by (x, y) amount, scaled for the current zoom level to maintain visual expectations.

    Parameters

    • diffX: number
    • diffY: number

    Returns void

zoom

  • zoom(targetScale: number): void
  • Sets the zoom to an exact level. Note: Limited by max_zoom and min_zoom

    panHandler.zoom(3);
    // Zoom is now set to 3x magnification
    
    panHandler.zoom(0.5);
    // Zoom is now set to 0.5x magnification

    Parameters

    • targetScale: number

    Returns void

Generated using TypeDoc