Skip to content

Commit

Permalink
impl: mouse_clicked, mouse_click_cancled
Browse files Browse the repository at this point in the history
  • Loading branch information
gnlow committed Dec 29, 2023
1 parent f9d9bda commit de24928
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion deps/enz.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/x/[email protected].16/mod.ts"
export * from "https://deno.land/x/[email protected].17/mod.ts"
13 changes: 13 additions & 0 deletions src/Entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ export class Entry {
resolution: 4
})
parent.appendChild(this.renderer.canvas)

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

const loop = () => {
this.render()
Expand Down Expand Up @@ -237,6 +244,12 @@ export class Entry {
}
})
}
mouse_clicked(f: () => Promise<void>) {
this.on("pointerdown", f)
}
mouse_click_cancled(f: () => Promise<void>) {
this.on("pointerup", f)
}
when_object_click(f: () => Promise<void>, obj: EntryContainer) {
obj.setEventMode("static")
obj.pixiSprite.on("pointerdown", f)
Expand Down

0 comments on commit de24928

Please sign in to comment.