com.google.gwt.dom.client.Touch.getPageX()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中com.google.gwt.dom.client.Touch.getPageX()方法的一些代码示例,展示了Touch.getPageX()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Touch.getPageX()方法的具体详情如下:
包路径:com.google.gwt.dom.client.Touch
类名称:Touch
方法名:getPageX

Touch.getPageX介绍

[英]Gets the touch x-position within the browser document.
[中]获取浏览器文档中的触摸x位置。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

startTouchPosition = new Point(touch.getPageX(), touch.getPageY());
double startTouchTime = Duration.currentTimeMillis();
recentTouchPosition.setTemporalPoint(startTouchPosition, startTouchTime);

代码示例来源:origin: com.googlecode.mgwt/mgwt

@Override
public void onTouchMove(TouchMoveEvent event) {
  Touch touch = event.getTouches().get(0);
  if (Math.abs(touch.getPageX() - start_x) > distance || Math.abs(touch.getPageY() - start_y) > distance) {
    hasMoved = true;
  }
}

代码示例来源:origin: dankurka/mgwt

@Override
public void onTouchMove(TouchMoveEvent event) {
  Touch touch = event.getTouches().get(0);
  if (Math.abs(touch.getPageX() - start_x) > distance || Math.abs(touch.getPageY() - start_y) > distance) {
    hasMoved = true;
  }
}

代码示例来源:origin: errai/errai

public TouchPoint(Touch touch) {
 this.id = touch.getIdentifier();
 this.x = touch.getPageX();
 this.y = touch.getPageY();
}

代码示例来源:origin: org.jboss.errai/errai-cordova

public TouchPoint(Touch touch) {
 this.id = touch.getIdentifier();
 this.x = touch.getPageX();
 this.y = touch.getPageY();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

Point touchPoint = new Point(touch.getPageX(), touch.getPageY());
double touchTime = Duration.currentTimeMillis();
lastTouchPosition.setTemporalPoint(touchPoint, touchTime);

代码示例来源:origin: org.jboss.errai/errai-cordova

@Override
public void onTouchStart(TouchStartEvent event) {
 touchCount++;
 switch (state) {
  case READY:
   touchStart1 = event.getTouches().get(0);
   state = State.ONE_FINGER;
   break;
  case ONE_FINGER:
   Touch touchStart2 = event.getTouches().get(1);
   distance = (int) Math.sqrt(Math.pow(touchStart1.getPageX() - touchStart2.getPageX(), 2) + Math.pow(touchStart1.getPageY() - touchStart1.getPageY(), 2));
   state = State.TWO_FINGER;
   break;
  default:
   state = State.INVALID;
   break;
 }
}

代码示例来源:origin: dankurka/mgwt

public static TouchCopy copy(Touch touch) {
 return new TouchCopy(touch.getPageX(), touch.getPageY(), touch.getIdentifier());
}

代码示例来源:origin: com.googlecode.mgwt/mgwt

public static TouchCopy copy(Touch touch) {
 return new TouchCopy(touch.getPageX(), touch.getPageY(), touch.getIdentifier());
}

代码示例来源:origin: com.googlecode.mgwt/mgwt

@Override
public void onTouchMove(TouchMoveEvent event) {
 if (!isEnabled())
  return;
 if (ignore)
  return;
 Touch touch = event.getTouches().get(0);
 last_x = touch.getPageX();
 last_y = touch.getPageY();
}

代码示例来源:origin: dankurka/mgwt

@Override
public void onTouchMove(TouchMoveEvent event) {
 if (!isEnabled())
  return;
 if (ignore)
  return;
 Touch touch = event.getTouches().get(0);
 last_x = touch.getPageX();
 last_y = touch.getPageY();
}

代码示例来源:origin: errai/errai

@Override
public void onTouchStart(TouchStartEvent event) {
 touchCount++;
 switch (state) {
  case INVALID:
   break;
  case READY:
   state = State.FINDER_DOWN;
   x = event.getTouches().get(0).getPageX();
   y = event.getTouches().get(0).getPageY();
   break;
  case FINDER_DOWN:
  default:
   state = State.INVALID;
   break;
 }
}

代码示例来源:origin: dankurka/mgwt

@Override
public void onTouchStart(TouchStartEvent event) {
 touchCount++;
 switch (state) {
  case INVALID:
   break;
  case READY:
   state = State.FINDER_DOWN;
   x = event.getTouches().get(0).getPageX();
   y = event.getTouches().get(0).getPageY();
   break;
  case FINDER_DOWN:
  default:
   state = State.INVALID;
   break;
 }
}

代码示例来源:origin: com.googlecode.mgwt/mgwt

@Override
public void onTouchStart(TouchStartEvent event) {
 touchCount++;
 switch (state) {
  case INVALID:
   break;
  case READY:
   state = State.FINDER_DOWN;
   x = event.getTouches().get(0).getPageX();
   y = event.getTouches().get(0).getPageY();
   break;
  case FINDER_DOWN:
  default:
   state = State.INVALID;
   break;
 }
}

代码示例来源:origin: org.jboss.errai/errai-cordova

@Override
public void onTouchStart(TouchStartEvent event) {
 touchCount++;
 switch (state) {
  case INVALID:
   break;
  case READY:
   state = State.FINDER_DOWN;
   x = event.getTouches().get(0).getPageX();
   y = event.getTouches().get(0).getPageY();
   break;
  case FINDER_DOWN:
  default:
   state = State.INVALID;
   break;
 }
}

代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl

public void onTouchMove(TouchMoveEvent event) {
  if (isEnabled()) {
    Touch touch = event.getTouches().get(0).cast();
    handleMouseMove(touch.getPageX(), touch.getPageY());
    if (dragging) {
      event.preventDefault();
    }
  }
}

代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl

public void onTouchStart(TouchStartEvent event) {
  if (isEnabled()) {
    Touch touch = event.getTouches().get(0).cast();
    handleMouseDown(touch.getPageX(), touch.getPageY());
    event.stopPropagation();
  }
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

/**
 * The mouse position relative to the left edge of the document.
 *
 */
public final int pageX() {
 if (getTouches() != null && getTouches().length() > 0) {
  return getTouches().get(0).getPageX();
 } else {
  return getClientX() + GQuery.document.getScrollLeft();
 }
}

代码示例来源:origin: dankurka/mgwt

@Override
public void onTouchStart(TouchStartEvent event) {
  touchCanceled = false;
  hasMoved = false;
  if(event.getNativeEvent() != null){
    targetElement = event.getNativeEvent().getEventTarget().<Element>cast();
  }else {
    targetElement = null;
  }
  start_x = event.getTouches().get(0).getPageX();
  start_y = event.getTouches().get(0).getPageY();
}

代码示例来源:origin: com.googlecode.mgwt/mgwt

@Override
public void onTouchStart(TouchStartEvent event) {
  touchCanceled = false;
  hasMoved = false;
  if(event.getNativeEvent() != null){
    targetElement = event.getNativeEvent().getEventTarget().<Element>cast();
  }else {
    targetElement = null;
  }
  start_x = event.getTouches().get(0).getPageX();
  start_y = event.getTouches().get(0).getPageY();
}

相关文章