fix offset bug

This commit is contained in:
Liam Galvin 2018-11-27 13:20:14 +00:00
parent 1538fb291d
commit 884497f049
1 changed files with 5 additions and 2 deletions

View File

@ -17,9 +17,12 @@ func (gui *GUI) glfwScrollCallback(w *glfw.Window, xoff float64, yoff float64) {
}
}
func (gui *GUI) mouseMoveCallback(w *glfw.Window, xpos float64, ypos float64) {
func (gui *GUI) mouseMoveCallback(w *glfw.Window, px float64, py float64) {
scale := gui.scale()
px = px / float64(scale)
py = py / float64(scale)
px, py := w.GetCursorPos()
x := uint16(math.Floor((px - float64(gui.renderer.areaX)) / float64(gui.renderer.CellWidth())))
y := uint16(math.Floor((py - float64(gui.renderer.areaY)) / float64(gui.renderer.CellHeight())))