This commit is contained in:
yumoqing 2024-10-28 16:55:14 +08:00
parent 7a2023446d
commit 76c3554a61

View File

@ -76,6 +76,7 @@ bricks.JsWidget = class {
"x", "x",
"y", "y",
"height", "height",
"cursor",
"margin", "margin",
"marginLeft", "marginLeft",
"marginRight", "marginRight",
@ -451,6 +452,7 @@ bricks.Tooltip = class extends bricks.Text {
super(opts); super(opts);
this.set_css('modal'); this.set_css('modal');
this.set_style('minWidth', '90px'); this.set_style('minWidth', '90px');
this.auto_task = null;
} }
show(otext, event){ show(otext, event){
this.set_otext(otext); this.set_otext(otext);
@ -476,9 +478,16 @@ bricks.Tooltip = class extends bricks.Text {
} }
this.set_style('left', x + 'px'); this.set_style('left', x + 'px');
this.set_style('top', y + 'px'); this.set_style('top', y + 'px');
if (this.auto_task){
this.auto_task.cancel();
}
this.auto_task = schedule_once(this.hide.bind(this), 30);
} }
hide(){ hide(){
console.log('moveout event happen'); if (this.auto_task){
this.auto_task.cancel();
this.auto_task = null;
}
this.set_style('display', 'none'); this.set_style('display', 'none');
} }
} }