Skip to content

KBE3D / KBCore / utils / MouseTooltip

类: MouseTooltip

鼠标移动提示框类,一般用于鼠标操作的文字提示

继承

属性

EventType

static EventType: { openPopup: "openPopup"; closePopup: "closePopup"; destroyPopup: "destroyPopup"; changePopupPosition: "changePopupPosition"; showPopup: "showPopup"; hidePopup: "hidePopup"; }

支持的事件类型

openPopup

openPopup: "openPopup" = 'openPopup'

Popup事件: 打开弹窗(Popup实例抛出、earth抛出、所在图层抛出)

closePopup

closePopup: "closePopup" = 'closePopup'

Popup事件: 关闭弹窗(Popup实例抛出、earth抛出、所在图层抛出)

destroyPopup

destroyPopup: "destroyPopup" = 'destroyPopup'

Popup事件: 销毁弹窗(Popup实例抛出、earth抛出、所在图层抛出)

changePopupPosition

changePopupPosition: "changePopupPosition" = 'changePopupPosition'

Popup事件: 弹窗位置变化(Popup实例抛出、earth抛出、所在图层抛出)

showPopup

showPopup: "showPopup" = 'showPopup'

Popup事件: 显示Popup(Popup实例抛出、earth抛出、所在图层抛出)

hidePopup

hidePopup: "hidePopup" = 'hidePopup'

Popup事件: 隐藏Popup(Popup实例抛出、earth抛出、所在图层抛出)

继承自

Popup.EventType


originOptions

readonly originOptions: any

原始构造参数备份

继承自

Popup.originOptions


uuid

readonly uuid: string

实例的唯一ID

继承自

Popup.uuid


options

options: MouseTooltipOptions

鼠标移动提示框类构造参数类型

重写了

Popup.options


enable

enable: boolean

是否启用鼠标移动监听


emptyText

emptyText: string = '暂无数据'

当没有数据时显示的文字,默认显示"暂无数据"

继承自

Popup.emptyText


_entity?

optional _entity: Entity

Cesium图标对象

继承自

Popup._entity

方法

open()

open(info?: string | Record<string, any>, position?: Cartesian3 | Cartesian2): void

打开popup

参数

info?

信息数据

string | Record<string, any>

position?

弹出位置(地理空间坐标),如果不传值,默认为曾经打开过的上次打开位置或Cesium.Cartesian3.ZERO零点

Cartesian3 | Cartesian2

返回

void

重写了

Popup.open


close()

close(): void

关闭popup

返回

void

重写了

Popup.close


show()

show(): void

显示dom元素信息窗

返回

void

重写了

Popup.show


hide()

hide(): void

隐藏dom元素信息窗

返回

void

重写了

Popup.hide


destroy()

destroy(): void

销毁释放对象

返回

void

重写了

Popup.destroy


setEntity()

setEntity(entity?: boolean | Entity | ConstructorOptions): void

设置popup图标点 Cesium图标标注,可以是Cesium.Entity对象或Cesium.Entity的构造参数对象或布尔类型 设置为Entity对象或构造参数对象,则使用用户自定义Entity 设置为true则使用内置默认的billboard图标标注 不传值或设置为false,则不创建图标标注

参数

entity?

popup图标点

boolean | Entity | ConstructorOptions

返回

void

继承自

Popup.setEntity

方法: 事件相关

once()

once(types: string | Record<any, any> | string[] | Record<EventTypeValue, any> | EventTypeValue[], fn: Function, context?: any): MouseTooltip

绑定一次性执行的指定类型事件监听器,与on类似,监听器只会被触发一次,然后被删除

参数

types

事件类型

string | Record<any, any> | string[] | Record<EventTypeValue, any> | EventTypeValue[]

fn

Function

绑定的监听器回调方法

context?

any

侦听器的上下文(this关键字将指向的对象)

返回

MouseTooltip

当前对象本身,可以链式调用

继承自

Popup.once


hasListener()

hasListener(type: string, propagate?: boolean): boolean

是否有绑定指定的事件

参数

type

string

事件类型

propagate?

boolean

是否判断指定的父类 (用addEventParent设置的)

返回

boolean

是否存在

继承自

Popup.hasListener


addEventParent()

addEventParent(obj: BaseClass): MouseTooltip

添加抛出事件到父类,它将接收传播的事件

参数

obj

BaseClass

父类对象

返回

MouseTooltip

当前对象本身,可以链式调用

继承自

Popup.addEventParent


removeEventParent()

removeEventParent(obj: BaseClass): MouseTooltip

移除抛出事件到父类

参数

obj

BaseClass

父类对象

返回

MouseTooltip

