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,13 +63,10 @@ func (r *terrainRenderer) Handle(ctx ui.Context, event ui.Event) bool {
}
}
case *ui.MouseButtonUpEvent:
pos := e.Pos()
if pos.In(r.interactBounds) {
if _, ok := r.drag.IsDragging(); ok {
r.game.Terrain.Center = r.isometric.TileInt(r.isometric.Center())
r.drag.Cancel()
}
}
case *ui.MouseMoveEvent:
pos := e.Pos()
if pos.In(r.interactBounds) {