Select to view content in your preferred language

Snap mouse cursor to nearest feature

2224
2
06-02-2014 09:25 AM
KeithWeber1
New Contributor III
Hello,

I am looking for some sample code that would demonstrate how to snap the mouse cursor to the nearest polyline feature in a feature layer that is triggered by something like the user pressing the 'Ctrl' key. Any help is greatly appreciated!
Tags (2)
0 Kudos
2 Replies
BradleySnider
New Contributor III
Keith, when are you trying to snap?  During an editing session?
0 Kudos
KeithWeber1
New Contributor III
Brad,

My application is just a viewer. The user cannot edit anything in the map. My application displays line features. It has a custom tooltip that is generated by the following code.

protected function myLayer_graphicAddHandler(event:GraphicEvent):void
{
 event.graphic.toolTip = event.graphic.attributes.myAttribute;
}


My application also has a an infoWindowRenderer that displays when the user clicks a line feature. I've had complaints from some users that it is sometimes difficult to position the mouse over a feature to either display the tooltip or to click and get the infoWindowRenderer to display. My solution was to try to snap the cursor to the nearest feature within some tolerance when the user presses 'Ctrl'. How could I accomplish this?
0 Kudos