Question

I use the GWT image class with a ClickHandler to trigger actions when specific areas of the image are clicked. In order to specify these areas, I use the image's dimensions. The problem occurs when you change the size of your browser window. While the image rescales nicely, the getWidth() and getHeight() methods still return the image's original size, not the size after rescaling.

Do you know a way to retrieve the current size of the image?

Était-ce utile?

La solution

.getElement().getOffsetWidgth() ? and .getOffsetHeight().

I think thats what you need. That will return the current size of the element in the Dom, including any decorations like borders in the CSS.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top