Fixed incorrect panning.

This commit is contained in:
Sander Schobers 2020-05-23 11:02:30 +02:00
parent b7b663ddb5
commit 822d8ab584

View File

@ -77,7 +77,7 @@ func (r *terrainRenderer) Handle(ctx ui.Context, event ui.Event) bool {
}
if _, ok := r.drag.IsDragging(); ok {
delta, _ := r.drag.Move(pos)
r.isometric.Pan(r.isometric.ViewToTileRelative(delta.Invert()))
r.isometric.Pan(delta.Invert())
}
if r.hover != nil {
if e.MouseWheel < 0 {
@ -97,13 +97,13 @@ func (r *terrainRenderer) Handle(ctx ui.Context, event ui.Event) bool {
case ui.KeyPadMinus:
r.isometric.ZoomOut(r.isometric.Center())
case ui.KeyW:
r.isometric.Pan(geom.PtF32(-1, -1))
r.isometric.PanTile(geom.PtF32(-1, -1))
case ui.KeyA:
r.isometric.Pan(geom.PtF32(-1, 1))
r.isometric.PanTile(geom.PtF32(-1, 1))
case ui.KeyS:
r.isometric.Pan(geom.PtF32(1, 1))
r.isometric.PanTile(geom.PtF32(1, 1))
case ui.KeyD:
r.isometric.Pan(geom.PtF32(1, -1))
r.isometric.PanTile(geom.PtF32(1, -1))
}
}
return false