Merge branch 'master' into jgrpp
# Conflicts: # cmake/SourceList.cmake # src/build_vehicle_gui.cpp # src/company_gui.cpp # src/console_cmds.cpp # src/depot_base.h # src/elrail.cpp # src/network/core/udp.cpp # src/network/network_admin.cpp # src/network/network_chat_gui.cpp # src/network/network_gui.cpp # src/network/network_server.cpp # src/newgrf.cpp # src/newgrf_engine.cpp # src/newgrf_railtype.cpp # src/newgrf_railtype.h # src/newgrf_storage.h # src/os/unix/crashlog_unix.cpp # src/rail.h # src/rail_cmd.cpp # src/rail_gui.cpp # src/road_cmd.cpp # src/road_map.h # src/saveload/labelmaps_sl.cpp # src/settings_gui.cpp # src/settings_type.h # src/sl/oldloader_sl.cpp # src/station_cmd.cpp # src/station_gui.cpp # src/table/settings/world_settings.ini # src/tests/test_script_admin.cpp # src/textfile_gui.cpp # src/toolbar_gui.cpp # src/train_cmd.cpp # src/tunnelbridge_cmd.cpp # src/vehicle_gui.cpp # src/widget.cpp # src/window.cpp # src/window_gui.h # src/window_type.h
This commit is contained in:
@@ -274,11 +274,14 @@ Point Layouter::GetCharPosition(std::string_view::const_iterator ch) const
|
||||
/**
|
||||
* Get the character that is at a pixel position in the first line of the layouted text.
|
||||
* @param x Position in the string.
|
||||
* @param line_index Which line of the layout to search
|
||||
* @return String offset of the position (bytes) or -1 if no character is at the position.
|
||||
*/
|
||||
ptrdiff_t Layouter::GetCharAtPosition(int x) const
|
||||
ptrdiff_t Layouter::GetCharAtPosition(int x, size_t line_index) const
|
||||
{
|
||||
const auto &line = this->front();
|
||||
if (line_index >= this->size()) return -1;
|
||||
|
||||
const auto &line = this->at(line_index);
|
||||
|
||||
for (int run_index = 0; run_index < line->CountRuns(); run_index++) {
|
||||
const ParagraphLayouter::VisualRun &run = line->GetVisualRun(run_index);
|
||||
|
Reference in New Issue
Block a user