feat: add back-and-forth animation for media title and artist overflow labels

This commit is contained in:
mr. M
2025-03-16 23:29:09 +01:00
parent fe9eb8884e
commit 401085f231
4 changed files with 40 additions and 9 deletions

View File

@@ -168,9 +168,22 @@ class ZenMediaController {
},
{}
);
this.addLabelOverflows();
});
}
addLabelOverflows() {
const elements = [this.mediaTitle, this.mediaArtist];
for (const element of elements) {
const parent = element.parentElement;
if (element.scrollWidth > parent.clientWidth) {
element.setAttribute('overflow', '');
} else {
element.removeAttribute('overflow');
}
}
}
setupMediaController(mediaController, browser) {
this._currentMediaController = mediaController;
this._currentBrowser = browser;