Fixed bug where mouse was released outside terrain area when dragging it kept dragging.

This commit is contained in:
Sander Schobers 2020-05-23 10:43:05 +02:00
parent 66eaa054c5
commit b7b663ddb5

View File

@ -63,12 +63,9 @@ func (r *terrainRenderer) Handle(ctx ui.Context, event ui.Event) bool {
} }
} }
case *ui.MouseButtonUpEvent: case *ui.MouseButtonUpEvent:
pos := e.Pos() if _, ok := r.drag.IsDragging(); ok {
if pos.In(r.interactBounds) { r.game.Terrain.Center = r.isometric.TileInt(r.isometric.Center())
if _, ok := r.drag.IsDragging(); ok { r.drag.Cancel()
r.game.Terrain.Center = r.isometric.TileInt(r.isometric.Center())
r.drag.Cancel()
}
} }
case *ui.MouseMoveEvent: case *ui.MouseMoveEvent:
pos := e.Pos() pos := e.Pos()