Skip to content

Commit eee6b36

Browse files
committed
fixup touch inputs for bootloader flag keys
1 parent 2a2b4ff commit eee6b36

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

Keypad.Flasher.Client/src/components/LayoutPreview.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ export function LayoutPreview({ layout, layoutRows, buttonBindings, encoderBindi
139139
) => {
140140
e.preventDefault();
141141
e.stopPropagation();
142-
handleActionClick(tileKey, () => toggleFn(target, !currentValue), e);
142+
// Bootloader flags are always visible; toggle immediately even on touch to avoid double-tap arming.
143+
if (touchDeviceRef.current) setTouchArmedKey(tileKey);
144+
toggleFn(target, !currentValue);
143145
};
144146

145147
return (
@@ -216,7 +218,7 @@ export function LayoutPreview({ layout, layoutRows, buttonBindings, encoderBindi
216218
<div className="encoder-binding-list">
217219
<div
218220
className="encoder-binding-tile"
219-
onClick={(e) => handleTileTouchArm(`tile-enc-${enc.id}`, e)}
221+
onClick={(e) => handleTileTouchArm(tileKey, e)}
220222
>
221223
<div className="encoder-binding-main">
222224
<div className="encoder-binding-top"><span className="muted small">Counter-clockwise</span></div>
@@ -227,15 +229,15 @@ export function LayoutPreview({ layout, layoutRows, buttonBindings, encoderBindi
227229
<div className="encoder-binding-actions hover-actions">
228230
<button
229231
className="btn button-action"
230-
onClick={(e) => handleActionClick(`tile-enc-${enc.id}`, () => onEdit({ type: "encoder", encoderId: enc.id, direction: "ccw" }), e)}
232+
onClick={(e) => handleActionClick(tileKey, () => onEdit({ type: "encoder", encoderId: enc.id, direction: "ccw" }), e)}
231233
>
232234
Bindings
233235
</button>
234236
</div>
235237
</div>
236238
<div
237239
className="encoder-binding-tile"
238-
onClick={(e) => handleTileTouchArm(`tile-enc-${enc.id}`, e)}
240+
onClick={(e) => handleTileTouchArm(tileKey, e)}
239241
>
240242
<div className="encoder-binding-main">
241243
<div className="encoder-binding-top"><span className="muted small">Clockwise</span></div>
@@ -246,7 +248,7 @@ export function LayoutPreview({ layout, layoutRows, buttonBindings, encoderBindi
246248
<div className="encoder-binding-actions hover-actions">
247249
<button
248250
className="btn button-action"
249-
onClick={(e) => handleActionClick(`tile-enc-${enc.id}`, () => onEdit({ type: "encoder", encoderId: enc.id, direction: "cw" }), e)}
251+
onClick={(e) => handleActionClick(tileKey, () => onEdit({ type: "encoder", encoderId: enc.id, direction: "cw" }), e)}
250252
>
251253
Bindings
252254
</button>
@@ -255,7 +257,7 @@ export function LayoutPreview({ layout, layoutRows, buttonBindings, encoderBindi
255257
{enc.press && (
256258
<div
257259
className="encoder-binding-tile"
258-
onClick={(e) => handleTileTouchArm(`tile-enc-${enc.id}`, e)}
260+
onClick={(e) => handleTileTouchArm(tileKey, e)}
259261
>
260262
<div className="encoder-binding-main">
261263
<div className="encoder-binding-top">
@@ -286,7 +288,7 @@ export function LayoutPreview({ layout, layoutRows, buttonBindings, encoderBindi
286288
<div className="encoder-binding-actions hover-actions">
287289
<button
288290
className="btn button-action"
289-
onClick={(e) => handleActionClick(`tile-enc-${enc.id}`, () => onEdit({ type: "encoder", encoderId: enc.id, direction: "press" }), e)}
291+
onClick={(e) => handleActionClick(tileKey, () => onEdit({ type: "encoder", encoderId: enc.id, direction: "press" }), e)}
290292
>
291293
Bindings
292294
</button>

0 commit comments

Comments
 (0)