当前对象本身,可以链式调用

继承自

Popup.removeEventParent


hasEventParent()

hasEventParent(obj: BaseClass): boolean

是否绑定了抛出事件到指定父类

参数

obj

BaseClass

父类对象

返回

boolean

当前对象本身,可以链式调用

继承自

Popup.hasEventParent


emit()

emit(type: "openPopup" | "closePopup" | "destroyPopup" | "changePopupPosition" | "showPopup" | "hidePopup", data: PopupEventData): MouseTooltip

触发指定类型的事件。

参数

type

事件类型

"openPopup" | "closePopup" | "destroyPopup" | "changePopupPosition" | "showPopup" | "hidePopup"

data

PopupEventData

传输的数据或对象,可在事件回调方法中event对象中获取进行使用

返回

MouseTooltip

当前对象本身,可以链式调用

继承自

Popup.emit


on()

on(type: "openPopup" | "closePopup" | "destroyPopup" | "changePopupPosition" | "showPopup" | "hidePopup", fn: (event: BaseEvent<PopupEventData>) => any, context?: any): MouseTooltip

绑定指定类型事件监听器,支持在监听中调用 event.stopPropagation() 组织事件冒泡

参数

type

事件类型

"openPopup" | "closePopup" | "destroyPopup" | "changePopupPosition" | "showPopup" | "hidePopup"

fn

(event: BaseEvent<PopupEventData>) => any

绑定的监听器回调方法

context?

any

侦听器的上下文(this关键字将指向的对象)。

返回

MouseTooltip

当前对象本身,可以链式调用

继承自

Popup.on


off()

off(type: "openPopup" | "closePopup" | "destroyPopup" | "changePopupPosition" | "showPopup" | "hidePopup", fn: (event: BaseEvent<PopupEventData>) => any, context?: any): MouseTooltip

解除绑定指定类型事件监听器

参数

type

事件类型,未传值时解绑所有事件

"openPopup" | "closePopup" | "destroyPopup" | "changePopupPosition" | "showPopup" | "hidePopup"

fn

(event: BaseEvent<PopupEventData>) => any

绑定的监听器回调方法,未传值时解绑所有指定类型对应事件

context?

any

侦听器的上下文(this关键字将指向的对象)。

返回

MouseTooltip

当前对象本身,可以链式调用

继承自

Popup.off

构造函数

构造函数

new MouseTooltip(viewer: Viewer, options?: MouseTooltipOptions): MouseTooltip

参数

viewer

Viewer

Cesium.Viewer实例

options?

MouseTooltipOptions = {}

鼠标移动提示框类构造参数

返回

MouseTooltip

重写了

Popup.constructor

访问器

id

Getter 签名

get id(): string

对象的id标识

返回

string

继承自

Popup.id


container

Getter 签名

get container(): HTMLDivElement | undefined

contentType为'html'时,popup的DOM对象

返回

HTMLDivElement | undefined

继承自

Popup.container


viewerContainer

Getter 签名

get viewerContainer(): Element

父容器DOM对象

返回

Element

继承自

Popup.viewerContainer


direction

Getter 签名

get direction(): "right" | "left" | "bottom" | "top"

箭头方向

返回

"right" | "left" | "bottom" | "top"

Setter 签名

set direction(value: "right" | "left" | "bottom" | "top"): void

设置箭头方向

参数
value

"right" | "left" | "bottom" | "top"

返回

void

继承自

Popup.direction


currentWindowPosition

Getter 签名

get currentWindowPosition(): Cartesian2 | undefined

获取当前所处的屏幕坐标

返回

Cartesian2 | undefined

Setter 签名

set currentWindowPosition(value: Cartesian2 | undefined): void

设置当前所处的屏幕坐标

参数
value

Cartesian2 | undefined

返回

void

继承自

Popup.currentWindowPosition


currentCartesian

Getter 签名

get currentCartesian(): Cartesian3 | undefined

获取当前所处的地理空间坐标

返回

Cartesian3 | undefined

Setter 签名

set currentCartesian(value: Cartesian3 | undefined): void

设置当前所处的地理空间坐标

参数
value

Cartesian3 | undefined

返回

void

继承自

Popup.currentCartesian


entity

Getter 签名

get entity(): boolean | Entity | ConstructorOptions | undefined

获取popup图标点

返回

boolean | Entity | ConstructorOptions | undefined

Setter 签名

set entity(entity: boolean | Entity | ConstructorOptions | undefined): void

设置popup图标点

参数
entity

boolean | Entity | ConstructorOptions | undefined

返回

void

继承自

Popup.entity

KBE3D @3.0.0 Copyright © 2024-present KBE3D