public override bool onInterceptTouchEvent(MotionEvent @event) { XStandOutWindow.StandOutLayoutParams @params = (XStandOutWindow.StandOutLayoutParams)getLayoutParams(); // focus window if (@event.getAction() == MotionEvent.ACTION_DOWN) { if (mContext.getFocusedWindow() != this) { mContext.focus(id); } } // multitouch // script: error JSC1000: Java : Opcode not implemented: brfalse.s at PopupWebView.Library.XWindow.onInterceptTouchEvent var flag1 = @event.getPointerCount() >= 2; var flag2 = (@event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN; var flag = flag1 && XUtils.isSet(flags, XStandOutFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE) && flag2; if (flag) { touchInfo.scale = 1; touchInfo.dist = -1; touchInfo.firstWidth = @params.width; touchInfo.firstHeight = @params.height; return(true); } return(false); }
public override bool onTouchEvent(MotionEvent @event) { // assembly: Y:\staging\clr\PopupWebView.AndroidActivity.dll // type: PopupWebView.Library.XWindow, PopupWebView.AndroidActivity, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null //offset: // 0x0083 // method: Boolean onInterceptTouchEvent(android.view.MotionEvent) } // script: error JSC1000: Java : unable to emit and at 'PopupWebView.Library.XWindow.onInterceptTouchEvent'#0085: multiple stack entries instead of one // handle touching outside if (@event.getAction() == MotionEvent.ACTION_OUTSIDE) { // unfocus window if (mContext.getFocusedWindow() == this) { mContext.unfocus(this); } // notify implementation that ACTION_OUTSIDE occurred mContext.onTouchBody(id, this, this, @event); } // handle multitouch if (@event.getPointerCount() >= 2 && XUtils.isSet(flags, XStandOutFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE)) { // 2 fingers or more float x0 = @event.getX(0); float y0 = @event.getY(0); float x1 = @event.getX(1); float y1 = @event.getY(1); double dist = System.Math .Sqrt(System.Math.Pow(x0 - x1, 2) + System.Math.Pow(y0 - y1, 2)); if ((@event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_MOVE) { if (touchInfo.dist == -1) { touchInfo.dist = dist; } touchInfo.scale *= dist / touchInfo.dist; touchInfo.dist = dist; // scale the window with anchor point set to middle edit().setAnchorPoint(.5f, .5f) .setSize( (int)(touchInfo.firstWidth * touchInfo.scale), (int)(touchInfo.firstHeight * touchInfo.scale)) .commit(); } mContext.onResize(id, this, this, @event); } return(true); }
public override bool onTouchEvent(MotionEvent e) { if (e != null) { float x = e.getX(); float y = e.getY(); var MotionEvent_ACTION_MOVE = 7; if (e.getAction() == MotionEvent_ACTION_MOVE) { float deltaX = (x - mPreviousX) / mDensity / 2f; float deltaY = (y - mPreviousY) / mDensity / 2f; if (ontouchmove != null) { ontouchmove(deltaX, deltaY); } //mRenderer.mDeltaX += deltaX; //mRenderer.mDeltaY += deltaY; } mPreviousX = x; mPreviousY = y; return(true); } return(base.onTouchEvent(e)); }
public override bool onTouchEvent(MotionEvent e) { if (e != null) { if (e.getAction() == MotionEvent.ACTION_DOWN) { // Ensure we call switchMode() on the OpenGL thread. // queueEvent() is a method of GLSurfaceView that will do this for us. // X:\jsc.svn\core\ScriptCoreLib.Ultra\ScriptCoreLib.Ultra\Android\Extensions\GLSurfaceViewExtensions.cs this.queueEvent( () => { if (ontouchdown != null) { ontouchdown(); } } ); return(true); } } return(base.onTouchEvent(e)); }
public virtual bool onTouchHandleResize(int id, XWindow window, View view, MotionEvent @event) { StandOutLayoutParams @params = (StandOutLayoutParams)window .getLayoutParams(); if (@event.getAction() == MotionEvent.ACTION_DOWN) { window.touchInfo.lastX = (int)@event.getRawX(); window.touchInfo.lastY = (int)@event.getRawY(); window.touchInfo.firstX = window.touchInfo.lastX; window.touchInfo.firstY = window.touchInfo.lastY; } else if (@event.getAction() == MotionEvent.ACTION_MOVE) { int deltaX = (int)@event.getRawX() - window.touchInfo.lastX; int deltaY = (int)@event.getRawY() - window.touchInfo.lastY; // update the size of the window @params.width += deltaX; @params.height += deltaY; // keep window between min/max width/height if (@params.width >= @params.minWidth && @params.width <= @params.maxWidth) { window.touchInfo.lastX = (int)@event.getRawX(); } if (@params.height >= @params.minHeight && @params.height <= @params.maxHeight) { window.touchInfo.lastY = (int)@event.getRawY(); } window.edit().setSize(@params.width, @params.height).commit(); } onResize(id, window, view, @event); return(true); }
public override bool onTouchEvent(MotionEvent e) { // cannot override onTouchEvent(MotionEvent) in Activity var x = base.onTouchEvent(e); if (e.getAction() == MotionEvent.ACTION_OUTSIDE) { if (AtTouchOutside != null) { AtTouchOutside(); } } return(x); }
public override bool onTouchEvent(MotionEvent @event) { switch (@event.getAction()) { case MotionEvent.ACTION_DOWN: break; case MotionEvent.ACTION_MOVE: break; case MotionEvent.ACTION_UP: // update mode every other time we change paint colors if (mPaint.getColor() == unchecked ((int)0xFFFFFFFF)) { mModeIndex = (mModeIndex + 1) % mModes.Length; updateTitle(); } swapPaintColors(); invalidate(); break; } return(true); }
public virtual bool onTouchHandleMove(int id, XWindow window, View view, MotionEvent @event) { var @params = (StandOutLayoutParams)window.getLayoutParams(); // how much you have to move in either direction in order for the // gesture to be a move and not tap int totalDeltaX = window.touchInfo.lastX - window.touchInfo.firstX; int totalDeltaY = window.touchInfo.lastY - window.touchInfo.firstY; if (@event.getAction() == MotionEvent.ACTION_DOWN) { window.touchInfo.lastX = (int)@event.getRawX(); window.touchInfo.lastY = (int)@event.getRawY(); window.touchInfo.firstX = window.touchInfo.lastX; window.touchInfo.firstY = window.touchInfo.lastY; } else if (@event.getAction() == MotionEvent.ACTION_MOVE) { int deltaX = (int)@event.getRawX() - window.touchInfo.lastX; int deltaY = (int)@event.getRawY() - window.touchInfo.lastY; window.touchInfo.lastX = (int)@event.getRawX(); window.touchInfo.lastY = (int)@event.getRawY(); if (window.touchInfo.moving || System.Math.Abs(totalDeltaX) >= @params.threshold || System.Math.Abs(totalDeltaY) >= @params.threshold) { window.touchInfo.moving = true; // if window is moveable if (XUtils.isSet(window.flags, XStandOutFlags.FLAG_BODY_MOVE_ENABLE)) { // update the position of the window if (@event.getPointerCount() == 1) { @params.x += deltaX; @params.y += deltaY; } window.edit().setPosition(@params.x, @params.y).commit(); } } } else if (@event.getAction() == MotionEvent.ACTION_UP) { window.touchInfo.moving = false; if (@event.getPointerCount() == 1) { // bring to front on tap var tap = System.Math.Abs(totalDeltaX) < @params.threshold && System.Math.Abs(totalDeltaY) < @params.threshold; if (tap && XUtils.isSet( window.flags, XStandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TAP)) { this.bringToFront(id); } } // bring to front on touch else if (XUtils.isSet(window.flags, XStandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TOUCH)) { this.bringToFront(id); } } onMove(id, window, view, @event); return(true); }
public override bool onTouchEvent(MotionEvent e) { if (e != null) { float x = e.getX(); float y = e.getY(); var MotionEvent_ACTION_MOVE = 7; if (e.getAction() == MotionEvent_ACTION_MOVE) { float deltaX = (x - mPreviousX) / mDensity / 2f; float deltaY = (y - mPreviousY) / mDensity / 2f; if (ontouchmove != null) ontouchmove(deltaX, deltaY); //mRenderer.mDeltaX += deltaX; //mRenderer.mDeltaY += deltaY; } mPreviousX = x; mPreviousY = y; return true; } return base.onTouchEvent(e); }
public override bool onTouchEvent(MotionEvent e) { // cannot override onTouchEvent(MotionEvent) in Activity var x = base.onTouchEvent(e); if (e.getAction() == MotionEvent.ACTION_OUTSIDE) if (AtTouchOutside != null) AtTouchOutside(); return x; }