Class: Panel

Panel

Class for panel controls.

new control.Panel() [source]

var panel = new Panel({
    position : {'bottom': '0', 'right': '0'},
    draggable : true,
    custom : false,
    content : '<div class="map-panel">hello </div>',
    closeButton : true
}).addTo(map);
Extends:
Fires:

Members

  • (constant) options

  • Properties:
    Name Type Description
    options Object options
    Properties
    Name Type Default Description
    position opt Object 'top-right' position of the control
    draggable opt Boolean true whether the panel can be dragged
    custom opt Boolean false whether the panel's content is customized .
    content String | HTMLElement panel's content, can be a dom element or a string.
    closeButton opt Boolean true whether to display the close button on the panel.
    Source:

    Methods

  • buildOn(map) [source]

  • method to build DOM of the control
    Parameter Type Description
    map Map map to build on
    Returns:
    HTMLDOMElement:
  • update() [source]

  • update control container
    Returns:
    control.Panel: this
  • setContent(content) [source]

  • Set the content of the Panel.
    Parameter Type Description
    content String | HTMLElement content of the infowindow. return {control.Panel} this
    Fires:

  • getContent() [source]

  • Get content of the infowindow.
    Returns:
    String|HTMLElement: - content of the infowindow
  • (inherited) addTo(map) [source]

  • Adds the control to a map.
    Parameter Type Description
    map Map
    Inherited From:
    Fires:
    Returns:
    control.Control: this
  • (inherited) getMap() [source]

  • Get the map that the control is added to.
    Inherited From:
    Returns:
    Map:
  • (inherited) getPosition() [source]

  • Get the position of the control
    Inherited From:
    Returns:
    Object:
  • (inherited) setPosition(position) [source]

  • update the control's position
    Parameter Type Description
    position String | Object can be one of 'top-left', 'top-right', 'bottom-left', 'bottom-right' or a position object like {'top': 40,'left': 60}
    Inherited From:
    Fires:
    Returns:
    control.Control: this
  • (inherited) getContainerPoint() [source]

  • Get the container point of the control.
    Inherited From:
    Returns:
    Point:
  • (inherited) getContainer() [source]

  • Get the control's container. Container is a div element wrapping the control's dom and decides the control's position and display.
    Inherited From:
    Returns:
    HTMLElement:
  • (inherited) getDOM() [source]

  • Get html dom element of the control
    Inherited From:
    Returns:
    HTMLElement:
  • (inherited) show() [source]

  • Show
    Inherited From:
    Returns:
    control.Control: this
  • (inherited) hide() [source]

  • Hide
    Inherited From:
    Returns:
    control.Control: this
  • (inherited) isVisible() [source]

  • Whether the control is visible
    Inherited From:
    Returns:
    Boolean:
  • (inherited) remove() [source]

  • Remove itself from the map
    Inherited From:
    Fires:
    Returns:
    control.Control: this
  • (inherited) on(eventsOn, handler, contextopt) [source]

  • Register a handler function to be called whenever this event is fired.
    foo.on('mousedown mousemove mouseup', onMouseEvent, foo);
    Parameter Type Default Description
    eventsOn String event types to register, seperated by space if more than one.
    handler function handler function to be called
    context opt Object null the context of the handler
    Mixes From:
    Inherited From:
    Returns:
    Any: this
  • (inherited) addEventListener(eventTypes, handler, contextopt) [source]

  • Alias for on
    Parameter Type Default Description
    eventTypes String event types to register, seperated by space if more than one.
    handler function handler function to be called
    context opt Object null the context of the handler
    Mixes From:
    Inherited From:
    Returns:
    : this
  • (inherited) once(eventTypes, handler, contextopt) [source]

  • Same as on, except the listener will only get fired once and then removed.
    foo.once('mousedown mousemove mouseup', onMouseEvent, foo);
    Parameter Type Default Description
    eventTypes String event types to register, seperated by space if more than one.
    handler function listener handler
    context opt Object null the context of the handler
    Mixes From:
    Inherited From:
    Returns:
    : this
  • (inherited) off(eventsOff, handler, contextopt) [source]

  • Unregister the event handler for the specified event types.
    foo.off('mousedown mousemove mouseup', onMouseEvent, foo);
    Parameter Type Default Description
    eventsOff String event types to unregister, seperated by space if more than one.
    handler function listener handler
    context opt Object null the context of the handler
    Mixes From:
    Inherited From:
    Returns:
    : this
  • (inherited) removeEventListener(eventTypes, handler, contextopt) [source]

  • Alias for off
    Parameter Type Default Description
    eventTypes String event types to unregister, seperated by space if more than one.
    handler function listener handler
    context opt Object null the context of the handler
    Mixes From:
    Inherited From:
    Returns:
    : this
  • (inherited) listens(eventType, hanlderopt, contextopt) [source]

  • Returns listener's count registered for the event type.
    Parameter Type Default Description
    eventType String an event type
    hanlder opt function null listener function
    context opt Object null the context of the handler
    Mixes From:
    Inherited From:
    Returns:
    Number:
  • (inherited) copyEventListeners(target) [source]

  • Copy all the event listener to the target object
    Parameter Type Description
    target Object target object to copy to.
    Mixes From:
    Inherited From:
    Returns:
    : this
  • (inherited) fire(eventType, param) [source]

  • Fire an event, causing all handlers for that event name to run.
    Parameter Type Description
    eventType String an event type to fire
    param Object parameters for the listener function.
    Mixes From:
    Inherited From:
    Returns:
    : this
  • (inherited) callInitHooks() [source]

  • Visit and call all the init hooks defined on Class and its parents.
    Inherited From:
    Returns:
    Class: this
  • (inherited) setOptions(options) [source]

  • Merges options with the default options of the object.
    Parameter Type Description
    options Object options to set
    Inherited From:
    Returns:
    Class: this
  • (inherited) config(conf) [source]

  • 1. Return object's options if no parameter is provided.
    2. update an option and enable/disable the handler if a handler with the same name existed.
    // Get marker's options;
    var options = marker.config();
    // Set map's option "draggable" to false and disable map's draggable handler.
    map.config('draggable', false);
    // You can update more than one options like this:
    map.config({
        'scrollWheelZoom' : false,
        'doubleClickZoom' : false
    });
    Parameter Type Description
    conf Object config to update
    Inherited From:
    Returns:
    Class: this
  • (inherited) onConfig() [source]

  • Default callback when config is called
    Inherited From:

    Events

  • dragstart [source]

  • drag start event
    Properties:
    Name Type Description
    type String dragstart
    target UIMarker the panel control fires event
    mousePos Point mouse position
    domEvent Event dom event
    Source:

  • dragging [source]

  • dragging event
    Properties:
    Name Type Description
    type String dragging
    target UIMarker the panel control fires event
    mousePos Point mouse position
    domEvent Event dom event
    Source:

  • dragend [source]

  • drag end event
    Properties:
    Name Type Description
    type String dragend
    target UIMarker the panel control fires event
    mousePos Point mouse position
    domEvent Event dom event
    Source:

  • (inherited) add [source]

  • add event.
    Inherited From:
    Properties:
    Name Type Description
    type String add
    target control.Control the control instance
    Inherited From:
    Source:

  • (inherited) remove [source]

  • remove event.
    Inherited From:
    Properties:
    Name Type Description
    type String remove
    target control.Control the control instance
    Inherited From:
    Source:

  • (inherited) positionchange [source]

  • Control's position update event.
    Inherited From:
    Properties:
    Name Type Description
    type String positionchange
    target control.Control the control instance
    position Object Position of the control, eg:{"top" : 100, "left" : 50}
    Inherited From:
    Source: