setMapCursor with custom cursor not working in IE and Edge

4161
2
08-28-2015 12:18 PM
MarkRubelmann
New Contributor III

I'm developing a custom widget for Web AppBuilder 1.2 and I'm using the setMapCursor() function to display a custom mouse cursor.  It works perfectly in Chrome and Firefox, but unfortunately it's not doing anything in IE 9, IE 11, or Edge.  The code looks like this:

    var COMPASS_CURSOR = 'url(widgets/test/css/images/compass_cursor.png), auto';
    var DEFAULT_CURSOR = 'auto';

    return declare([BaseWidget, WidgetsInTemplateMixin], {

      // Lots of stuff here...

      updateMapCursor: function () {
        if (this.isSelectLocationToolEnabled()) {
          this.map.setMapCursor(COMPASS_CURSOR);
        } else {
          this.map.setMapCursor(DEFAULT_CURSOR);
        }
      }

If I change COMPASS_CURSOR to one of the standard cursors ("wait", for instance), it changes to the correct cursor.  It just doesn't seem to like custom cursors.

I've also tried using this.map.setCursor(), which I'm guessing does the same exact thing as setMapCursor() because it also works on Chrome and Firefox but not IE and Edge.  Am I doing something wrong?  Is this just not supported on IE and Edge?

Thanks,

Mark

0 Kudos
2 Replies
JoelBennett
MVP Regular Contributor

It's been awhile since you posted this, and you may have already figured it out.  For posterity, though, I believe the problem here is that IE only supports custom cursors in .cur and .ani format (not .png).

See also: cursor property (Internet Explorer)

MarkRubelmann
New Contributor III

Thanks Joel!  I ended up just using one of the system cursors instead of a custom one, but I'll try changing the format like you suggested if I get a chance one of these days.

0 Kudos