Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.42 KB | None | 0 0
  1. for _, x := range []struct{
  2.   event string
  3.   mouseEvent SOMETYPE
  4. }{
  5.   {"mousedown", PRESS},
  6.   {"mouseup", RELEASE},
  7. } {
  8.   canvas.Call("addEventListener", x.event, func(ev js.Object) {
  9.   rect := canvas.Call("getBoundingClientRect")
  10.   x := float32((ev.Get("clientX").Int() - rect.Get("left").Int()))
  11.   y := float32((ev.Get("clientY").Int() - rect.Get("top").Int()))
  12.   responder.Mouse(x, y, x.mouseEvent)
  13.   }, false)
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement