terra-draw-monorepo
    Preparing search index...

    Class TerraDrawMapLibreGLAdapter<MapType>

    Type Parameters

    • MapType

    Hierarchy

    • TerraDrawBaseAdapter
      • TerraDrawMapLibreGLAdapter
    Index

    Constructors

    Properties

    _coordinatePrecision: number
    _currentModeCallbacks: TerraDrawCallbacks | undefined
    _dragState: "not-dragging" | "pre-dragging" | "dragging"
    _heldKeys: Set<string>
    _ignoreMismatchedPointerEvents: boolean
    _lastDrawEvent: TerraDrawMouseEvent | undefined
    _listeners: AdapterListener<
        BasePointerListener
        | BaseKeyboardListener
        | BaseMouseListener,
    >[]
    _minPixelDragDistance: number
    _minPixelDragDistanceDrawing: number
    _minPixelDragDistanceSelecting: number

    Methods

    • Returns AdapterListener<BasePointerListener>[]

    • Parameters

      • event: PointerEvent | MouseEvent

      Returns "left" | "neither" | "middle" | "right"

    • Parameters

      • event: PointerEvent | MouseEvent
      • OptionalisContextMenu: boolean

      Returns TerraDrawMouseEvent | null

    • Returns the longitude and latitude coordinates from a given PointerEvent on the map.

      Parameters

      • event: PointerEvent | MouseEvent

        The PointerEvent or MouseEvent containing the screen coordinates of the pointer.

      Returns { lat: number; lng: number }

      An object with 'lng' and 'lat' properties representing the longitude and latitude, or null if the conversion is not possible.

    • Parameters

      • event: PointerEvent | MouseEvent

      Returns { containerX: number; containerY: number }

    • Converts longitude and latitude coordinates to pixel coordinates in the map container.

      Parameters

      • lng: number

        The longitude coordinate to project.

      • lat: number

        The latitude coordinate to project.

      Returns { x: number; y: number }

      An object with 'x' and 'y' properties representing the pixel coordinates within the map container.

    • Registers the provided callbacks for the current drawing mode and attaches the necessary event listeners.

      Parameters

      • callbacks: TerraDrawCallbacks

        An object containing callback functions for handling various drawing events in the current mode.

      Returns void

    • Renders GeoJSON features on the map using the provided styling configuration.

      Parameters

      • changes: TerraDrawChanges

        An object containing arrays of created, updated, and unchanged features to render.

      • styling: TerraDrawStylingFunction

        An object mapping draw modes to feature styling functions

      Returns void

    • Sets the cursor style for the map container.

      Parameters

      • cursor: "unset" | "grab" | "grabbing" | "crosshair" | "pointer" | "wait" | "move"

        The CSS cursor style to apply, or 'unset' to remove any previously applied cursor style.

      Returns void

    • Enables or disables the double-click to zoom functionality on the map.

      Parameters

      • enabled: boolean

        Set to true to enable double-click to zoom, or false to disable it.

      Returns void

    • Converts pixel coordinates in the map container to longitude and latitude coordinates.

      Parameters

      • x: number

        The x-coordinate in the map container to unproject.

      • y: number

        The y-coordinate in the map container to unproject.

      Returns { lat: number; lng: number }

      An object with 'lng' and 'lat' properties representing the longitude and latitude coordinates.