Can't plant flower when the control key is still down.

This commit is contained in:
Sander Schobers 2020-05-11 15:32:41 +02:00
parent 905aad2afa
commit 1008b7b34b

View File

@ -42,12 +42,13 @@ func (r *terrainRenderer) Handle(ctx *Context, event sdl.Event) bool {
case *sdl.MouseButtonEvent:
if r.project.windowInteractRect.IsPointInside(e.X, e.Y) {
if e.Type == sdl.MOUSEBUTTONDOWN {
if e.Button == sdl.BUTTON_MIDDLE || (e.Button == sdl.BUTTON_LEFT && isControlKeyDown()) {
controlKeyDown := isControlKeyDown()
if e.Button == sdl.BUTTON_MIDDLE || (e.Button == sdl.BUTTON_LEFT && controlKeyDown) {
if !r.drag.IsDragging() {
r.drag.Start(Pt(e.X, e.Y))
}
}
if e.Button == sdl.BUTTON_LEFT {
if e.Button == sdl.BUTTON_LEFT && !controlKeyDown {
pos := r.project.screenToMapInt(e.X, e.Y)
r.game.UserClickedTile(pos)
}