}
private float stepScrollDistance = 0f;
+ /// <summary>
+ /// Wheel scroll move distance.
+ /// This value decide how long distance will it moves in wheel event.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float WheelScrollDistance
+ {
+ get
+ {
+ return (float)GetValue(WheelScrollDistanceProperty);
+ }
+ set
+ {
+ SetValue(WheelScrollDistanceProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+ private float wheelScrollDistance = 50f;
+
// Let's consider more whether this needs to be set as protected.
private float finalTargetPosition;
PivotPoint = NUI.PivotPoint.CenterRight,
};
+ WheelEvent += OnWheelEvent;
+
AccessibilityManager.Instance.SetAccessibilityAttribute(this, AccessibilityManager.AccessibilityAttribute.Trait, "ScrollableBase");
SetKeyboardNavigationSupport(true);
propertyNotification = null;
}
+ WheelEvent -= OnWheelEvent;
+
if (type == DisposeTypes.Explicit)
{
return true;
}
+
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool OnWheel(Wheel wheel)
+ {
+ if (wheel == null)
+ {
+ return false;
+ }
+
+ float currentScrollPosition = -(ScrollingDirection == Direction.Horizontal ? ContentContainer.CurrentPosition.X : ContentContainer.CurrentPosition.Y);
+ ScrollTo(currentScrollPosition + (wheelScrollDistance * wheel.Z), false);
+
+ return true;
+ }
+
+ private bool OnWheelEvent(object o, WheelEventArgs e)
+ {
+ return OnWheel(e?.Wheel);
+ }
}
} // namespace
});
/// <summary>
+ /// WheelScrollDistanceProperty
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty WheelScrollDistanceProperty = BindableProperty.Create(nameof(WheelScrollDistance), typeof(float), typeof(ScrollableBase), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var instance = (ScrollableBase)bindable;
+ if (newValue != null)
+ {
+ instance.wheelScrollDistance = (float)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var instance = (ScrollableBase)bindable;
+ return instance.stepScrollDistance;
+ });
+
+ /// <summary>
/// FadeScrollbarProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]