@indoor-map/fmap-js • Docs
地图点击事件封装类
将 SDK 原始点击事件数据统一封装,提供类型安全的访问方式。 model 字段为点击到的要素(FMapModel 实例),可直接调用 highlight/moveTo 等方法。
Example
ts
onMapClick={(event) => {
if (event.hasModel) {
event.model!.focus({ highlightColor: '#ff0000' });
console.log('点击了:', event.model!.name);
} else {
console.log('点击坐标:', event.mapPoint);
}
}}Constructors
new FMapClickEvent()
new FMapClickEvent(
options):FMapClickEvent
Parameters
• options
• options.level: number
• options.mapPoint
• options.mapPoint.x: number
• options.mapPoint.y: number
• options.model: null | FMapModel
• options.screenPoint
• options.screenPoint.x: number
• options.screenPoint.y: number
Returns
Properties
level
readonlylevel:number
当前楼层级别
mapPoint
readonlymapPoint:object
点击的地图坐标
x
x:
number
y
y:
number
model
readonlymodel:null|FMapModel
点击到的要素(FMapModel 实例),未点击到要素时为 null
screenPoint
readonlyscreenPoint:object
点击的屏幕坐标
x
x:
number
y
y:
number
Accessors
feature
Get Signature
get feature():
null|FMapModel
获取点击到的要素(别名,语义更清晰)
Returns
null | FMapModel
hasModel
Get Signature
get hasModel():
boolean
是否点击到了要素
Returns
boolean