문제

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