When I click om my Map View, it takes time to appear my custom popup. How can I show "Wait cursor" like default popups during this time?
In js api 4.11 (4.12) you can use undocumented "Spinner widget ".
It does the job when you use default popup widget, but it could be shown by your code too:
require([ // "esri/widgets/Spinner", //... ], function( //... Spinner, ) { //... const spinner = new Spinner({ view: view }); view.ui.add(spinner); //... view.on("click", runIdentify); //... function runIdentify(event) { spinner.show({ location : event.mapPoint }); } //... spinner.hide(); }<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
The cursor is set from CSS. So setting the view container's style.cursor attribute to "wait" will do this. ie:
<SPAN class="keyword token">var</SPAN> el<SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// the element containing your map (3.X) or view (4.X)</SPAN> el<SPAN class="punctuation token">.</SPAN>style<SPAN class="punctuation token">.</SPAN>cursor <SPAN class="operator token">=</SPAN> <SPAN class="string token">"wait"</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>
In the 4.X API, you should be able to get a reference to the surface element using view.surface. From here, you can set the "data-cursor" attribute to change the cursor:
view<SPAN class="punctuation token">.</SPAN>surface<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setAttribute</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"data-cursor"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"wait"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// set to wait</SPAN> view<SPAN class="punctuation token">.</SPAN>surface<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setAttribute</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"data-cursor"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"default"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// back to default</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.