|
@@ -1078,13 +1078,13 @@ public:
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
case SM_WIDGET_LEGEND: {
|
|
|
uint columns = this->GetNumberColumnsLegend(r.right - r.left + 1);
|
|
|
uint number_of_rows = max(this->map_type == SMT_INDUSTRY ? CeilDiv(_smallmap_industry_count, columns) : 0, this->min_number_of_fixed_rows);
|
|
|
bool rtl = _dynlang.text_dir == TD_RTL;
|
|
|
bool rtl = _current_text_dir == TD_RTL;
|
|
|
uint y_org = r.top + WD_FRAMERECT_TOP;
|
|
|
uint x = rtl ? r.right - this->column_width - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT;
|
|
|
uint y = y_org;
|
|
|
uint i = 0; // Row counter for industry legend.
|
|
|
uint row_height = FONT_HEIGHT_SMALL;
|
|
|
|
|
@@ -1223,13 +1223,13 @@ public:
|
|
|
const NWidgetBase *wi = this->GetWidget<NWidgetBase>(SM_WIDGET_LEGEND); // Label panel
|
|
|
uint line = (pt.y - wi->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_SMALL;
|
|
|
uint columns = this->GetNumberColumnsLegend(wi->current_x);
|
|
|
uint number_of_rows = max(CeilDiv(_smallmap_industry_count, columns), this->min_number_of_fixed_rows);
|
|
|
if (line >= number_of_rows) break;
|
|
|
|
|
|
bool rtl = _dynlang.text_dir == TD_RTL;
|
|
|
bool rtl = _current_text_dir == TD_RTL;
|
|
|
int x = pt.x - wi->pos_x;
|
|
|
if (rtl) x = wi->current_x - x;
|
|
|
uint column = (x - WD_FRAMERECT_LEFT) / this->column_width;
|
|
|
|
|
|
/* Check if click is on industry label*/
|
|
|
int industry_pos = (column * number_of_rows) + line;
|