Class MappedinMapLibreOverlay

Hierarchy

  • MapLibreOverlay<{
        loaded: {
            mapData: MapData;
            mapView: MapView;
        };
    }>
    • MappedinMapLibreOverlay

Constructors

Properties

Methods

Constructors

  • Parameters

    Returns MappedinMapLibreOverlay

Properties

core: Core
el: HTMLDivElement
layer?: CustomLayerInterface
map?: Map
origin?: Position

Methods

  • Unsubscribe a function previously subscribed with on

    Type Parameters

    • EVENT_NAME extends "loaded"

    Parameters

    • eventName: EVENT_NAME

      An event name to which the provided function was previously subscribed.

    • fn: ((payload: {
              loaded: {
                  mapData: MapData;
                  mapView: MapView;
              };
          }[EVENT_NAME] extends {
              data: null;
          }
          ? any[any]["data"]
          : {
              loaded: {
                  mapData: MapData;
                  mapView: MapView;
              };
          }[EVENT_NAME]) => void)

      A function that was previously passed to on. The function must have the same reference as the function that was subscribed.

        • (payload): void
        • Parameters

          • payload: {
                    loaded: {
                        mapData: MapData;
                        mapView: MapView;
                    };
                }[EVENT_NAME] extends {
                    data: null;
                }
                ? any[any]["data"]
                : {
                    loaded: {
                        mapData: MapData;
                        mapView: MapView;
                    };
                }[EVENT_NAME]

          Returns void

    Returns void

    // Unsubscribe from the 'click' event
    const handler = (event) => {
    console.log('Map was clicked', event);
    };
    map.off('click', handler);
  • Subscribe a function to an event.

    Type Parameters

    • EVENT_NAME extends "loaded"

    Parameters

    • eventName: EVENT_NAME

      An event name which, when fired, will call the provided function.

    • fn: ((payload: {
              loaded: {
                  mapData: MapData;
                  mapView: MapView;
              };
          }[EVENT_NAME] extends {
              data: null;
          }
          ? any[any]["data"]
          : {
              loaded: {
                  mapData: MapData;
                  mapView: MapView;
              };
          }[EVENT_NAME]) => void)

      A callback that gets called when the corresponding event is fired. The callback will get passed an argument with a type that's one of event payloads.

        • (payload): void
        • Parameters

          • payload: {
                    loaded: {
                        mapData: MapData;
                        mapView: MapView;
                    };
                }[EVENT_NAME] extends {
                    data: null;
                }
                ? any[any]["data"]
                : {
                    loaded: {
                        mapData: MapData;
                        mapView: MapView;
                    };
                }[EVENT_NAME]

          Returns void

    Returns void

    // Subscribe to the 'click' event
    const handler = (event) => {
    const { coordinate } = event;
    const { latitude, longitude } = coordinate;
    console.log(`Map was clicked at ${latitude}, ${longitude}`);
    };
    map.on('click', handler);
  • Parameters

    • map: any

    Returns HTMLDivElement

  • Returns void