diff --git a/samples/dev/index.js b/samples/dev/index.js index ce86fa2..36e40bc 100644 --- a/samples/dev/index.js +++ b/samples/dev/index.js @@ -143,23 +143,28 @@ function moveStackItem(direction) { function render() { const names = ['T', 'Z', 'Y', 'X']; const lines = []; + const showStackIndexes = hasStackSelection() || isMovingStackItem; + for (let line = 3; line >= 0; line -= 1) { const value = getLineValue(line); const isSelected = stackCursor === line; const classes = ['stack-line']; + const label = showStackIndexes ? String(line) : names[3 - line]; + if (isSelected) { classes.push(isMovingStackItem ? 'moving' : 'selected'); } - lines.push(`
${names[3 - line]}
${value !== undefined && value !== '' ? calc.formatNumber(value) : ''}
`); + + lines.push(`
${label}
${value !== undefined && value !== '' ? calc.formatNumber(value) : ''}
`); } stackEl.innerHTML = lines.join(''); if (calc.isEditing) { displayEl.textContent = `ENTERING: ${calc.inputValue}`; } else if (isMovingStackItem && hasStackSelection()) { - displayEl.textContent = `MOVING: ${['X', 'Y', 'Z', 'T'][stackCursor] || '?'}`; + displayEl.textContent = `MOVING: ${stackCursor}`; } else if (hasStackSelection()) { - displayEl.textContent = `SELECTED: ${['X', 'Y', 'Z', 'T'][stackCursor] || '?'}`; + displayEl.textContent = `SELECTED: ${stackCursor}`; } else { displayEl.textContent = 'READY'; }