Hello all! I have a project where one of the requirements is to toggle the My Location graphic on and off. To Toggle the icon on, I am using the native Locate functionality, which zooms to my location and shows the graphic. Toggling it off should mean simply removing the graphic, but I'm not sure how to do that. Oh, and in case it matters, I'm working in Vue 3.
Any ideas? Thanks!
Solved! Go to Solution.
Hi @kprenesti The locate graphic is stored in the view's graphics collection. I think you should be able to remove it like this
view.graphics.remove(locate.graphic);
if you Locate widget was named "locate".
Wrote a quick codepen here: https://codepen.io/sagewall/pen/rNowYoN
Hi @kprenesti The locate graphic is stored in the view's graphics collection. I think you should be able to remove it like this
view.graphics.remove(locate.graphic);
if you Locate widget was named "locate".
Wrote a quick codepen here: https://codepen.io/sagewall/pen/rNowYoN
Thank you! Also, you need to cancel the locate so it doesn't show up again. Thanks again!