Added timeline slider scroll wheel incrementation

This commit is contained in:
mxdanger 2022-05-09 23:03:23 -07:00
parent 275ac22684
commit fa725b2d56
2 changed files with 16 additions and 5 deletions

View file

@ -321,8 +321,6 @@ async function init() {
zoom = Math.max(minZoom, Math.min(maxZoom, zoom)) zoom = Math.max(minZoom, Math.min(maxZoom, zoom))
applyZoom(x, y, zoom) applyZoom(x, y, zoom)
e.preventDefault()
}, { passive: true }) }, { passive: true })
/*function setDesiredZoom(x, y, target){ /*function setDesiredZoom(x, y, target){

View file

@ -85,8 +85,21 @@ timelineSlider.max = variationsConfig[currentVariation].versions.length - 1
timelineSlider.value = currentPeriod timelineSlider.value = currentPeriod
timelineList.children[0].value = defaultPeriod timelineList.children[0].value = defaultPeriod
timelineSlider.addEventListener("input", (event) => { timelineSlider.addEventListener("input", (e) => timelineParser(e.target.value))
updateTooltip(parseInt(event.target.value), currentVariation)
timelineSlider.addEventListener("wheel", function (e) {
if (e.deltaY < 0) {
this.valueAsNumber += 1;
timelineParser(this.value)
} else {
this.value -= 1;
timelineParser(this.value)
}
e.stopPropagation();
}, { passive: true })
function timelineParser(value) {
updateTooltip(parseInt(value), currentVariation)
clearTimeout(updateTimeout) clearTimeout(updateTimeout)
updateTimeout = setTimeout(() => { updateTimeout = setTimeout(() => {
updateTime(parseInt(timelineSlider.value), currentVariation) updateTime(parseInt(timelineSlider.value), currentVariation)
@ -96,7 +109,7 @@ timelineSlider.addEventListener("input", (event) => {
} }
}, 50) }, 50)
}, 25) }, 25)
}) }
variantsEl.addEventListener("input", (event) => { variantsEl.addEventListener("input", (event) => {
updateTime(-1, event.target.value) updateTime(-1, event.target.value)