MapLayr
    Preparing search index...

    Class MapView

    An interactive instance of a map attached to the DOM.

    Call Map.attach to create instances of this class.

    MapView#camerachange - Fired when the camera position, heading, or span changes.

    MapView#click - Fired when the user clicks on the map. The event is a MapMouseEvent with map coordinates.

    MapView#dblclick - Fired when the user double-clicks on the map. The event is a standard MouseEvent.

    Hierarchy

    Index

    Camera Properties

    • get heading(): number

      The heading of the camera, in degrees relative to true north.

      Returns number

    • get mapPoint(): MapPoint

      The map point at the centre of the map view.

      Returns MapPoint

    • get mapSpan(): number

      The span of the map view in map units.

      Returns number

      The map span represents the distance in map units between the edges of the screen in the smaller axis. For example, this would be the distance between the top edge and the bottom edge of the map view for map views which were wider than they were tall.

    • get span(): number

      The span of the map view in metres.

      Returns number

      The span represents the physical distance between the edges of the screen in the smaller axis. For example, this would be the distance between the top edge and the bottom edge of the map view for map views which were wider than they were tall.

    Configuration

    mouseWheelEventsRequireModifierKey: boolean = false

    Whether the shift or control key needs to be held down for mouse wheel events to affect the map view.

    If a mouse wheel event is handled by the map view, MapLayr will prevent the event's default action, stopping the browser window from scrolling. If the host web page contains custom scrolling logic, it is recommended that it checks that the event's defaultPrevented property is still false before it decides to apply that logic.

    mouseWheelZoomsMap: boolean = false

    Whether the mouse wheel zooms the map.

    If set to false, and neither the alt nor meta/command keys are held down, mouse wheel events will scroll the map instead of panning the map.

    If the control key is held down, the map always zooms in regardless of this property.

    Managing Map Layers

    • Adds the given map layer to the map.

      Parameters

      • mapLayer: MapLayer

        The map layer to add to the map view.

      Returns void

      The resulting map layer will appear on top of all other map layers.

    • Removes the given map layer from the map view.

      Parameters

      • mapLayer: MapLayer

        The map layer to remove.

      Returns void

    Night Mode

    • get colorTransformationPhase(): number

      The current colour transformation phase, between 0 (day) and 1 (night), derived from the resolved colorTransformationMode.

      Returns number

    • get lightsMode(): LightsMode

      The resolved lights mode: override → map → fixed(1).

      Returns LightsMode

    • get lightsModeOverride(): LightsMode | null

      Overrides the lights mode configured by the map. Set to null to use the map's configured mode.

      Returns LightsMode | null

    • set lightsModeOverride(value: LightsMode | null): void

      Parameters

      Returns void

    Other

    • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    Removing from Page

    • Detaches this map view from its container element.

      Returns void

      Once a map view is detached, it can no longer be useful and any remaining references to it should be removed to allow the garbage collector to deallocate it.

    Setting the Camera

    • Adjusts the camera using the specified options with an optional animation.

      Parameters

      • options: MoveCameraOptions

        The new properties of the camera. A missing property indicates that that property of the camera shouldn't be affected.

      Returns void

    Shapes

    • get shapes(): Shape[]

      The shapes which are drawn on the map.

      Returns Shape[]

    • Adds the given shape to the map.

      Parameters

      • shape: Shape

        The shape to add to the map view.

      Returns void

      The resulting shape will be rendered on the map and updated when the shape's properties change. Shapes are drawn in the order they are added, so later shapes will appear on top.

    • Removes the given shape from the map view.

      Parameters

      • shape: Shape

        The shape to remove.

      Returns void

    User Location Markers

    • Adds the given user location marker to the map.

      Parameters

      Returns void

      The resulting marker will be rendered on the map and updated when the map view is redrawn. Markers are drawn in the order they are added, so later markers will appear on top.

    • Removes the given user location marker from the map view.

      Parameters

      Returns void