How to make graphic not moving when drag the map?

740
2
Jump to solution
08-05-2021 11:51 PM
howard
by
New Contributor II

Hi,

I have a question, I use SketchViewModel to draw the shape on map, I want to keep the shape located in center (not moving) when the map is moving by pan or drag; how can I implement it?  

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
CourtneyMenikheim
Occasional Contributor

Get the extent of the map.
Pick a corner of the map and store it in a variable (startingPoint).

Listen for the map to move. When it does, get the new extent.
Check the change from startingPoint to the new extent. (Ex. +3 degrees lat, -2 long)

Get the geometry of the shape you drew.
Loop through each point on the shape and adjust the coordinates by the same amount the startingPoint shifted.

Courtney Menikheim | Application Developer | @thecmenikheim

View solution in original post

2 Replies
CourtneyMenikheim
Occasional Contributor

Get the extent of the map.
Pick a corner of the map and store it in a variable (startingPoint).

Listen for the map to move. When it does, get the new extent.
Check the change from startingPoint to the new extent. (Ex. +3 degrees lat, -2 long)

Get the geometry of the shape you drew.
Loop through each point on the shape and adjust the coordinates by the same amount the startingPoint shifted.

Courtney Menikheim | Application Developer | @thecmenikheim
howard
by
New Contributor II

Thanks! Good solution.