Popup Class

Module: UI

信息窗体

Show:

Index

Methods

addTo

(map)

向地图中添加一个信息窗体

Parameters:

  • map Map

    minemap对象。

Returns:

Popup

this

remove

()

删除指定的信息窗体

Example:

var popup = new minemap.Popup().addTo(map);
popup.remove();

Returns:

Popup

this

getLngLat

()

返回信息窗体的经纬度坐标

Returns:

LngLat

信息窗体经纬度坐标锚点。

setLngLat

(lnglat)

设置信息窗体的经纬度锚点,并移动到指定的位置。

Parameters:

  • lnglat LngLatLike

    The geographical location to set as the popup's anchor.

Returns:

Popup

this

setText

(text)

Example:

var popup = new minemap.Popup()
    .setLngLat([116.4110, 39.9160])
    .setText('Hello, world!')
    .addTo(map);

Parameters:

  • text String

    信息窗体内容文字。

Returns:

Popup

this

setHTML

(html)

通过HTML字符串的形式添加信息窗体内容。

Parameters:

  • html String

    HTML内容字符串。

Returns:

Popup

this

setDOMContent

(htmlNode)

用dom元素设置信息窗体的内容。

Example:

var div = document.createElement('div');
div.innerHTML = 'Hello, world!';
var popup = new minemap.Popup()
    .setLngLat([116.4110, 39.9160])
    .setDOMContent(div)
    .addTo(map);

Parameters:

  • htmlNode Node

    作为信息窗体的内容的dom元素

Returns:

Popup

this

Properties

Events

close

当信息窗体关闭时触发

Parameters:

  • data Object