adding a map "tool"

427
1
08-18-2019 06:04 PM
JohnCartwright3
New Contributor II

Hello,

can anyone point me to an example of adding a tool to the map?  For instance, I'd like to create a coordinates widget the reports out the position of the cursor.

Ideally I'd incorporate it into the map widget alongside the Zoom, Home button, Locate button, etc. toggles but it could be a standalone widget that is dragged onto the map panel.  In either case, it'll need to receive mouse move events from the map.

Thanks!

--john

0 Kudos
1 Reply
JunshanLiu
Occasional Contributor III

In the beta release, you need to add a map widget, which creates a map view data source. In your own coordinate widget, you can add the map view data source into the "useDataSource" array. (In beta, the ability to select map view data source is hidden, so you need to edit the config). From the map view data source, you can get the map view object.

In next release, we'll try to figure out a better way to use the map view object.

For the map tool, we don't have a plan to make the map tool (in map widget) be extensible.