public override bool onGenericMotionEvent(android.view.MotionEvent @event) { if ((@event.getSource() & android.view.InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (@event.getAction()) { case android.view.MotionEvent.ACTION_SCROLL: { if (!mIsBeingDragged) { float hscroll; if ((@event.getMetaState() & android.view.KeyEvent.META_SHIFT_ON) != 0) { hscroll = [email protected](android.view.MotionEvent.AXIS_VSCROLL); } else { hscroll = @event.getAxisValue(android.view.MotionEvent.AXIS_HSCROLL); } if (hscroll != 0) { int delta = (int)(hscroll * getHorizontalScrollFactor()); int range = getScrollRange(); int oldScrollX = mScrollX; int newScrollX = oldScrollX + delta; if (newScrollX < 0) { newScrollX = 0; } else { if (newScrollX > range) { newScrollX = range; } } if (newScrollX != oldScrollX) { base.scrollTo(newScrollX, mScrollY); return true; } } } break; } } } return base.onGenericMotionEvent(@event); }
public override bool onGenericMotionEvent(android.view.MotionEvent @event) { if ((@event.getSource() & android.view.InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (@event.getAction()) { case android.view.MotionEvent.ACTION_SCROLL: { if (!mIsBeingDragged) { float vscroll = @event.getAxisValue(android.view.MotionEvent.AXIS_VSCROLL); if (vscroll != 0) { int delta = (int)(vscroll * getVerticalScrollFactor()); int range = getScrollRange(); int oldScrollY = mScrollY; int newScrollY = oldScrollY - delta; if (newScrollY < 0) { newScrollY = 0; } else { if (newScrollY > range) { newScrollY = range; } } if (newScrollY != oldScrollY) { base.scrollTo(mScrollX, newScrollY); return true; } } } break; } } } return base.onGenericMotionEvent(@event); }
public override bool onGenericMotionEvent(android.view.MotionEvent @event) { if ((@event.getSource() & android.view.InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (@event.getAction()) { case android.view.MotionEvent.ACTION_SCROLL: { float vscroll = @event.getAxisValue(android.view.MotionEvent.AXIS_VSCROLL); if (vscroll < 0) { pacedScroll(false); return true; } else { if (vscroll > 0) { pacedScroll(true); return true; } } break; } } } return base.onGenericMotionEvent(@event); }
public virtual bool onGenericMotionEvent(android.widget.TextView widget, android.text.Spannable text, android.view.MotionEvent @event) { if ((@event.getSource() & android.view.InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (@event.getAction()) { case android.view.MotionEvent.ACTION_SCROLL: { float vscroll; float hscroll; if ((@event.getMetaState() & android.view.KeyEvent.META_SHIFT_ON) != 0) { vscroll = 0; hscroll = @event.getAxisValue(android.view.MotionEvent.AXIS_VSCROLL); } else { vscroll = [email protected](android.view.MotionEvent.AXIS_VSCROLL); hscroll = @event.getAxisValue(android.view.MotionEvent.AXIS_HSCROLL); } bool handled = false; if (hscroll < 0) { handled |= scrollLeft(widget, text, (int)System.Math.Ceiling(-hscroll)); } else { if (hscroll > 0) { handled |= scrollRight(widget, text, (int)System.Math.Ceiling(hscroll)); } } if (vscroll < 0) { handled |= scrollUp(widget, text, (int)System.Math.Ceiling(-vscroll)); } else { if (vscroll > 0) { handled |= scrollDown(widget, text, (int)System.Math.Ceiling(vscroll)); } } return handled; } } } return false; }