一个简单的比例控件,以公制(m/km)和英制(mi/ft)显示当前屏幕中心的比例。扩展控制。
A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends Control
.
Usage example
L.control.scale().addTo(map);
Creation
Factory | Description |
---|---|
L.control.scale(<Control.Scale options> options?) | Creates an scale control with the given options. 使用给定选项创建缩放控件。 |
Options
Option | Type | Default | Description |
---|---|---|---|
maxWidth | Number | 100 | Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500). 控件的最大宽度(以像素为单位)。动态设置宽度以显示舍入值(例如100、200、500)。 |
metric | Boolean | True | Whether to show the metric scale line (m/km). 是否显示公制刻度线(m/km)。 |
imperial | Boolean | True | Whether to show the imperial scale line (mi/ft). 是否显示英制刻度线(米/英尺)。 |
updateWhenIdle | Boolean | false | If true , the control is updated on moveend , otherwise it’s always up-to-date (updated on move ).如果为true,则控件在moveend时更新,否则它总是最新的(在移动时更新)。 |
▶ Options inherited from Control
从控件继承的选项
Methods
▶ Methods inherited from Control
从控件继承的方法
Method | Returns | Description |
---|---|---|
getPosition() | string | Returns the position of the control. 返回控件的位置。 |
setPosition(<string> position) | this | Sets the position of the control. 设置控件的位置。 |
getContainer() | HTMLElement | Returns the HTMLElement that contains the control. 返回包含控件的HTMLElement。 |
addTo(<Map> map) | this | Adds the control to the given map. 将控件添加到给定的映射。 |
remove() | this | Removes the control from the map it is currently active on. 从当前处于活动状态的贴图中删除控件。 |