mirror of https://github.com/liamg/aminal.git
fix offset bug
This commit is contained in:
parent
1538fb291d
commit
884497f049
|
@ -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())))
|
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())))
|
y := uint16(math.Floor((py - float64(gui.renderer.areaY)) / float64(gui.renderer.CellHeight())))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue