From 1008b7b34bad0b9ace53d88a679d64ee643d2e47 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Mon, 11 May 2020 15:32:41 +0200 Subject: [PATCH] Can't plant flower when the control key is still down. --- terrainrenderer.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/terrainrenderer.go b/terrainrenderer.go index ea35496..cfd3837 100644 --- a/terrainrenderer.go +++ b/terrainrenderer.go @@ -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) }