Beispiel #1
0
        public override bool CanMove(IMotionInfo info, object context)
        {
            var element = Controller.Element;
            var value   = MouseWheel.GetValue(element);

            return(info.Direction <0 ? value> _minimum : value < _maximum);
        }
 public MouseWheelInputEventArgs(IMouseWheelController controller, MouseWheel wheel, MouseWheelEventArgs nativeEventArgs)
   : base(nativeEventArgs.MouseDevice, nativeEventArgs.Timestamp)
 {
   Controller = controller;
   Wheel = wheel;
   NativeEventArgs = nativeEventArgs;
 }
Beispiel #3
0
        protected override void OnLoading()
        {
            base.OnLoading();
            var element = Controller.Element;

            if (Orientation == Orientation.Vertical)
            {
                _scrollMode = MouseWheel.GetVScrollMode(element);
                _smoothing  = MouseWheel.GetVScrollSmoothing(element);
                _modifiers  = MouseWheel.GetVScrollModifiers(element);
                MouseWheel.VScrollModeProperty.AddValueChanged(element, OnVScrollModeChanged);
                MouseWheel.VScrollSmoothingProperty.AddValueChanged(element, OnVSmoothingChanged);
                MouseWheel.VScrollModifiersProperty.AddValueChanged(element, OnVModifiersChanged);

                MouseWheel.GetLogicalVScrollIncrement(element).SetOrientation(Orientation.Vertical);
                MouseWheel.GetPhysicalVScrollIncrement(element).SetOrientation(Orientation.Vertical);
            }
            else
            {
                _scrollMode = MouseWheel.GetHScrollMode(element);
                _smoothing  = MouseWheel.GetHScrollSmoothing(element);
                _modifiers  = MouseWheel.GetHScrollModifiers(element);
                MouseWheel.HScrollModeProperty.AddValueChanged(element, OnHScrollModeChanged);
                MouseWheel.HScrollSmoothingProperty.AddValueChanged(element, OnHSmoothingChanged);
                MouseWheel.HScrollModifiersProperty.AddValueChanged(element, OnHModifiersChanged);

                MouseWheel.GetLogicalHScrollIncrement(element).SetOrientation(Orientation.Horizontal);
                MouseWheel.GetPhysicalHScrollIncrement(element).SetOrientation(Orientation.Horizontal);
            }
        }
Beispiel #4
0
 public MouseWheelInputEventArgs(IMouseWheelController controller, MouseWheel wheel,
                                 MouseWheelEventArgs nativeEventArgs)
     : base(nativeEventArgs.MouseDevice, nativeEventArgs.Timestamp)
 {
     Controller      = controller;
     Wheel           = wheel;
     NativeEventArgs = nativeEventArgs;
 }
        protected override void OnLoading()
        {
            base.OnLoading();
            var element = Controller.Element;

            _modifiersKeys = MouseWheel.GetVScrollModifiers(element);
            MouseWheel.VScrollModifiersProperty.AddValueChanged(element, OnModifierKeysYChanged);
        }
Beispiel #6
0
        public MouseWheelAdaptationBehavior(IMouseWheelClient client)
            : base(client)
        {
            var element = Client.Controller.Element;

            NestedMotionEnabled = MouseWheel.GetNestedMotion(element);
            Debouncing          = MouseWheel.GetDebouncing(element);
            MouseWheel.NestedMotionProperty.AddValueChanged(element, OnNestedMotionChanged);
            MouseWheel.DebouncingProperty.AddValueChanged(element, OnDebouncingChanged);
        }
Beispiel #7
0
        public MouseWheelZoomBehavior(IMouseWheelClient client)
            : base(client)
        {
            var element = Client.Controller.Element;

            NestedMotionEnabled = MouseWheel.GetNestedZoom(element);
            Debouncing          = MouseWheel.GetZoomDebouncing(element);
            MouseWheel.NestedZoomProperty.AddValueChanged(element, OnNestedZoomChanged);
            MouseWheel.ZoomDebouncingProperty.AddValueChanged(element, OnDebouncingChanged);
        }
        public MouseWheelFlowDocumentPageViewerScrollBehavior(IMouseWheelClient client)
            : base(client, null)
        {
            var element = Client.Controller.Element;

            NestedMotionEnabled = MouseWheel.GetNestedVScroll(element);
            Debouncing          = MouseWheel.GetLogicalVScrollDebouncing(element);
            MouseWheel.NestedVScrollProperty.AddValueChanged(element, OnNestedVScrollChanged);
            MouseWheel.LogicalVScrollDebouncingProperty.AddValueChanged(element, OnDebouncingYChanged);
        }
Beispiel #9
0
 private IMouseWheelShaft GetMotionShaft(MouseWheel wheel)
 {
     Wheel = wheel;
     if (_shaft == null)
     {
         _shaft = GetMotionShaft(wheel, wheel.ActiveTransferCase);
     }
     wheel.ActiveTransferCase.ActiveShaft = _shaft;
     return(_shaft);
 }
