Skip to content

Commit 3c07808

Browse files
committed
Improve spinners on image list
1 parent d99ed1c commit 3c07808

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/imageList.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ namespace ImageList {
5050
{ type: 'colourpicker', name: 'clrTernary', onChange: c => onTernaryColourChange(c), x: 16, y: 56, width: 12, height: 12 },
5151
{ type: 'checkbox', x: 32, y: 56, width: 100, height: 14, text: 'Blend' },
5252
{ type: 'label', x: 16, y: 74, width: 50, height: 14, text: 'Palette:' },
53-
{ type: 'spinner', name: 'spnPalette', x: 68, y: 72, width: 100, height: 14, text: '0', onDecrement: () => onDecrementPalette(), onIncrement: () => onIncrementPalette() },
53+
{ type: 'spinner', name: 'spnPalette', x: 68, y: 72, width: 100, height: 14, text: '0', isHoldable: true, onDecrement: () => onDecrementPalette(), onIncrement: () => onIncrementPalette() },
5454
{ type: 'label', x: 16, y: 92, width: 50, height: 14, text: 'Start ID:' },
55-
{ type: 'spinner', name: 'spnStartId', x: 68, y: 90, width: 100, height: 14, text: startId.toString(), onDecrement: () => onDecrementId(), onIncrement: () => onIncrementId() },
56-
{ type: 'button', x: 178, y: 90, width: 50, height: 14, text: 'Select', onClick: () => onSelectId() },
55+
{ type: 'spinner', name: 'spnStartId', x: 68, y: 90, width: 100, height: 14, isHoldable: true, text: startId.toString(), onClick: () => onSelectId(), onDecrement: () => onDecrementId(), onIncrement: () => onIncrementId() },
5756
{ type: 'custom', name: 'imageList', x: 8, y: 122, width: 200, height: 100, onDraw: function (g) { onDrawImages(this, g); } }
5857
],
5958
onUpdate: () => onUpdate()
@@ -113,15 +112,13 @@ namespace ImageList {
113112
const startIdSpinner = window.findWidget<SpinnerWidget>('spnStartId');
114113
if (startIdSpinner && startId > 0) {
115114
startId = Math.max(0, startId - 32);
116-
startIdSpinner.text = startId.toString();
117115
}
118116
}
119117

120118
function onIncrementId() {
121119
const startIdSpinner = window.findWidget<SpinnerWidget>('spnStartId');
122120
if (startIdSpinner) {
123121
startId = nextId;
124-
startIdSpinner.text = startId.toString();
125122
}
126123
}
127124

@@ -132,6 +129,11 @@ namespace ImageList {
132129
imageList.height = window.height - imageList.y - 16;
133130
}
134131

132+
const startIdSpinner = window.findWidget<SpinnerWidget>('spnStartId');
133+
if (startIdSpinner) {
134+
startIdSpinner.text = startId.toString();
135+
}
136+
135137
primaryChecked = window.findWidget<CheckboxWidget>('chkPrimary').isChecked || false;
136138
const primaryColourWidget = window.findWidget<ColourPickerWidget>('clrPrimary');
137139
if (primaryColourWidget) {

0 commit comments

Comments
 (0)