Appearance
@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
Name | Type |
---|---|
stage | Stage |
Overrides
EventTarget.constructor
Properties
domElement
domElement: HTMLElement
stage
stage: Stage
Methods
addEventListener
addEventListener(type
, callback
): void
增加事件监听
Parameters
Name | Type | Description |
---|---|---|
type | string | 事件类型 |
callback | Function |
Returns
void
Inherited from
EventTarget.addEventListener
disable
disable(): void
禁用
Returns
void
dispatchEvent
dispatchEvent(event
): void
分发事件
Parameters
Name | Type |
---|---|
event | Event | EventBase |
Returns
void
Inherited from
EventTarget.dispatchEvent
enabled
enabled(): void
启用
Returns
void
fadeOut
fadeOut(): void
隐藏提示框
Returns
void
hasListener
hasListener(type
): boolean
是否有该类型的监听
Parameters
Name | Type |
---|---|
type | string |
Returns
boolean
Inherited from
EventTarget.hasListener
removeEventListener
removeEventListener(type
, callback
): any
移除一个事件监听
Parameters
Name | Type |
---|---|
type | string |
callback | Function |
Returns
any
Inherited from
EventTarget.removeEventListener
setHtml
setHtml(html
): HTMLElement
设置显示的html内容
Parameters
Name | Type |
---|---|
html | string |
Returns
HTMLElement
showAt
showAt(x
, y
): void
显示提示框
Parameters
Name | Type |
---|---|
x | number |
y | number |
Returns
void