@ -1836,6 +1836,12 @@ df::coord Gui::getMousePos()
{
df::coord pos;
if (gps && gps->mouse_x > -1) {
// return invalid coords if the cursor is not over the map
DwarfmodeDims dims = getDwarfmodeViewDims();
if (gps->mouse_x < dims.map_x1 || gps->mouse_x > dims.map_x2 ||
gps->mouse_y < dims.map_y1 || gps->mouse_y > dims.map_y2) {
return pos;
}
pos = getViewportPos();
pos.x += gps->mouse_x - 1;
pos.y += gps->mouse_y - 1;