diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-20 20:33:05 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-20 20:33:05 -0500 |
| commit | 767cdc1f6f6a63ce997fc9476911e2c361f9d402 (patch) | |
| tree | 49add55976f895441167c66cfa95e5c7688d18ce /MediaBrowser.UI/Controls/EnhancedScrollViewer.cs | |
| parent | 845554722efaed872948a9e0f7202e3ef52f1b6e (diff) | |
Pushing missing changes
Diffstat (limited to 'MediaBrowser.UI/Controls/EnhancedScrollViewer.cs')
| -rw-r--r-- | MediaBrowser.UI/Controls/EnhancedScrollViewer.cs | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/MediaBrowser.UI/Controls/EnhancedScrollViewer.cs b/MediaBrowser.UI/Controls/EnhancedScrollViewer.cs deleted file mode 100644 index 188715e1e..000000000 --- a/MediaBrowser.UI/Controls/EnhancedScrollViewer.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-
-namespace MediaBrowser.UI.Controls
-{
- /// <summary>
- /// Provides a ScrollViewer that can be scrolled by dragging the mouse
- /// </summary>
- public class EnhancedScrollViewer : ScrollViewer
- {
- private Point _scrollTarget;
- private Point _scrollStartPoint;
- private Point _scrollStartOffset;
- private const int PixelsToMoveToBeConsideredScroll = 5;
-
- protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
- {
- if (IsMouseOver)
- {
- // Save starting point, used later when determining how much to scroll.
- _scrollStartPoint = e.GetPosition(this);
- _scrollStartOffset.X = HorizontalOffset;
- _scrollStartOffset.Y = VerticalOffset;
-
- // Update the cursor if can scroll or not.
- Cursor = (ExtentWidth > ViewportWidth) ||
- (ExtentHeight > ViewportHeight) ?
- Cursors.ScrollAll : Cursors.Arrow;
-
- CaptureMouse();
- }
-
- base.OnPreviewMouseDown(e);
- }
-
- protected override void OnPreviewMouseMove(MouseEventArgs e)
- {
- if (IsMouseCaptured)
- {
- Point currentPoint = e.GetPosition(this);
-
- // Determine the new amount to scroll.
- var delta = new Point(_scrollStartPoint.X - currentPoint.X, _scrollStartPoint.Y - currentPoint.Y);
-
- if (Math.Abs(delta.X) < PixelsToMoveToBeConsideredScroll &&
- Math.Abs(delta.Y) < PixelsToMoveToBeConsideredScroll)
- return;
-
- _scrollTarget.X = _scrollStartOffset.X + delta.X;
- _scrollTarget.Y = _scrollStartOffset.Y + delta.Y;
-
- // Scroll to the new position.
- ScrollToHorizontalOffset(_scrollTarget.X);
- ScrollToVerticalOffset(_scrollTarget.Y);
- }
-
- base.OnPreviewMouseMove(e);
- }
-
- protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
- {
- if (IsMouseCaptured)
- {
- Cursor = Cursors.Arrow;
- ReleaseMouseCapture();
- }
-
- base.OnPreviewMouseUp(e);
- }
- }
-}
|