Beispiel #10
0
        protected override void OnLoading()
        {
            base.OnLoading();
            var element = Controller.Element;

            _smoothing = MouseWheel.GetZoomSmoothing(element);
            _modifiers = MouseWheel.GetZoomModifiers(element);
            MouseWheel.ZoomSmoothingProperty.AddValueChanged(element, OnSmoothingChanged);
            MouseWheel.ZoomModifiersProperty.AddValueChanged(element, OnModifiersChanged);
        }
Beispiel #11
0
        protected IMouseWheelShaft GetMotionShaftAuto(MouseWheel wheel, IMouseWheelTransferCase transferCase,
                                                      int debouncingCellCount)
        {
            var resolution = wheel.Resolution;

            if (DoubleEx.AreClose(resolution, (int)resolution))
            {
                return(transferCase[debouncingCellCount]); // the most granular debouncing
            }
            return(transferCase[0]);                       // no debouncing if wheel resolution not integral
        }
        protected override IMouseWheelShaft GetMotionShaft(MouseWheel wheel, IMouseWheelTransferCase transferCase)
        {
            switch (Debouncing)
            {
            case MouseWheelDebouncing.Auto:   return(GetMotionShaftAuto(wheel, transferCase, ScrollIncrement));

            case MouseWheelDebouncing.None:   return(transferCase[0]);

            case MouseWheelDebouncing.Single: return(transferCase[1]);

            default: throw new NotImplementedException();
            }
        }
Beispiel #13
0
        protected override void OnLoading()
        {
            base.OnLoading();
            var element = Controller.Element;

            _smoothing = MouseWheel.GetSmoothing(element);
            _modifiers = MouseWheel.GetModifiers(element);
            _minimum   = MouseWheel.GetMinimum(element);
            _maximum   = MouseWheel.GetMaximum(element);
            MouseWheel.SmoothingProperty.AddValueChanged(element, OnSmoothingChanged);
            MouseWheel.ModifiersProperty.AddValueChanged(element, OnModifiersChanged);
            MouseWheel.MinimumProperty.AddValueChanged(element, OnMinimumChanged);
            MouseWheel.MaximumProperty.AddValueChanged(element, OnMaximumChanged);
        }
        public MouseWheelScrollBehavior(MouseWheelScrollClient scrollClient, IDisposable manipulator)
            : base(scrollClient, manipulator)
        {
            var element = Client.Controller.Element;

            if (scrollClient.Orientation == Orientation.Vertical)
            {
                NestedMotionEnabled = MouseWheel.GetNestedVScroll(element);
                MouseWheel.NestedVScrollProperty.AddValueChanged(element, OnNestedVScrollChanged);
            }
            else
            {
                NestedMotionEnabled = MouseWheel.GetNestedHScroll(element);
                MouseWheel.NestedHScrollProperty.AddValueChanged(element, OnNestedHScrollChanged);
            }
        }
Beispiel #15
0
        public override double Coerce(IMotionInfo info, object context, double delta)
        {
            var element   = Controller.Element;
            var value     = MouseWheel.GetValue(element);
            int direction = info.Direction;

            if (direction > 0)
            {
                var movableDelta = _maximum - value;
                return(Math.Min(movableDelta, delta));
            }
            else
            {
                var movableDelta = _minimum - value;
                return(Math.Max(movableDelta, delta));
            }
        }
