Skip to content

Commit 5f9b681

Browse files
authored
feat(pushbutton): ctrl+press = hold
1 parent 6d0cb25 commit 5f9b681

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pushbutton-element.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ export class PushbuttonElement extends LitElement {
3838

3939
render() {
4040
const { color } = this;
41+
const buttonFill = this.pressed ? 'url(#grad-down)' : 'url(#grad-up)';
42+
4143
return html`
4244
<button
4345
aria-label="${color} pushbutton"
4446
@mousedown=${this.down}
45-
@mouseup=${this.up}
47+
@mouseup=${(e: MouseEvent) => !e.ctrlKey && this.up()}
4648
@touchstart=${this.down}
4749
@touchend=${this.up}
4850
@keydown=${(e: KeyboardEvent) => SPACE_KEYS.includes(e.key) && this.down()}
49-
@keyup=${(e: KeyboardEvent) => SPACE_KEYS.includes(e.key) && this.up()}
51+
@keyup=${(e: KeyboardEvent) => SPACE_KEYS.includes(e.key) && !e.ctrlKey && this.up()}
5052
>
5153
<svg
5254
width="18mm"
@@ -92,7 +94,7 @@ export class PushbuttonElement extends LitElement {
9294
/>
9395
</g>
9496
<g class="clickable-element">
95-
<circle class="button-circle" cx="6" cy="6" r="3.822" fill="url(#grad-up)" />
97+
<circle class="button-circle" cx="6" cy="6" r="3.822" fill="${buttonFill}" />
9698
<circle
9799
cx="6"
98100
cy="6"

0 commit comments

Comments
 (0)