List of usage examples for com.google.gwt.user.client Element getScrollTop
@Override public int getScrollTop()
From source file:org.thechiselgroup.biomixer.client.dnd.resources.DragEnabler.java
License:Apache License
public void createTransparentDragProxy(final int absoluteLeft, final int absoluteTop) { createDragWidget(absoluteLeft, absoluteTop); // TODO remove code duplication AbsolutePanel desktopWidget = desktop.asWidget(); int left = absoluteLeft - desktopWidget.getAbsoluteLeft() - 5; int top = absoluteTop - desktopWidget.getAbsoluteTop() - 5; Element element = hiddenAvatar.getElement(); CSS.setLocation(element, left, top); CSS.setSize(element, 10, 10); CSS.setZIndex(element, ZIndex.POPUP - 1); hiddenAvatar.addMouseUpHandler(new MouseUpHandler() { @Override//from ww w. ja v a 2 s. c o m public void onMouseUp(MouseUpEvent event) { removeAvatar(); } }); // fake mouse down event on widget MouseDownEvent mouseEvent = new MouseDownEvent() { @Override public int getClientX() { return absoluteLeft; } @Override public int getClientY() { return absoluteTop; } @Override public int getNativeButton() { return NativeEvent.BUTTON_LEFT; } @Override public int getRelativeX(com.google.gwt.dom.client.Element target) { return getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft(); } @Override public int getRelativeY(com.google.gwt.dom.client.Element target) { return getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop(); } @Override public Object getSource() { return hiddenAvatar; } @Override public boolean isControlKeyDown() { return false; } @Override public boolean isMetaKeyDown() { return false; } }; mouseEvent.setRelativeElement(element); hiddenAvatar.fireEvent(mouseEvent); }
From source file:org.thechiselgroup.biomixer.client.dnd.resources.DragEnabler.java
License:Apache License
public void forwardMouseMove(final int clientX, final int clientY) { if (hiddenAvatar == null) { return;//from w w w. ja v a 2 s .com } MouseMoveEvent mouseEvent = new MouseMoveEvent() { @Override public int getClientX() { return clientX; } @Override public int getClientY() { return clientY; } @Override public int getRelativeX(com.google.gwt.dom.client.Element target) { return getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft(); } @Override public int getRelativeY(com.google.gwt.dom.client.Element target) { return getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop(); } @Override public Object getSource() { return hiddenAvatar; } }; mouseEvent.setRelativeElement(hiddenAvatar.getElement()); hiddenAvatar.fireEvent(mouseEvent); }