/** * Automatically tries to create a proxy image from given element. * * @param element * @param alignImageToEvent if true, proxy image is aligned to start event, else next to mouse * cursor * @deprecated As of 7.2, call or override {@link #createDragImage(Element,boolean)} instead */ @Deprecated public void createDragImage( com.google.gwt.user.client.Element element, boolean alignImageToEvent) { Element cloneNode = (Element) element.cloneNode(true); // Set size explicitly for cloned node to avoid stretching #14617. cloneNode.getStyle().setWidth(element.getOffsetWidth(), Unit.PX); cloneNode.getStyle().setHeight(element.getOffsetHeight(), Unit.PX); syncContent(element, cloneNode); if (BrowserInfo.get().isIE()) { if (cloneNode.getTagName().toLowerCase().equals("tr")) { TableElement table = Document.get().createTableElement(); TableSectionElement tbody = Document.get().createTBodyElement(); table.appendChild(tbody); tbody.appendChild(cloneNode); cloneNode = table.cast(); } } if (alignImageToEvent) { int absoluteTop = element.getAbsoluteTop(); int absoluteLeft = element.getAbsoluteLeft(); int clientX = WidgetUtil.getTouchOrMouseClientX(startEvent); int clientY = WidgetUtil.getTouchOrMouseClientY(startEvent); int offsetX = absoluteLeft - clientX; int offsetY = absoluteTop - clientY; setDragImage(cloneNode, offsetX, offsetY); } else { setDragImage(cloneNode); } }
/** * TODO consider extracting touches support to an impl class specific for webkit (only browser * that really supports touches). * * @param event * @return */ protected int getEventPosition(Event event) { if (isVertical()) { return WidgetUtil.getTouchOrMouseClientY(event); } else { return WidgetUtil.getTouchOrMouseClientX(event); } }