Skip to content

@jtopo/extensions / Tooltip

Class: Tooltip

小提示

js
// 示例
var tooltip = new Tooltip(stage);
tooltip.setHtml('小提示: 可以是html哦');

node.on('pointermove', function (event) {
   let input = stage.inputSystem;
   tooltip.showAt(input.x, input.y);
});

Hierarchy

  • EventTarget

    Tooltip

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Tooltip(stage)

Parameters

NameType
stageStage

Overrides

EventTarget.constructor

Properties

domElement

domElement: HTMLElement


stage

stage: Stage

Methods

addEventListener

addEventListener(type, callback): void

增加事件监听

Parameters

NameTypeDescription
typestring事件类型
callbackFunction

Returns

void

Inherited from

EventTarget.addEventListener


disable

disable(): void

禁用

Returns

void


dispatchEvent

dispatchEvent(event): void

分发事件

Parameters

NameType
eventEvent | EventBase

Returns

void

Inherited from

EventTarget.dispatchEvent


enabled

enabled(): void

启用

Returns

void


fadeOut

fadeOut(): void

隐藏提示框

Returns

void


hasListener

hasListener(type): boolean

是否有该类型的监听

Parameters

NameType
typestring

Returns

boolean

Inherited from

EventTarget.hasListener


removeEventListener

removeEventListener(type, callback): any

移除一个事件监听

Parameters

NameType
typestring
callbackFunction

Returns

any

Inherited from

EventTarget.removeEventListener


setHtml

setHtml(html): HTMLElement

设置显示的html内容

Parameters

NameType
htmlstring

Returns

HTMLElement


showAt

showAt(x, y): void

显示提示框

Parameters

NameType
xnumber
ynumber

Returns

void