mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-14 16:34:04 +09:00
centre-anchored scrolling on Cues tab
This commit is contained in:
@@ -1659,17 +1659,14 @@ function ordersInput(wo, event) {
|
|||||||
|
|
||||||
if (keysym === '<UP>') {
|
if (keysym === '<UP>') {
|
||||||
ordersCursor = Math.max(0, ordersCursor - moveDelta)
|
ordersCursor = Math.max(0, ordersCursor - moveDelta)
|
||||||
if (ordersCursor < ordersScroll) ordersScroll = ordersCursor
|
|
||||||
} else if (keysym === '<DOWN>') {
|
} else if (keysym === '<DOWN>') {
|
||||||
ordersCursor = Math.min(maxCue, ordersCursor + moveDelta)
|
ordersCursor = Math.min(maxCue, ordersCursor + moveDelta)
|
||||||
if (ordersCursor >= ordersScroll + PTNVIEW_HEIGHT) ordersScroll = Math.max(0, ordersCursor - PTNVIEW_HEIGHT + 1)
|
|
||||||
} else if (keysym === '<PAGE_UP>') {
|
} else if (keysym === '<PAGE_UP>') {
|
||||||
ordersCursor = Math.max(0, ordersCursor - PTNVIEW_HEIGHT)
|
ordersCursor = Math.max(0, ordersCursor - PTNVIEW_HEIGHT)
|
||||||
ordersScroll = Math.max(0, ordersScroll - PTNVIEW_HEIGHT)
|
|
||||||
} else if (keysym === '<PAGE_DOWN>') {
|
} else if (keysym === '<PAGE_DOWN>') {
|
||||||
ordersCursor = Math.min(maxCue, ordersCursor + PTNVIEW_HEIGHT)
|
ordersCursor = Math.min(maxCue, ordersCursor + PTNVIEW_HEIGHT)
|
||||||
if (ordersCursor >= ordersScroll + PTNVIEW_HEIGHT) ordersScroll = Math.max(0, ordersCursor - PTNVIEW_HEIGHT + 1)
|
|
||||||
}
|
}
|
||||||
|
scrollOrdersTo(ordersCursor)
|
||||||
|
|
||||||
if (ordersCursor === oldCursor && ordersScroll === oldScroll) return
|
if (ordersCursor === oldCursor && ordersScroll === oldScroll) return
|
||||||
const dScroll = ordersScroll - oldScroll
|
const dScroll = ordersScroll - oldScroll
|
||||||
@@ -1755,6 +1752,19 @@ function scrollPatternGridTo(row) {
|
|||||||
patternGridScroll = Math.max(0, ROWS_PER_PAT - PTNVIEW_HEIGHT)
|
patternGridScroll = Math.max(0, ROWS_PER_PAT - PTNVIEW_HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scrollOrdersTo(ci) {
|
||||||
|
const maxCue = song.lastActiveCue < 0 ? 0 : song.lastActiveCue
|
||||||
|
const total = maxCue + 1
|
||||||
|
if (ci < ordersScroll) ordersScroll = ci
|
||||||
|
if (ci < ordersScroll + (PTNVIEW_HEIGHT >>> 1) && ordersScroll > 0)
|
||||||
|
ordersScroll = ci - (PTNVIEW_HEIGHT >>> 1)
|
||||||
|
if (ci >= ordersScroll + ((PTNVIEW_HEIGHT + 1) >>> 1))
|
||||||
|
ordersScroll = ci - ((PTNVIEW_HEIGHT + 1) >>> 1) + 1
|
||||||
|
if (ordersScroll < 0) ordersScroll = 0
|
||||||
|
if (ordersScroll + PTNVIEW_HEIGHT > total)
|
||||||
|
ordersScroll = Math.max(0, total - PTNVIEW_HEIGHT)
|
||||||
|
}
|
||||||
|
|
||||||
function clampPatternGrid() {
|
function clampPatternGrid() {
|
||||||
if (patternGridRow < 0) patternGridRow = 0
|
if (patternGridRow < 0) patternGridRow = 0
|
||||||
if (patternGridRow >= ROWS_PER_PAT) patternGridRow = ROWS_PER_PAT - 1
|
if (patternGridRow >= ROWS_PER_PAT) patternGridRow = ROWS_PER_PAT - 1
|
||||||
@@ -2455,8 +2465,7 @@ function updatePlayback() {
|
|||||||
if (currentPanel === VIEW_TIMELINE) redrawPanel()
|
if (currentPanel === VIEW_TIMELINE) redrawPanel()
|
||||||
else if (currentPanel === VIEW_PATTERN_DETAILS && song.numPats > 0) { simStateKey = ''; redrawPanel() }
|
else if (currentPanel === VIEW_PATTERN_DETAILS && song.numPats > 0) { simStateKey = ''; redrawPanel() }
|
||||||
else if (currentPanel === VIEW_CUES) {
|
else if (currentPanel === VIEW_CUES) {
|
||||||
if (cueIdx < ordersScroll) ordersScroll = cueIdx
|
scrollOrdersTo(cueIdx)
|
||||||
if (cueIdx >= ordersScroll + PTNVIEW_HEIGHT) ordersScroll = Math.max(0, cueIdx - PTNVIEW_HEIGHT + 1)
|
|
||||||
drawOrdersContents()
|
drawOrdersContents()
|
||||||
}
|
}
|
||||||
} else if (previewActive || nowCue === cueIdx) {
|
} else if (previewActive || nowCue === cueIdx) {
|
||||||
|
|||||||
Reference in New Issue
Block a user