Skip to content

@indoor-map/fmap-jsDocs


地图点击事件封装类

将 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

FMapClickEvent

Properties

level

readonly level: number

当前楼层级别


mapPoint

readonly mapPoint: object

点击的地图坐标

x

x: number

y

y: number


model

readonly model: null | FMapModel

点击到的要素(FMapModel 实例),未点击到要素时为 null


screenPoint

readonly screenPoint: 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

基于蜂鸟视图 Fengmap SDK 构建