fix Window.MousePosition (new coordinate system)
This commit is contained in:
parent
146797bad5
commit
17d1731d66
|
@ -30,11 +30,10 @@ func (w *Window) MousePosition() pixel.Vec {
|
||||||
width, height = float64(wi), float64(hi)
|
width, height = float64(wi), float64(hi)
|
||||||
})
|
})
|
||||||
|
|
||||||
// transform to OpenGL coordinates
|
return pixel.V(
|
||||||
x = (x - width/2) / (width / 2)
|
x/width*w.bounds.W()+w.bounds.X(),
|
||||||
y = (height/2 - y) / (height / 2)
|
(height-y)/height*w.bounds.H()+w.bounds.Y(),
|
||||||
|
)
|
||||||
return pixel.V(x, y)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MouseScroll returns the scroll amount (in both axis) since the last call to Window.Update.
|
// MouseScroll returns the scroll amount (in both axis) since the last call to Window.Update.
|
||||||
|
|
Loading…
Reference in New Issue