Page 1 of 1

Detect clicked position in map view

Posted: Wed May 20, 2020 7:54 am
by Pi-C
In Autodrive, we have a "selection-tool" entity that is used to select either "car" entities in an area or to get the selected position (if the area is small enough, using the tool will be interpreted as "click on a position" instead of "area selected" ). This works in normal mode. In mapview, it works if the player has zoomed in:
Selecting a position works in zoomed-in mapview.
Selecting a position works in zoomed-in mapview.
select.png (3.93 MiB) Viewed 471 times
However, it doesn't work if the map is zoomed out to schematic view:
Selecting a position works not if mapview is zoomed out.
Selecting a position works not if mapview is zoomed out.
no_select.png (74.23 KiB) Viewed 471 times
There was a request to enable selecting a position on the zoomed out map. I've already thought about reacting to on_chart_tag_added -- but I'd still need a way to add a chart tag on click, so players can still use the item in their cursor instead of another input. I guess for that approach to work I'd need to detect when map view is toggled.

So, is there any way I can get a clicked position in map view?

Re: Detect clicked position in map view

Posted: Wed May 20, 2020 2:34 pm
by darkfrei
Pi-C wrote: Wed May 20, 2020 7:54 am I've already thought about reacting to on_chart_tag_added -- but I'd still need a way to add a chart tag on click, so players can still use the item in their cursor instead of another input. I guess for that approach to work I'd need to detect when map view is toggled.
How about to set the tag when the player on the map with item clicks?

If the player have "train" in the cursor and clicks on the map, then here comes the tag without text, may be only for some short time. You can catch it and delete after click.

But viewforum.php?f=28

Re: Detect clicked position in map view

Posted: Fri May 22, 2020 11:21 am
by Pi-C
darkfrei wrote: Wed May 20, 2020 2:34 pm
Pi-C wrote: Wed May 20, 2020 7:54 am I've already thought about reacting to on_chart_tag_added -- but I'd still need a way to add a chart tag on click, so players can still use the item in their cursor instead of another input. I guess for that approach to work I'd need to detect when map view is toggled.
How about to set the tag when the player on the map with item clicks?
The remote control from Autodrive is not of type "item", but "selection-tool". I'd need to exchange these when map view is toggled, but I can't find an event for it.

Do you mean I should make an interface request?