new SpriteMarkerNode()
Example
var data = {
id:
type: 'poi', // 0: poi 1: label... 默认6种类型的marker
content: { // marker 内容
frame:, // 边框 {color, alpha, strokeColor, extend, radius, lineWidth}
image:, // image, string or json: {url, width, height, (size), align, sourceX, sourceY, sourceW, sourceH}
texts: [] // texts, array element is string or json
}
anchor: 'bottom', // left right leftTop top bootom imageCenter etc.
anchorOffset: [],
autoHide: true,
priority: 0, // 显示优先级, 用于Marker之间的自动隐藏
renderOrder: 3, // 渲染顺序
position: [x, y, z], // originPosition
scale: [1, 1, 1], // originScale
tag: '', // 标记,用于添加一些分组等内容
minLevel: 17,
maxLevel: 23,
onLoad: function // onLoad call 回调方法
}
Extends
Members
-
doubleClick :function
-
当被双击时触发的回调
- Inherited From:
- Default Value:
- null
-
enabled :Boolean
-
是否可交互
- Inherited From:
- Default Value:
- true
-
endPick :function
-
当结束被拾取时触发的回调
- Inherited From:
- Default Value:
- null
-
longPressed :function
-
当被长按时触发的回调
- Inherited From:
- Default Value:
- null
-
mouseenter :function
-
针对桌面端,当鼠标进入此结点时触发的回调
- Inherited From:
- Default Value:
- null
-
mouseleave :function
-
针对桌面端,当鼠标离开此结点时触发的回调
- Inherited From:
- Default Value:
- null
-
picked :function
-
当被点击时触发的回调
- Inherited From:
- Default Value:
- null
-
pickIndex :Number
-
拾取优先级,值越大优先级越高
- Overrides:
- Default Value:
- 0
-
position
-
设置位置
-
scale
-
originScale
-
scale
-
originScale
-
startPick :function
-
在开始被拾取时触发的回调
- Inherited From:
- Default Value:
- null
-
tag
-
标记
Methods
-
clone() → {Node}
-
复制此结点
Returns:
Node - 复制出来的新结点- Overrides:
-
dispose()
-
销毁此结点
- Inherited From:
-
flash(data) → {SpriteMarkerNode}
-
大小放大缩小动画
Parameters:
Name Type Description data
object {duration: 1000} Properties
Name Type Attributes Default Description duration
int <optional>
1000 设置动画时间 scale
float <optional>
1.6 设置放大时的缩放比例 Returns:
SpriteMarkerNode - this -
getFrameString()
-
color,alpha,extend,strokeColor
-
getTextData()
-
texts string to data.content.texts array
-
getTextString()
-
text,size,align,color,strokeColor
-
markerHide()
-
marker的渐隐
-
markerShow()
-
marker 的渐显
-
refresh()
-
按当前的data数据得新创建
-
setData()
-
设置 data 内容
-
setEntity(entity)
-
为此结点设置其3D实体
Parameters:
Name Type Description entity
object3D 3D实体 - Inherited From:
-
setImage(urlOrImage)
-
更新图片, imageID, length: 32 and not contian '/'
Parameters:
Name Type Description urlOrImage
string | Image | imageID | object url or Image or imageData -
setImageSize(width, heightopt)
-
如果当前的标注中含有image对象, 可以通过些方法快速的设置些图片的大小
Parameters:
Name Type Attributes Description width
number 图片的宽度, 如果不设置 height ,height将与width使用相同的数值 height
number <optional>
图片的高度, 可选, 默认与width值相同 -
setText(text, indexopt)
-
更新文字
Parameters:
Name Type Attributes Default Description text
string 文字内容 index
int <optional>
0 第几行文字,默认为第一行文字 -
setTextColor(color, strokeColor, indexopt)
-
设置文字内容的颜色
Parameters:
Name Type Attributes Description color
hexString 如: '#ff0000' strokeColor
hexString 同上 index
int <optional>
第几行文字,不设置则针对所有的文字 -
toTargetAlpha()
-
渐变到指定的alpha
-
updateContent(data) → {null}
-
更新数据的通用方法
Parameters:
Name Type Description data
object 新的内容数据: {type: 'text' | 'image' | 'frame' | 'textColor', name:, value: } Returns:
null -
updateFrame(frame) → {SpriteMarkerNode}
-
更新frame
Parameters:
Name Type Description frame
object frame的配置 Returns:
SpriteMarkerNode - this -
updateRect()
-
得到映射矩形