Appearance
ScaleControl
ScaleControl
比例尺控件
Examples
javascript
const sCtrol = new DiMap.ScaleControl({
maxWidth: 100, // 最大宽度(px)
unit: "metric" // 单位,有效的度量单位字符串
})
map.addControl(sCtrol, "top-left") // 添加到地图左上角constructor
构造函数
参数
| 参数名 | 必选 | 类型 | 描述 |
|---|---|---|---|
| options.maxWidth | 否 | number | undefined | 指定最大宽度(像素) |
| options.unit | 否 | string | undefined | 指定单位,默认为"metric",可选值:"imperial"、"metric"、"nautical" |
setUnit
设置单位
参数
| 参数名 | 必选 | 类型 | 描述 |
|---|---|---|---|
| unit | 是 | "imperial" | "metric" | "nautical" | 设置比例尺的单位 |
Returns void