mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 13:07:18 +08:00
Make comment different
This commit is contained in:
parent
b1d447bf71
commit
b7612af20c
@ -10,7 +10,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
internal class OsuScrollContainer : ScrollContainer
|
internal class OsuScrollContainer : ScrollContainer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add the ability to seek to an absolute scroll position when the right mouse button is pressed or dragged.
|
/// Allows controlling the scroll bar from any position in the container using the right mouse button.
|
||||||
/// Uses the value of <see cref="DistanceDecayOnRightMouseScrollbar"/> to smoothly scroll to the dragged location.
|
/// Uses the value of <see cref="DistanceDecayOnRightMouseScrollbar"/> to smoothly scroll to the dragged location.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool RightMouseScrollbar = false;
|
public bool RightMouseScrollbar = false;
|
||||||
@ -20,7 +20,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double DistanceDecayOnRightMouseScrollbar = 0.02;
|
public double DistanceDecayOnRightMouseScrollbar = 0.02;
|
||||||
|
|
||||||
private bool shouldPerformRelativeDrag(InputState state) => RightMouseScrollbar && state.Mouse.IsPressed(MouseButton.Right);
|
private bool shouldPerformRightMouseScroll(InputState state) => RightMouseScrollbar && state.Mouse.IsPressed(MouseButton.Right);
|
||||||
|
|
||||||
private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar);
|
private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar);
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
{
|
{
|
||||||
if (shouldPerformRelativeDrag(state))
|
if (shouldPerformRightMouseScroll(state))
|
||||||
{
|
{
|
||||||
scrollToRelative(state.Mouse.Position[ScrollDim]);
|
scrollToRelative(state.Mouse.Position[ScrollDim]);
|
||||||
return true;
|
return true;
|
||||||
@ -52,7 +52,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override bool OnDragStart(InputState state)
|
protected override bool OnDragStart(InputState state)
|
||||||
{
|
{
|
||||||
if (shouldPerformRelativeDrag(state))
|
if (shouldPerformRightMouseScroll(state))
|
||||||
{
|
{
|
||||||
mouseScrollBarDragging = true;
|
mouseScrollBarDragging = true;
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user