Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for _, x := range []struct{
- event string
- mouseEvent SOMETYPE
- }{
- {"mousedown", PRESS},
- {"mouseup", RELEASE},
- } {
- canvas.Call("addEventListener", x.event, func(ev js.Object) {
- rect := canvas.Call("getBoundingClientRect")
- x := float32((ev.Get("clientX").Int() - rect.Get("left").Int()))
- y := float32((ev.Get("clientY").Int() - rect.Get("top").Int()))
- responder.Mouse(x, y, x.mouseEvent)
- }, false)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement