質問

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?

役に立ちましたか?

解決

.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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top