How to hold down the ctrl key to select elements

299
2
01-10-2024 07:16 PM
weiliyao
New Contributor II

When I hold down the shift key and drag on the map, the following effect will occur. I want to have the same effect when holding down the ctrl key. Then I get a geometry or an extent. Is there a convenient way to achieve this?

2024-01-11_105513.jpg

0 Kudos
2 Replies
JoelBennett
MVP Regular Contributor

This is possible, but whether or not it would be considered convenient could go either way.  There's two parts to this:1 is drawing the geometry, and 2 is capturing whether the Ctrl key is down or not when it's drawn.  For the geometry, I would recommend using the SketchViewModel module.  To capture whether the Ctrl key is down or not, you would use the pointer-down and pointer-up events of the MapView.  The argument passed to those event handlers will have a property called "native" that provides information about the click.  That "native" object has a Boolean property named "ctrlKey"  So, when using the SketchView model to draw a rectangle for example, you would capture the state of the ctrlKey property at the beginning and end of the sketch, and respond in your application accordingly if it was true in both cases.

0 Kudos
weiliyao
New Contributor II

thank you for your replay

0 Kudos