Skip to content

Commit

Permalink
add hovered nps to til death practice mode chord density graph
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Aug 5, 2021
1 parent e71b19f commit 8ce9f39
Showing 1 changed file with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1180,15 +1180,23 @@ local pm =
end,
HighlightCommand = function(self) -- use the bg for detection but move the seek pointer -mina
if isOver(self) then
self:GetParent():GetChild("Seek"):visible(true)
self:GetParent():GetChild("Seektext"):visible(true)
self:GetParent():GetChild("Seek"):x(INPUTFILTER:GetMouseX() - self:GetParent():GetX())
self:GetParent():GetChild("Seektext"):x(INPUTFILTER:GetMouseX() - self:GetParent():GetX() - 4) -- todo: refactor this lmao -mina
self:GetParent():GetChild("Seektext"):y(INPUTFILTER:GetMouseY() - self:GetParent():GetY())
self:GetParent():GetChild("Seektext"):settextf(
"%0.2f",
self:GetParent():GetChild("Seek"):GetX() * musicratio / getCurRateValue()
)
local seek = self:GetParent():GetChild("Seek")
local seektext = self:GetParent():GetChild("Seektext")
local cdg = self:GetParent():GetChild("ChordDensityGraph")

seek:visible(true)
seektext:visible(true)
seek:x(INPUTFILTER:GetMouseX() - self:GetParent():GetX())
seektext:x(INPUTFILTER:GetMouseX() - self:GetParent():GetX() - 4) -- todo: refactor this lmao -mina
seektext:y(INPUTFILTER:GetMouseY() - self:GetParent():GetY())
if cdg.npsVector ~= nil and #cdg.npsVector > 0 then
local percent = clamp((INPUTFILTER:GetMouseX() - self:GetParent():GetX()) / wodth, 0, 1)
local hoveredindex = clamp(math.ceil(#cdg.npsVector * percent), math.min(1, #cdg.npsVector), #cdg.npsVector)
local hoverednps = cdg.npsVector[hoveredindex]
seektext:settextf("%0.2f - %d %s", seek:GetX() * musicratio / getCurRateValue(), hoverednps, translated_info["NPS"])
else
seektext:settextf("%0.2f", seek:GetX() * musicratio / getCurRateValue())
end
else
self:GetParent():GetChild("Seektext"):visible(false)
self:GetParent():GetChild("Seek"):visible(false)
Expand Down

0 comments on commit 8ce9f39

Please sign in to comment.