- //触屏模式
- SimulatedTouchpadInputHandler.onScroll {
- RemotePointer p = canvas.getPointer();
- final int action = e2.getActionMasked();
- final int meta = e2.getMetaState();
-
- // TODO: This is a workaround for Android 4.2
- //多手指检测
- boolean twoFingers = false;
- if (e1 != null)
- twoFingers = (e1.getPointerCount() > 1);
- if (e2 != null)
- twoFingers = twoFingers || (e2.getPointerCount() > 1);
-
- // onScroll called while scaling/swiping gesture is in effect. We ignore the event and pretend it was
- // consumed. This prevents the mouse pointer from flailing around while we are scaling.
- // Also, if one releases one finger slightly earlier than the other when scaling, it causes Android
- // to stick a spiteful onScroll with a MASSIVE delta here.
- // This would cause the mouse pointer to jump to another place suddenly.
- // Hence, we ignore onScroll after scaling until we lift all pointers up.
- // 多手指,滑动模式,缩放模式,缩放模式结束
- if (twoFingers||inSwiping||inScaling||scalingJustFinished)
- return true;
-
- activity.showZoomer(true);
-
- // If the gesture has just began, then don't allow a big delta to prevent
- // pointer jumps at the start of scrolling.
- if (!inScrolling) {
- inScrolling = true;
- distanceX = sign(distanceX);
- distanceY = sign(distanceY);
- } else {
- // Make distanceX/Y display density independent.
- distanceX = sensitivity * distanceX / displayDensity;
- distanceY = sensitivity * distanceY / displayDensity;
- }
-
- // Compute the absolute new mouse position on the remote site.
- int newRemoteX = (int) (p.getX() + getDelta(-distanceX));
- int newRemoteY = (int) (p.getY() + getDelta(-distanceY));
- p.processPointerEvent(newRemoteX, newRemoteY, action, meta, false, false, false, false, 0);
- canvas.panToMouse();
- return true;
- }
- //SimulatedTouchpadInputHandler.onScale(IBCScaleGestureDetector) line: 1
- //ScaleGestureDetector.onTouchEvent(MotionEvent) line: 258
- SimulatedTouchpadInputHandler(AbstractGestureInputHandler).onTouchEvent(MotionEvent)
- line: 460 {
- //多点触控手势
- scaleGestures.onTouchEvent(e);
- //单点手势
- return gestures.onTouchEvent(e);
- }
- //SimulatedTouchpadInputHandler.onTouchEvent(MotionEvent) line: 1
- RemoteCanvasActivity.onTouchEvent(MotionEvent) line: 1217 {
- try {
- //activity检测到TouchEvent
- return inputHandler.onTouchEvent(event);
- } catch (NullPointerException e) { }
- return false;
- }
相关热门文章
给主人留下些什么吧!~~
评论热议