From 3ec9f35fd647dc9705aefe0ad4cac0f8e61d9c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselme=20FRAN=C3=87OIS?= Date: Sat, 4 Jun 2016 20:20:04 +0200 Subject: [PATCH] fixed missing toreillerLoop in debug picking --- src/pixelpipeline.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pixelpipeline.cpp b/src/pixelpipeline.cpp index 04590ce..8d0a9f7 100644 --- a/src/pixelpipeline.cpp +++ b/src/pixelpipeline.cpp @@ -189,8 +189,13 @@ Coord PixelPipeline::setCursorPosPicking(int mouseX, int mouseY) pos /= glm::vec2(m_width, m_height); // part that depends on resolution pos = (pos - glm::vec2(0.5f))*m_mapHeight/m_camera.z; // part that depends on camera zoom pos += glm::vec2(m_camera.x + 0.5f, -m_camera.y + 0.5f)*m_mapHeight; // part that depends on camera offset - debugCursorPos = pos; - return Coord(pos.x, pos.y); + if(pos.x < 0) + --pos.x; + if(pos.y < 0) + --pos.y; + Coord coordPos = m_map->toreillerLoop(Coord(pos.x, pos.y)); + setCursorPos(coordPos); + return coordPos; } void PixelPipeline::setCursorPos(const Coord &pos)