コード例 #1
0
 protected override bool OnMouseMove(InputState state)
 {
     if (IsHovered || dragged)
     {
         float f = MathHelper.Clamp(ToLocalSpace(state.Mouse.Position).X / barContainer.DrawSize.X, 0, 1);
         triangle.MoveToX(f);
         hoverTimeText.MoveToX(f);
         if (dragged)
         {
             currentTime = (metadata.Value?.Track?.Length ?? 0) * f;
         }
         hoverTimeText.Text = formatTime(TimeSpan.FromMilliseconds((metadata.Value?.Track?.Length ?? 0) * f));
         if (hoverTimeText.BoundingBox.IntersectsWith(timeText.BoundingBox))
         {
             if (!xyz)
             {
                 timeText.FadeOut(200, Easing.OutCubic);
                 xyz = true;
             }
         }
         else if (xyz)
         {
             timeText.FadeIn(200, Easing.OutCubic);
             xyz = false;
         }
         if (hoverTimeText.BoundingBox.IntersectsWith(totalTimeText.BoundingBox))
         {
             if (!zyx)
             {
                 totalTimeText.FadeOut(200, Easing.OutCubic);
                 zyx = true;
             }
         }
         else if (zyx)
         {
             totalTimeText.FadeIn(200, Easing.OutCubic);
             zyx = false;
         }
     }
     return(base.OnMouseMove(state));
 }