Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用带有 ClickHandler 的 GWT 图像类来在单击图像的特定区域时触发操作。为了指定这些区域,我使用图像的尺寸。当您更改浏览器窗口的大小时会出现此问题。虽然图像很好地重新缩放,但 getWidth() 和 getHeight() 方法仍然返回图像的原始大小,而不是重新缩放后的大小。
您知道检索图像当前大小的方法吗?
.getElement().getOffsetWidgth() ?和 .getOffsetHeight()。
我认为这就是你所需要的。这将返回 Dom 中元素的当前大小,包括 CSS 中的边框等任何装饰。