本文整理汇总了Java中com.vaadin.client.WidgetUtil.getTouchOrMouseClientX方法的典型用法代码示例。如果您正苦于以下问题:Java WidgetUtil.getTouchOrMouseClientX方法的具体用法?Java WidgetUtil.getTouchOrMouseClientX怎么用?Java WidgetUtil.getTouchOrMouseClientX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.client.WidgetUtil
的用法示例。
在下文中一共展示了WidgetUtil.getTouchOrMouseClientX方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
protected void init() {
super.init();
getWidget().tabContextMenuHandler = new CubaTabSheetWidget.TabContextMenuHandler() {
@Override
public void onContextMenu(int tabIndex, ContextMenuEvent event) {
lastContextMenuX = WidgetUtil.getTouchOrMouseClientX(event.getNativeEvent());
lastContextMenuY = WidgetUtil.getTouchOrMouseClientY(event.getNativeEvent());
if (getState().hasActionsHandlers) {
rpc.onTabContextMenu(tabIndex);
event.stopPropagation();
event.preventDefault();
}
}
};
}
示例2: init
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
protected void init() {
super.init();
getWidget().contextMenuHandler = new CubaWindowWidget.ContextMenuHandler() {
@Override
public void onContextMenu(Event event) {
lastContextMenuX = WidgetUtil.getTouchOrMouseClientX(event);
lastContextMenuY = WidgetUtil.getTouchOrMouseClientY(event);
if (getState().hasContextActionHandlers) {
rpc.onWindowContextMenu();
event.stopPropagation();
event.preventDefault();
}
}
};
getWidget().clickOnModalityCurtain = () -> rpc.performCloseAction();
}
示例3: setSize
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
private void setSize(Event event) {
if (!cursorInsideBrowserContentArea(event)) {
// Only drag while cursor is inside the browser client area
return;
}
int w = WidgetUtil.getTouchOrMouseClientX(event) - startX + origW;
int h = WidgetUtil.getTouchOrMouseClientY(event) - startY + origH;
w = Math.max(w, getMinWidth());
h = Math.max(h, getMinHeight());
setWidth(w + "px");
setHeight(h + "px");
}
示例4: moveWindow
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
private void moveWindow(Event event) {
if (dragging) {
if (cursorInsideBrowserContentArea(event)) {
// Only drag while cursor is inside the browser client area
final int x = WidgetUtil.getTouchOrMouseClientX(event) - startX
+ origX;
final int y = WidgetUtil.getTouchOrMouseClientY(event) - startY
+ origY;
setPopupPosition(x, y);
}
event.preventDefault();
}
}
示例5: beginMovingWindow
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
private void beginMovingWindow(Event event) {
if (draggable) {
showDraggingCurtain();
dragging = true;
startX = WidgetUtil.getTouchOrMouseClientX(event);
startY = WidgetUtil.getTouchOrMouseClientY(event);
origX = getElement().getAbsoluteLeft();
origY = getElement().getAbsoluteTop();
DOM.setCapture(getElement());
event.preventDefault();
}
}
示例6: onResizeEvent
import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
private void onResizeEvent(Event event) {
if (resizable && WidgetUtil.isTouchEventOrLeftMouseButton(event)) {
switch (event.getTypeInt()) {
case Event.ONMOUSEDOWN:
case Event.ONTOUCHSTART:
showResizingCurtain();
if (BrowserInfo.get().isIE()) {
resizeBox.getStyle().setVisibility(Style.Visibility.HIDDEN);
}
resizing = true;
startX = WidgetUtil.getTouchOrMouseClientX(event);
startY = WidgetUtil.getTouchOrMouseClientY(event);
origW = getElement().getOffsetWidth();
origH = getElement().getOffsetHeight();
DOM.setCapture(getElement());
event.preventDefault();
break;
case Event.ONMOUSEUP:
case Event.ONTOUCHEND:
setSize(event);
case Event.ONTOUCHCANCEL:
DOM.releaseCapture(getElement());
case Event.ONLOSECAPTURE:
hideResizingCurtain();
if (BrowserInfo.get().isIE()) {
resizeBox.getStyle().clearVisibility();
}
resizing = false;
break;
case Event.ONMOUSEMOVE:
case Event.ONTOUCHMOVE:
if (resizing) {
setSize(event);
event.preventDefault();
}
break;
default:
event.preventDefault();
break;
}
}
}