android.view.MotionEvent.getPointerCoords()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(185)

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

MotionEvent.getPointerCoords介绍

暂无

代码示例

代码示例来源:origin: TonicArtos/StickyGridHeaders

private static MotionEvent.PointerCoords[] getPointerCoords(MotionEvent e) {
  int n = e.getPointerCount();
  MotionEvent.PointerCoords[] r = new MotionEvent.PointerCoords[n];
  for (int i = 0; i < n; i++) {
    r[i] = new MotionEvent.PointerCoords();
    e.getPointerCoords(i, r[i]);
  }
  return r;
}

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

public PointerCoordsEqualitySubject pointerCoords(int pointerIndex) {
 PointerCoords outPointerCoords = new PointerCoords();
 actual().getPointerCoords(pointerIndex, outPointerCoords);
 return check("getPointerCoords(%s)", pointerIndex)
   .about(PointerCoordsEqualitySubject.pointerCoords())
   .that(outPointerCoords);
}

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

event.getPointerCoords(i, c);

代码示例来源:origin: stackoverflow.com

@Override
public boolean onTouch(View v, MotionEvent e) {
  if (v != this) return false;
  for(int i = 0; i < 8; i++)
    touchMap.clear(i);
  if (e.getActionMasked() ==  MotionEvent.ACTION_UP) {
    return true;
  }
  for(int i = 0; i < e.getPointerCount(); i++) {
    e.getPointerCoords(i, coords);
    int pointer = e.getPointerId(i);
    scene.sizes.pixelToCm(vec, coords.x, coords.y);
    touchMap.set(pointer, vec.getX(), vec.getY());

  }
  return true;
}

代码示例来源:origin: GcsSloop/ViewSupport

private static PointerCoords[] getPointerCoords(MotionEvent e) {
  int n = e.getPointerCount();
  PointerCoords[] r = new PointerCoords[n];
  for (int i = 0; i < n; i++) {
    r[i] = new PointerCoords();
    e.getPointerCoords(i, r[i]);
  }
  return r;
}

代码示例来源:origin: canqihe/TmallSale

private static MotionEvent.PointerCoords[] getPointerCoords(MotionEvent e) {
  int n = e.getPointerCount();
  MotionEvent.PointerCoords[] r = new MotionEvent.PointerCoords[n];
  for (int i = 0; i < n; i++) {
    r[i] = new MotionEvent.PointerCoords();
    e.getPointerCoords(i, r[i]);
  }
  return r;
}

代码示例来源:origin: stackoverflow.com

View.OnTouchListener onTouchListener = new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {
    int nbPoints = event.getPointerCount();

    // Coord of the first point
    MotionEvent.PointerCoords outPointerCoords = new MotionEvent.PointerCoords();
    event.getPointerCoords (1, outPointerCoords);
  }
};

代码示例来源:origin: stackoverflow.com

switch (event.getAction()) {
  case MotionEvent.ACTION_DOWN: {
    event.getPointerCoords(0, mDownPos);
    return true;
    event.getPointerCoords(0, mUpPos);
    float dx = mDownPos.x - mUpPos.x;

代码示例来源:origin: stackoverflow.com

if (!isKeyDown(i)) {
  int poolIndex = mToneToIndexMap.get(mFingerTones[i]);
  event.getPointerCoords(index, mPointerCoords);
  float volume = mPointerCoords.getAxisValue(MotionEvent.AXIS_PRESSURE);
  volume = volume > 1f ? 1f : volume;

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

@Override
public boolean onDown(MotionEvent motionEvent) {
  MotionEvent.PointerCoords coords =
      new MotionEvent.PointerCoords();
  motionEvent.getPointerCoords(0, coords);
  // Handle these only if there is an event listener
  if(mOverlayEventListener!=null) {
    if(coords.x >= (1-SAFETY_HORIZONTAL)*sizeWidth &&
        coords.x<sizeWidth &&
        coords.y >= (1-SAFETY_VERTICAL)*sizeHeight &&
        coords.y<sizeHeight) {
      return mOverlayEventListener.onCalibrate(
          motionEvent);
    }
  }
  // Didn't match? Try passing a raw event - just in case
  if(mCustomTouchMethods!=null)
    return mCustomTouchMethods.onDown(motionEvent);
  // Nothing worked - let it bubble up
  return false;
}

代码示例来源:origin: gqjjqg/android-extend

coor[i] = new MotionEvent.PointerCoords();
ev.getPointerProperties(i, preo[i]);
ev.getPointerCoords(i, coor[i]);
PointF newPoint = rotatePoint(new PointF(coor[i].x, coor[i].y),
    new PointF(view_w / 2F, view_h / 2F), -cur_degree);

代码示例来源:origin: stackoverflow.com

pointerCoords[i] = new PointerCoords();
event.getPointerCoords(i, pointerCoords[i]);

相关文章