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); } }
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, int timestamp, int delta, Orientation orientation) : base(wheel.MouseDevice, Math.Max(0, timestamp), delta) { Controller = controller; Wheel = wheel; Orientation = orientation; }
protected override void OnLoading() { base.OnLoading(); var element = Controller.Element; _modifiersKeys = MouseWheel.GetVScrollModifiers(element); MouseWheel.VScrollModifiersProperty.AddValueChanged(element, OnModifierKeysYChanged); }
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); }
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); }
private IMouseWheelShaft GetMotionShaft(MouseWheel wheel) { Wheel = wheel; if (_shaft == null) { _shaft = GetMotionShaft(wheel, wheel.ActiveTransferCase); } wheel.ActiveTransferCase.ActiveShaft = _shaft; return(_shaft); }
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); }
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); }
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(); } }
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 } }
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); } }
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 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)); } }
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 OnHScrollModeChanged(object sender, EventArgs e) { ScrollMode = MouseWheel.GetHScrollMode(sender as DependencyObject); }
private void OnEnhancedChanged(object sender, EventArgs e) { Enhanced = MouseWheel.GetEnhanced(sender as DependencyObject); }
private void OnModifiersChanged(object sender, EventArgs e) { _modifiers = MouseWheel.GetZoomModifiers(sender as DependencyObject); }
private void OnDebouncingXChanged(object sender, EventArgs e) { Debouncing = MouseWheel.GetPhysicalHScrollDebouncing(sender as DependencyObject); }
private void OnModifierKeysYChanged(object sender, EventArgs e) { _modifiersKeys = MouseWheel.GetVScrollModifiers(sender as DependencyObject); }
private void OnHScrollIncrementChanged(object sender, EventArgs e) { ScrollIncrement = MouseWheel.GetPhysicalHScrollIncrement(sender as DependencyObject); }
protected virtual void OnLoading() { _enhanced = MouseWheel.GetEnhanced(Controller.Element); MouseWheel.EnhancedProperty.AddValueChanged(Controller.Element, OnEnhancedChanged); }
private void OnMaximumChanged(object sender, EventArgs e) { _maximum = MouseWheel.GetMaximum(sender as DependencyObject); }
public override void Move(IMotionInfo info, object context, double delta) { var element = Controller.Element; MouseWheel.SetValue(element, MouseWheel.GetValue(element) + delta); }
protected override IMouseWheelShaft GetMotionShaft(MouseWheel wheel, IMouseWheelTransferCase transferCase) { return(transferCase[0]); }
private void OnSmoothingChanged(object sender, EventArgs e) { Smoothing = MouseWheel.GetZoomSmoothing(sender as DependencyObject); }
private void OnNestedZoomChanged(object sender, EventArgs e) { NestedMotionEnabled = MouseWheel.GetNestedZoom(sender as DependencyObject); }
private void OnDebouncingChanged(object sender, EventArgs e) { Debouncing = MouseWheel.GetZoomDebouncing(sender as DependencyObject); }
public MouseWheelMultiShaftTransferCase(MouseWheel wheel) { _wheel = wheel; InitializeDebouncingFunctions(); }