本文整理匯總了Java中com.google.gwt.user.client.Element.getScrollLeft方法的典型用法代碼示例。如果您正苦於以下問題:Java Element.getScrollLeft方法的具體用法?Java Element.getScrollLeft怎麽用?Java Element.getScrollLeft使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.Element
的用法示例。
在下文中一共展示了Element.getScrollLeft方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onBrowserEvent
import com.google.gwt.user.client.Element; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (DOM.eventGetType(event) == Event.ONSCROLL) {
Element element = getElement();
int scrollTop = element.getScrollTop();
int scrollLeft = element.getScrollLeft();
if (this.scrollTop != scrollTop || this.scrollLeft != scrollLeft) {
if (onScrollHandler != null) {
onScrollHandler.accept(scrollTop, scrollLeft);
}
this.scrollTop = scrollTop;
this.scrollLeft = scrollLeft;
}
}
}
示例2: restoreScrollPositions
import com.google.gwt.user.client.Element; //導入方法依賴的package包/類
private void restoreScrollPositions() {
Element body = getElement();
int scrollX = body.getScrollLeft();
int scrollY = body.getScrollTop();
int viewWidth = DOM.getElementPropertyInt(body, "clientWidth");
int viewHeight = DOM.getElementPropertyInt(body, "clientHeight");
if (currentViewHeight == viewHeight && currentViewWidth == viewWidth) {
if (currentScrollX != scrollX) {
setHorizontalScrollPosition(currentScrollX);
}
if (currentScrollY != scrollY) {
setScrollPosition(currentScrollY);
}
}
}
示例3: saveScrollPosition
import com.google.gwt.user.client.Element; //導入方法依賴的package包/類
private void saveScrollPosition() {
Element body = getElement();
int scrollX = body.getScrollLeft();
int scrollY = body.getScrollTop();
int viewWidth = DOM.getElementPropertyInt(body, "clientWidth");
int viewHeight = DOM.getElementPropertyInt(body, "clientHeight");
if (currentViewHeight != viewHeight) {
currentViewHeight = viewHeight;
}
if (currentViewWidth != viewWidth) {
currentViewWidth = viewWidth;
}
if (currentScrollX != scrollX) {
currentScrollX = scrollX;
}
if (currentScrollY != scrollY) {
currentScrollY = scrollY;
}
if (lockrelated != null && mpwList.size() > 0) {
lockrelated = mpwList.get(0).getGroup().getLockRelated();
}
}