Beispiel #16
0
        protected virtual IMouseWheelShaft GetMotionShaft(MouseWheel wheel, IMouseWheelTransferCase transferCase)
        {
            switch (Debouncing)
            {
            case MouseWheelDebouncing.Auto:
                return(GetMotionShaftAuto(wheel, transferCase, -1));

            case MouseWheelDebouncing.None:
                return(transferCase[0]);    // no debouncing

            case MouseWheelDebouncing.Single:
                return(transferCase[1]);    // one debouncing cell per click - same as a standard resolution notch

            default:
                throw new NotImplementedException();
            }
        }
        public MouseWheelPhysicalScrollBehavior(MouseWheelScrollClient scrollClient, IDisposable manipulator)
            : base(scrollClient, manipulator)
        {
            var element = Client.Controller.Element;

            if (scrollClient.Orientation == Orientation.Vertical)
            {
                Debouncing      = MouseWheel.GetPhysicalVScrollDebouncing(element);
                ScrollIncrement = MouseWheel.GetPhysicalVScrollIncrement(element);
                MouseWheel.PhysicalVScrollDebouncingProperty.AddValueChanged(element, OnDebouncingYChanged);
                MouseWheel.PhysicalVScrollIncrementProperty.AddValueChanged(element, OnVScrollIncrementChanged);
            }
            else
            {
                Debouncing      = MouseWheel.GetPhysicalHScrollDebouncing(element);
                ScrollIncrement = MouseWheel.GetPhysicalHScrollIncrement(element);
                MouseWheel.PhysicalHScrollDebouncingProperty.AddValueChanged(element, OnDebouncingXChanged);
                MouseWheel.PhysicalHScrollIncrementProperty.AddValueChanged(element, OnHScrollIncrementChanged);
            }
        }
 private void OnHScrollIncrementChanged(object sender, EventArgs e)
 {
     ScrollIncrement = MouseWheel.GetPhysicalHScrollIncrement(sender as DependencyObject);
 }
 private void    OnDebouncingXChanged(object sender, EventArgs e)
 {
     Debouncing = MouseWheel.GetPhysicalHScrollDebouncing(sender as DependencyObject);
 }
 protected IMouseWheelShaft GetMotionShaftAuto(MouseWheel wheel, IMouseWheelTransferCase transferCase, int debouncingCellCount)
 {
   var resolution = wheel.Resolution;
   if (DoubleEx.AreClose(resolution, (int)resolution))
     return transferCase[debouncingCellCount];  // the most granular debouncing
   else
     return transferCase[0];   // no debouncing if wheel resolution not integral
 }
 public MouseWheelMultiShaftTransferCase(MouseWheel wheel)
   {
   _wheel = wheel;
   InitializeDebouncingFunctions();
 }
Beispiel #22
0
 private void   OnMaximumChanged(object sender, EventArgs e)
 {
     _maximum = MouseWheel.GetMaximum(sender as DependencyObject);
 }
 private void OnEnhancedChanged(object sender, EventArgs e)
 {
     Enhanced = MouseWheel.GetEnhanced(sender as DependencyObject);
 }
 public MouseWheelMultiShaftTransferCase(MouseWheel wheel)
 {
     _wheel = wheel;
     InitializeDebouncingFunctions();
 }
Beispiel #25
0
 private void OnNestedMotionChanged(object sender, EventArgs e)
 {
     NestedMotionEnabled = MouseWheel.GetNestedMotion(sender as DependencyObject);
 }
Beispiel #26
0
 private void OnHScrollModeChanged(object sender, EventArgs e)
 {
     ScrollMode = MouseWheel.GetHScrollMode(sender as DependencyObject);
 }
 protected override IMouseWheelShaft GetMotionShaft(MouseWheel wheel, IMouseWheelTransferCase transferCase) { return transferCase[0]; }
 private IMouseWheelShaft GetMotionShaft(MouseWheel wheel)
 {
   Wheel = wheel;
   if (_shaft == null)
     _shaft = GetMotionShaft(wheel, wheel.ActiveTransferCase);
   wheel.ActiveTransferCase.ActiveShaft = _shaft;
   return _shaft;
 }
Beispiel #29
0
 protected override IMouseWheelShaft GetMotionShaft(MouseWheel wheel, IMouseWheelTransferCase transferCase)
 {
     return(transferCase[0]);
 }
 private void OnModifierKeysYChanged(object sender, EventArgs e)
 {
     _modifiersKeys = MouseWheel.GetVScrollModifiers(sender as DependencyObject);
 }
 protected virtual void OnLoading()
 {
     _enhanced = MouseWheel.GetEnhanced(Controller.Element);
     MouseWheel.EnhancedProperty.AddValueChanged(Controller.Element, OnEnhancedChanged);
 }
 protected virtual IMouseWheelShaft GetMotionShaft(MouseWheel wheel, IMouseWheelTransferCase transferCase)
 {
   switch (Debouncing)
   {
     case MouseWheelDebouncing.Auto:   return GetMotionShaftAuto(wheel, transferCase, -1);
     case MouseWheelDebouncing.None:   return transferCase[ 0];  // no debouncing
     case MouseWheelDebouncing.Single: return transferCase[ 1];  // one debouncing cell per click - same as a standard resolution notch
     default: throw new NotImplementedException();
   }
 }
Beispiel #33
0
 private void OnSmoothingChanged(object sender, EventArgs e)
 {
     Smoothing = MouseWheel.GetZoomSmoothing(sender as DependencyObject);
 }
Beispiel #34
0
        public override void Move(IMotionInfo info, object context, double delta)
        {
            var element = Controller.Element;

            MouseWheel.SetValue(element, MouseWheel.GetValue(element) + delta);
        }
Beispiel #35
0
 private void   OnDebouncingChanged(object sender, EventArgs e)
 {
     Debouncing = MouseWheel.GetDebouncing(sender as DependencyObject);
 }
Beispiel #36
0
 private void OnModifiersChanged(object sender, EventArgs e)
 {
     _modifiers = MouseWheel.GetZoomModifiers(sender as DependencyObject);
 }