Skip to content

Commit

Permalink
impl: is_clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
gnlow committed Dec 29, 2023
1 parent de24928 commit 283e256
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export class Entry {

timer = new Timer()

isClicked = false

constructor(project: Project) {
this.gainNode.connect(this.audioContext.destination)

Expand Down Expand Up @@ -179,9 +181,11 @@ export class Entry {
parent.appendChild(this.renderer.canvas)

parent.addEventListener("pointerdown", () => {
this.isClicked = true
this.emit("pointerdown")
})
parent.addEventListener("pointerup", () => {
this.isClicked = false
this.emit("pointerup")
})

Expand Down Expand Up @@ -655,6 +659,9 @@ export class Entry {
False
```
*/
is_clicked() {
return this.isClicked
}
is_press_some_key(keyCode: string) {
return !!this.pressedKeys[Number(keyCode)]
}
Expand Down

0 comments on commit 283e256

Please sign in to comment.