Fixed minimap scrolling

This commit is contained in:
Sergii Pylypenko
2019-07-12 23:47:45 +03:00
committed by pelya
parent fe73e6d021
commit fea9bb1c24
3 changed files with 11 additions and 2 deletions

View File

@@ -1413,6 +1413,16 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
int sub;
pt = this->PixelToTile(pt.x - wid->pos_x, pt.y - wid->pos_y, &sub);
if (_settings_client.gui.scroll_mode == VSM_MAP_LMB) {
if (click_count > 0) {
this->lmb_scroll_pt.x = this->scroll_x + pt.x * TILE_SIZE;
this->lmb_scroll_pt.y = this->scroll_y + pt.y * TILE_SIZE;
} else {
this->SetNewScroll(this->lmb_scroll_pt.x - pt.x * TILE_SIZE, this->lmb_scroll_pt.y - pt.y * TILE_SIZE, 0);
this->SetDirty();
break;
}
}
ScrollWindowTo(this->scroll_x + pt.x * TILE_SIZE, this->scroll_y + pt.y * TILE_SIZE, -1, w);
this->SetDirty();