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)