mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
made method into property
This commit is contained in:
@ -44,7 +44,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
}
|
}
|
||||||
|
|
||||||
tooltip.Position = new Vector2(state.Mouse.Position.X,ActiveCursor.BoundingBox.Bottom);
|
tooltip.Position = new Vector2(state.Mouse.Position.X,ActiveCursor.BoundingBox.Bottom);
|
||||||
tooltip.UpdateTooltip(state);
|
tooltip.MouseState = state.Mouse;
|
||||||
|
|
||||||
return base.OnMouseMove(state);
|
return base.OnMouseMove(state);
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,28 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IMouseState MouseState
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value.Position != value.LastPosition && overhang?.Overhanging != true)
|
||||||
|
{
|
||||||
|
show?.Cancel();
|
||||||
|
TooltipText = string.Empty;
|
||||||
|
IHasTooltip hasTooltip = input.HoveredDrawables.OfType<IHasTooltip>().FirstOrDefault();
|
||||||
|
if (hasTooltip != null)
|
||||||
|
{
|
||||||
|
IHasDelayedTooltip delayedTooltip = hasTooltip as IHasDelayedTooltip;
|
||||||
|
overhang = hasTooltip as IHasOverhangingTooltip;
|
||||||
|
show = Scheduler.AddDelayed(() => TooltipText = hasTooltip.Tooltip, delayedTooltip?.Delay ?? 250);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Tooltip()
|
public Tooltip()
|
||||||
{
|
{
|
||||||
|
AlwaysPresent = true;
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -48,7 +68,6 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
CornerRadius = 5,
|
CornerRadius = 5,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
AlwaysPresent = true,
|
|
||||||
EdgeEffect = new EdgeEffect
|
EdgeEffect = new EdgeEffect
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
@ -78,23 +97,11 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
tooltipBackground.Colour = colour.Gray3;
|
tooltipBackground.Colour = colour.Gray3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateTooltip(InputState state)
|
protected override void Update()
|
||||||
{
|
{
|
||||||
Scheduler.Update();
|
Scheduler.Update();
|
||||||
if (overhang?.Overhanging ?? false)
|
if (overhang?.Overhanging ?? false)
|
||||||
TooltipText = overhang.Tooltip;
|
TooltipText = overhang.Tooltip;
|
||||||
else if (state.Mouse.Position != state.Mouse.LastPosition)
|
|
||||||
{
|
|
||||||
show?.Cancel();
|
|
||||||
TooltipText = string.Empty;
|
|
||||||
IHasTooltip hasTooltip = input.HoveredDrawables.OfType<IHasTooltip>().FirstOrDefault();
|
|
||||||
if (hasTooltip != null)
|
|
||||||
{
|
|
||||||
IHasDelayedTooltip delayedTooltip = hasTooltip as IHasDelayedTooltip;
|
|
||||||
overhang = hasTooltip as IHasOverhangingTooltip;
|
|
||||||
show = Scheduler.AddDelayed(() => TooltipText = hasTooltip.Tooltip, delayedTooltip?.Delay ?? 250);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (overhang != null)
|
else if (overhang != null)
|
||||||
{
|
{
|
||||||
overhang = null;
|
overhang = null;
|
||||||
|
Reference in New Issue
Block a user