Is it possible to show the PopupTemplate of the last feature hovered on via "pointer-move"?

226
2
Jump to solution
02-14-2024 06:38 AM
EmilyGoldsmith
New Contributor III

Hello.

I have been exploring the sample code provided and noticed the Feature widget in a side panel example has a nice functionality which displays a pop-up template of the feature the user's cursor is currently hovering on.

However, one thing i've noticed is that, once the pointer is removed from hovering over the feature layer, the popuptemplate is reset and no pop-up displays.

I'm very new to hittests and the 'promiseUtils' function, so I was wondering if it were possible to configure the app to show the popuptemplate of the last feature hovered on?

Thank you.

0 Kudos
1 Solution

Accepted Solutions
LaurenBoyd
Esri Contributor

Hi @EmilyGoldsmith -

The logic for the sample just needs to be slightly modified. Instead of setting the Feature widget graphic to null if the hitTest doesn't return a graphic, you can just return and not do anything which will keep the highlight and Feature widget populated with the last viewed feature.

Here's the Feature widget sample with that modification on lines 95-97: https://codepen.io/laurenb14/pen/eYXbMXg?editors=1000

Hope this helps!

Lauren

View solution in original post

2 Replies
LaurenBoyd
Esri Contributor

Hi @EmilyGoldsmith -

The logic for the sample just needs to be slightly modified. Instead of setting the Feature widget graphic to null if the hitTest doesn't return a graphic, you can just return and not do anything which will keep the highlight and Feature widget populated with the last viewed feature.

Here's the Feature widget sample with that modification on lines 95-97: https://codepen.io/laurenb14/pen/eYXbMXg?editors=1000

Hope this helps!

Lauren
EmilyGoldsmith
New Contributor III

This is perfect, thank you!

0 Kudos