public override bool HandleMouseInput(MouseInput mi) { if (mi.Button != MouseButton.Left) return false; if (IsDisabled()) return false; if (mi.Event == MouseInputEvent.Down && !TakeMouseFocus(mi)) return false; if (!HasMouseFocus) return false; switch(mi.Event) { case MouseInputEvent.Up: isMoving = false; YieldMouseFocus(mi); break; case MouseInputEvent.Down: isMoving = true; /* TODO: handle snapping to ticks properly again */ /* TODO: handle nudge via clicking outside the thumb */ UpdateValue(ValueFromPx(mi.Location.X - RenderBounds.Left)); break; case MouseInputEvent.Move: if (isMoving) UpdateValue(ValueFromPx(mi.Location.X - RenderBounds.Left)); break; } return ThumbRect.Contains(mi.Location); }
protected override void OnGesture(Gesture gesture) { if (ThumbRect == ScreenBounds) { return; } switch (gesture.GestureType) { case GestureType.CapturedByOther: if (_touchId == gesture.TouchId) { _touchId = 0; } break; case GestureType.Down: if (ThumbRect.Contains(gesture.Origin.ToPoint())) { if (_touchId == 0) { _touchId = gesture.TouchId; gesture.SetHandled(); _scrollPositionOnDown = _vertical ? _element.ScrollingService.ScrollPositionY : _element.ScrollingService.ScrollPositionX; } } break; case GestureType.Move: if (_touchId == gesture.TouchId) { gesture.SetHandled(); UpdatePosition(gesture.Origin, gesture.Position); } break; case GestureType.Up: if (_touchId == gesture.TouchId) { _touchId = 0; } break; case GestureType.VerticalDrag: case GestureType.HorizontalDrag: if (_touchId == gesture.TouchId) { gesture.SetHandled(); gesture.CapturePointer(this); } break; } }
public override void OnTouchDown(GPoint point) { _isThumbSelected = ThumbRect.Contains(new PointF((float)point.X, (float)point.Y)); if (_isThumbSelected) { AnimateMaterialThumbSize(true); } UpdateValue(point); }
/// <summary> /// /// </summary> /// <param name="p"></param> /// <returns></returns> protected virtual ScrollBarArea HitTest(Point p) { if (TopLeftArrowRect.Contains(p)) return ScrollBarArea.TopLeftArrow; if (TopLeftInnerRect.Contains(p)) return ScrollBarArea.TopLeftInside; if (ThumbRect.Contains(p)) return ScrollBarArea.Thumb; if (BottomRightInnerRect.Contains(p)) return ScrollBarArea.BottomRightInside; if (BottomRightArrowRect.Contains(p)) return ScrollBarArea.BottomRightArrow; return ScrollBarArea.Outside; }
/// <summary> /// /// </summary> /// <param name="p"></param> /// <returns></returns> protected virtual ScrollBarArea HitTest(Point p) { if (TopLeftArrowRect.Contains(p)) { return(ScrollBarArea.TopLeftArrow); } if (TopLeftInnerRect.Contains(p)) { return(ScrollBarArea.TopLeftInside); } if (ThumbRect.Contains(p)) { return(ScrollBarArea.Thumb); } if (BottomRightInnerRect.Contains(p)) { return(ScrollBarArea.BottomRightInside); } if (BottomRightArrowRect.Contains(p)) { return(ScrollBarArea.BottomRightArrow); } return(ScrollBarArea.Outside); }