Reputation: 13
How can I change the cursor while waiting for some action to end ? With the code below, the cursor does not change. I think I need to refresh, but I don't know how to trigger that.
map.on('singleclick', function(evt) {
myfunc(evt); });
myfunc(evt) {
map.getViewport().style.cursor = 'wait';
// do some lengthy processing
map.getViewport().style.cursor = 'pointer';
}
Upvotes: 1
Views: 294
Reputation: 14150
map.on('singleclick', myfunc);
var myfunc = function(evt) {
map.getTargetElement().style.cursor = 'wait';
// do some lengthy processing
map.getTargetElement().style.cursor = 'pointer';
}
Use getTargetElement()
. Also, no need to create an anonymous function.
Upvotes: 2