Skip to content

Commit

Permalink
fix editor density counting ticks as full notes
Browse files Browse the repository at this point in the history
  • Loading branch information
flustix committed Jul 17, 2024
1 parent 87527ea commit 98c89da
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions fluXis.Game/Screens/Edit/BottomBar/Timeline/TimelineDensity.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using fluXis.Game.Map.Structures;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
Expand Down Expand Up @@ -67,20 +68,19 @@ private void trackChanged(Track track)

private void updateDensity()
{
var counts = new int[sections];
var counts = new float[sections];

for (int i = 0; i < sections; i++)
{
var start = sectionLength * i;
var end = start + sectionLength;

var density = map.MapInfo.HitObjects.Count(h => h.Time >= start && h.EndTime <= end);
counts[i] = density;
var objects = map.MapInfo.HitObjects.Where(h => h.Time >= start && h.EndTime <= end);
counts[i] = objects.Sum(getValue);
}

var highest = counts.Max();

var percentages = counts.Select(c => (float)c / highest).ToArray();
var percentages = counts.Select(c => c / highest).ToArray();

for (var i = 0; i < sections; i++)
{
Expand All @@ -89,6 +89,14 @@ private void updateDensity()
}
}

private float getValue(HitObject hit)
{
if (hit.Type == 1)
return .1f;

return 1f;
}

protected override bool OnHover(HoverEvent e)
{
this.ResizeHeightTo(12, 300, Easing.OutQuint);
Expand Down

0 comments on commit 98c89da

Please sign in to comment.