mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-18 15:26:19 +08:00
Keep thumbnail open moving cursor to other tab
This commit is contained in:
parent
4474db27db
commit
357d2c5511
@ -518,21 +518,30 @@ onVueSetup(() => {
|
|||||||
},
|
},
|
||||||
mouseEnter(project, event) {
|
mouseEnter(project, event) {
|
||||||
if (project.thumbnail && !project.selected) {
|
if (project.thumbnail && !project.selected) {
|
||||||
let img = new Image();
|
if (this.thumbnail_timeout) {
|
||||||
|
clearTimeout(this.thumbnail_timeout);
|
||||||
|
delete this.thumbnail_timeout;
|
||||||
|
}
|
||||||
|
if (!this.thumbnail) {
|
||||||
|
this.thumbnail = new Image();
|
||||||
|
document.body.append(this.thumbnail);
|
||||||
|
}
|
||||||
|
let img = this.thumbnail;
|
||||||
img.src = project.thumbnail;
|
img.src = project.thumbnail;
|
||||||
img.attributes.width = '240px';
|
img.attributes.width = '240px';
|
||||||
img.className = 'project_thumbnail';
|
img.className = 'project_thumbnail';
|
||||||
this.thumbnail = img;
|
|
||||||
let offset = $(event.target).offset();
|
let offset = $(event.target).offset();
|
||||||
img.style.left = (offset.left) + 'px';
|
img.style.left = (offset.left) + 'px';
|
||||||
img.style.top = (offset.top + event.target.clientHeight) + 'px';
|
img.style.top = (offset.top + event.target.clientHeight) + 'px';
|
||||||
document.body.append(img);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mouseLeave() {
|
mouseLeave() {
|
||||||
if (this.thumbnail) {
|
if (this.thumbnail) {
|
||||||
this.thumbnail.remove();
|
this.thumbnail_timeout = setTimeout(() => {
|
||||||
delete this.thumbnail;
|
this.thumbnail.remove();
|
||||||
|
delete this.thumbnail;
|
||||||
|
delete this.thumbnail_timeout;
|
||||||
|
}, 40)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user