Skip to content

Commit 22c44af

Browse files
sutaburosuurish
authored andcommitted
fix(nano): use global key list
1 parent a388503 commit 22c44af

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/arduino-nano-element.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { customElement, html, LitElement, property, svg, query } from 'lit-element';
22
import { analog, ElementPin, i2c, spi, usart } from './pin';
3-
4-
const triggerKeys = ['Spacebar', ' ', 'Enter'];
3+
import { SPACE_KEYS } from './utils/keys';
54

65
@customElement('wokwi-arduino-nano')
76
export class ArduinoNanoElement extends LitElement {
@@ -267,8 +266,8 @@ export class ArduinoNanoElement extends LitElement {
267266
@mouseup=${() => this.up()}
268267
@mouseleave=${() => this.leave()}
269268
@touchend=${() => this.leave()}
270-
@keydown=${(e: KeyboardEvent) => triggerKeys.includes(e.key) && this.down()}
271-
@keyup=${(e: KeyboardEvent) => triggerKeys.includes(e.key) && this.up()}
269+
@keydown=${(e: KeyboardEvent) => SPACE_KEYS.includes(e.key) && this.down()}
270+
@keyup=${(e: KeyboardEvent) => SPACE_KEYS.includes(e.key) && this.up()}
272271
/>
273272
</g>
274273
</svg>

0 commit comments

Comments
 (0)