Class: SpriteDomPlugin

SpriteDomPlugin()

Html的Dom转为Sprite

Constructor

new SpriteDomPlugin()

Methods

addLabel(options)

新增标签
Parameters:
Name Type Description
options Object
id:Number 标签对象的ID,可以通过该ID来删除标签
dom:需要转Sprite的Dom元素,可以通过css设置该dom不可见,请确保dom已经完全渲染后再调用该函数 , 也可以传入html文本
position:位置Vector3对象,该dom的中心点将置于position
zoom:true/false 是否跟随缩放,默认不缩放
bindData:object 业务绑定数据,可以在pick的时候返回
distance:Number 视距

getLabel(id)

获得标签对象,返回的是THREE.Sprite
Parameters:
Name Type Description
id * label id

getLabelDom(id)

获得标签对象对应的dom对象,可以对dom进行数据更新后调用updateContent,从而刷新标签内容
Parameters:
Name Type Description
id * label id

removeAll()

全部清除

removeLabel(id)

移除标签
Parameters:
Name Type Description
id *

setVisible(id, visible)

设置某个标签可见性
Parameters:
Name Type Description
id *
visible *

updateContent(id, options)

修改既有Label的内容dom
Parameters:
Name Type Description
id *
options *
Example
数据结果
{
     dom:内容dom,可以是dom对象,或者html文本
}

updatePosition(id, position)

修改既有Label的位置
Parameters:
Name Type Description
id * lable id
position * 位置,BIMI.THREE.Vector3