コード例 #1
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);
            }
        }
コード例 #2
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);
        }
コード例 #3
0
 public MouseWheelInputEventArgs(IMouseWheelController controller, MouseWheel wheel, int timestamp, int delta, Orientation orientation)
     : base(wheel.MouseDevice, Math.Max(0, timestamp), delta)
 {
     Controller  = controller;
     Wheel       = wheel;
     Orientation = orientation;
 }
コード例 #4
0
        protected override void                     OnLoading()
        {
            base.OnLoading();
            var element = Controller.Element;

            _modifiersKeys = MouseWheel.GetVScrollModifiers(element);
            MouseWheel.VScrollModifiersProperty.AddValueChanged(element, OnModifierKeysYChanged);
        }
コード例 #5
0
        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);
        }
コード例 #6
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);
        }
コード例 #7
0
 private IMouseWheelShaft                GetMotionShaft(MouseWheel wheel)
 {
     Wheel = wheel;
     if (_shaft == null)
     {
         _shaft = GetMotionShaft(wheel, wheel.ActiveTransferCase);
     }
     wheel.ActiveTransferCase.ActiveShaft = _shaft;
     return(_shaft);
 }
コード例 #8
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);
        }
コード例 #9
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);
        }
コード例 #10
0
        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();
            }
        }
コード例 #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
            }
            else
            {
                return(transferCase[0]);   // no debouncing if wheel resolution not integral
            }
        }
コード例 #12
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);
        }
コード例 #13
0
        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);
            }
        }
コード例 #14
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();
            }
        }
コード例 #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));
            }
        }
コード例 #16
0
        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);
            }
        }
コード例 #17
0
 private void                                OnHScrollModeChanged(object sender, EventArgs e)
 {
     ScrollMode = MouseWheel.GetHScrollMode(sender as DependencyObject);
 }
コード例 #18
0
 private void                                OnEnhancedChanged(object sender, EventArgs e)
 {
     Enhanced = MouseWheel.GetEnhanced(sender as DependencyObject);
 }
コード例 #19
0
 private void OnModifiersChanged(object sender, EventArgs e)
 {
     _modifiers = MouseWheel.GetZoomModifiers(sender as DependencyObject);
 }
コード例 #20
0
 private void    OnDebouncingXChanged(object sender, EventArgs e)
 {
     Debouncing = MouseWheel.GetPhysicalHScrollDebouncing(sender as DependencyObject);
 }
コード例 #21
0
 private void                                OnModifierKeysYChanged(object sender, EventArgs e)
 {
     _modifiersKeys = MouseWheel.GetVScrollModifiers(sender as DependencyObject);
 }
コード例 #22
0
 private void OnHScrollIncrementChanged(object sender, EventArgs e)
 {
     ScrollIncrement = MouseWheel.GetPhysicalHScrollIncrement(sender as DependencyObject);
 }
コード例 #23
0
 protected virtual void                      OnLoading()
 {
     _enhanced = MouseWheel.GetEnhanced(Controller.Element);
     MouseWheel.EnhancedProperty.AddValueChanged(Controller.Element, OnEnhancedChanged);
 }
コード例 #24
0
 private void   OnMaximumChanged(object sender, EventArgs e)
 {
     _maximum = MouseWheel.GetMaximum(sender as DependencyObject);
 }
コード例 #25
0
        public override void Move(IMotionInfo info, object context, double delta)
        {
            var element = Controller.Element;

            MouseWheel.SetValue(element, MouseWheel.GetValue(element) + delta);
        }
コード例 #26
0
 protected override IMouseWheelShaft     GetMotionShaft(MouseWheel wheel, IMouseWheelTransferCase transferCase)
 {
     return(transferCase[0]);
 }
コード例 #27
0
 private void OnSmoothingChanged(object sender, EventArgs e)
 {
     Smoothing = MouseWheel.GetZoomSmoothing(sender as DependencyObject);
 }
コード例 #28
0
 private void OnNestedZoomChanged(object sender, EventArgs e)
 {
     NestedMotionEnabled = MouseWheel.GetNestedZoom(sender as DependencyObject);
 }
コード例 #29
0
 private void OnDebouncingChanged(object sender, EventArgs e)
 {
     Debouncing = MouseWheel.GetZoomDebouncing(sender as DependencyObject);
 }
コード例 #30
0
 public MouseWheelMultiShaftTransferCase(MouseWheel wheel)
 {
     _wheel = wheel;
     InitializeDebouncingFunctions();
 }