Keep thumbnail open moving cursor to other tab

This commit is contained in:
JannisX11 2021-08-22 14:32:34 +02:00
parent 4474db27db
commit 357d2c5511

View File

@ -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)
} }
} }
} }