feat: show stack indexes during selection and move mode
This commit is contained in:
@@ -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(`<div class="${classes.join(' ')}"><div class="label">${names[3 - line]}</div><div>${value !== undefined && value !== '' ? calc.formatNumber(value) : ''}</div></div>`);
|
||||
|
||||
lines.push(`<div class="${classes.join(' ')}"><div class="label">${label}</div><div>${value !== undefined && value !== '' ? calc.formatNumber(value) : ''}</div></div>`);
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user