diff --git a/package-lock.json b/package-lock.json index 3ec32873..67650984 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "voyager", - "version": "0.27.0", + "version": "0.30.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/source/client/ui/explorer/TourNavigator.ts b/source/client/ui/explorer/TourNavigator.ts index 9e5b3a7e..d9d46b8e 100644 --- a/source/client/ui/explorer/TourNavigator.ts +++ b/source/client/ui/explorer/TourNavigator.ts @@ -71,12 +71,16 @@ export default class TourNavigator extends DocumentView } this.stepTitle = title; + if(this.firstRender) { + title = ""; + } + const exitButton = ui.isShowing(EUIElements.tour_exit) ? html`` : null; return html`
this.onKeyDown(e)}>
${exitButton} -
-
${title}
+
+
${title}
${info}
@@ -98,11 +102,15 @@ export default class TourNavigator extends DocumentView const titleDiv = this.getElementsByClassName("sv-title").item(0) as HTMLElement; if(titleDiv) { - titleDiv.innerHTML = this.stepTitle; + //titleDiv.innerHTML = this.stepTitle; if(this.firstRender) { - setTimeout(() => {titleDiv.innerHTML = `
${this.stepTitle}
`;}, 100); + //setTimeout(() => {titleDiv.innerHTML = `
${this.stepTitle}
`;}, 100); + setTimeout(() => {titleDiv.innerText = this.stepTitle;}, 100); this.firstRender = false; } + else { + titleDiv.innerText = this.stepTitle; + } } } @@ -124,8 +132,9 @@ export default class TourNavigator extends DocumentView // go to previous tour step this.tours.ins.previous.set(); - // reset direction of title text - this.textDirHelper(true); + // cancel any existing animations + const titleDiv = this.querySelector("#title-inner") as HTMLElement; + titleDiv.classList.remove("sv-text-scroll"); } protected onClickNext() @@ -133,15 +142,14 @@ export default class TourNavigator extends DocumentView // go to next tour step this.tours.ins.next.set(); - // reset direction of title text - this.textDirHelper(true); + // cancel any existing animations + const titleDiv = this.querySelector("#title-inner") as HTMLElement; + titleDiv.classList.remove("sv-text-scroll"); } protected onClickTitle() { - // change direction of title text - const titleDiv = this.querySelector("#title-text") as HTMLElement; - this.textDirHelper(titleDiv.style.direction === "rtl"); + this.textHelper(); } /*protected focusActive() @@ -181,8 +189,33 @@ export default class TourNavigator extends DocumentView } } - protected textDirHelper(lToR: boolean) { - const titleDiv = this.querySelector("#title-text") as HTMLElement; - titleDiv.style.direction = lToR ? "ltr" : "rtl"; + protected textHelper() { + const buffer = 12; + const titleDiv = this.querySelector("#title-inner") as HTMLElement; + const offset = titleDiv.scrollWidth - titleDiv.offsetWidth + buffer; + + if(offset > buffer) { + const titleArea = this.querySelector("#title-area") as HTMLElement; + const duration = offset/30; + + titleDiv.classList.remove("ff-ellipsis"); + + titleDiv.style.setProperty("animation-duration", duration.toString()+"s"); + titleDiv.style.setProperty("--x-offset", "-" + offset + "px"); + titleArea.style.setProperty("pointer-events", "none"); + titleDiv.classList.add("sv-text-scroll"); + + titleDiv.addEventListener("animationend",() => { + titleDiv.classList.remove("sv-text-scroll"); + titleDiv.classList.add("ff-ellipsis"); + titleArea.style.setProperty("pointer-events", "auto"); + }); + + titleDiv.addEventListener("animationcancel",() => { + titleDiv.classList.remove("sv-text-scroll"); + titleDiv.classList.add("ff-ellipsis"); + titleArea.style.setProperty("pointer-events", "auto"); + }); + } } } \ No newline at end of file diff --git a/source/client/ui/explorer/styles.scss b/source/client/ui/explorer/styles.scss index 4fc0add0..289522fa 100644 --- a/source/client/ui/explorer/styles.scss +++ b/source/client/ui/explorer/styles.scss @@ -1064,12 +1064,18 @@ $tour-entry-indent: 12px; } .sv-title { font-size: 1.1em; + @keyframes ticker { 100% { transform:translateX(var(--x-offset)); } } } .sv-text { font-size: 0.9em; } } +.sv-text-scroll { + animation:ticker 1s linear 1; + text-overflow: clip; +} + //////////////////////////////////////////////////////////////////////////////// // TARGET NAVIGATOR