Looking through the SmartClient source, I finally found a way to do an image map on Img, I simply set the activeAreaHTML attribute. This works just fine except the usemap attribute has an unnecessary apostrophe at the end of the name of the image map causing browsers not to see it. So I just extended Img and in the constructor added:
Of course, in my extension I added custom classes for different polygons with click handlers and what not, but hopefully the above can help anyone needing image maps. And hopefully the bug in Canvas.js's imgHTML static function will get fixed too.
Code:
addDrawHandler(new DrawHandler() { @Override public void onDraw(DrawEvent event) { Element img = getDOM().getElementsByTagName("img").getItem(0); if (img != null) { String usemap = img.getAttribute("usemap"); if (usemap != null && usemap.endsWith("'")) { img.setAttribute("usemap", usemap.substring(0, usemap.length() - 1)); } } } });
Comment