Constructor
new HtmlLabelPlugin()
Methods
addLabel(options)
添加html label
Parameters:
Name | Type | Description |
---|---|---|
options |
* |
Example
参数说明:
{
id:label ID
bindData:object 业务绑定数据,可以在pick的时候返回
position:位置,默认new THREE.Vector3(0,0,0)
text:文字
fontColor:文字颜色,默认'#ffffff'
backgroundColor:标签背景色,默认'#32d3a6'
fontSize:文字字号,默认'16px'
distance: 视距,Number类型,默认是null,就无限制
}
getLabel(id)
获得某个Label对象
Parameters:
Name | Type | Description |
---|---|---|
id |
* | label id |
getLabelDom(id)
获得id对应的label dom对象,可以拿到dom后执行一些动态处理,譬如数据刷新
Parameters:
Name | Type | Description |
---|---|---|
id |
Number |
onClick(event)
发送Label点击事件,可以通过plugin.on('click',data=>{})捕捉
Parameters:
Name | Type | Description |
---|---|---|
event |
* |
refresh()
刷新标签
removeAll()
清空所有label
removeLabel(id)
移除某个label
Parameters:
Name | Type | Description |
---|---|---|
id |
* | Label ID |
setClusterLimit(limit)
设置标签聚合的像素距离阀值
Parameters:
Name | Type | Default | Description |
---|---|---|---|
limit |
* | 100 |
setVisible(id, visible)
设置某个Label可见性
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | 对象id |
visible |
Boolean | 可见性 |
updateContent(id, options)
修改既有Label的文本和样式
Parameters:
Name | Type | Description |
---|---|---|
id |
* | lable id |
options |
* |
Example
数据定义
{
text: 文本,不设就保持既有的
fontColor: 文字颜色,不设就保持既有的
backgroundColor: 标签背景色, 不设就保持既有的
fontSize: 文字字号,不设就保持既有的
}
updatePosition(id, position)
修改既有Label的位置
Parameters:
Name | Type | Description |
---|---|---|
id |
* | lable id |
position |
* | 位置,BIMI.THREE.Vector3 |