add more tooltips & tweak visuals

This commit is contained in:
jill 2021-09-19 14:22:47 +03:00
parent 1b572c67a5
commit 775d97ef2a
3 changed files with 13 additions and 6 deletions

View file

@ -151,7 +151,8 @@ function self.createDropdowns()
options = eases,
name = 'ease1',
icons = icons(eases),
params = params(eases)
params = params(eases),
tooltip = 'The a in b(a(x))'
})
insertDropdown(d, {
x = outerpadding + dropdownWidth + padding + dropdownWidth + padding,
@ -160,7 +161,8 @@ function self.createDropdowns()
options = eases,
name = 'ease2',
icons = icons(eases),
params = params(eases)
params = params(eases),
tooltip = 'The b in b(a(x))'
})
local _e1 = ease.eases[d[dropdownId - 1].options[d[dropdownId - 1].selected]]
@ -212,6 +214,7 @@ function self.render()
love.graphics.setColor(0.06, 0.06, 0.12, 0.6)
if love.mouse.getX() > x and love.mouse.getX() < x + w and love.mouse.getY() > y and love.mouse.getY() < y + h then
love.graphics.setColor(0.8, 0.8, 1, love.mouse.isDown(1) and 0.4 or 0.3)
if v.tooltip then tooltips.show(v.tooltip) end
end
love.graphics.rectangle('fill', x, y, w, h)

View file

@ -47,7 +47,8 @@ function self.createSliders()
max = 1,
default = 0.5,
name = 'mix',
displayname = 'Mix'
displayname = 'Mix',
tooltip = 'The point at which the first ease snaps into the second one'
})
end
if mode == modes.preview or mode == modes.mix or mode == modes.multiply then -- bpm slider
@ -150,6 +151,7 @@ function self.render()
love.graphics.setColor(0, 0, 0, 1)
if hovering or dragging then
love.graphics.setColor(0.2, 0.2, 0.3, 1)
if v.tooltip then tooltips.show(v.tooltip) end
end
love.graphics.rectangle('fill', -ssize/2, -ssize/2, ssize, ssize)
love.graphics.setColor(1, 1, 1, 1)

View file

@ -23,6 +23,7 @@ function self.prerender()
end
function self.show(text)
if love.mouse.isDown(1) or dropdown.openDropdown ~= 0 then return end
tooltipframe = true
tooltiptext = text
tooltiptargetwidth = love.graphics.newText(love.graphics.getFont(), text):getWidth()
@ -43,10 +44,11 @@ function self.render()
if tooltipwidth > 1 then
local a = math.min((tooltipwidth - 1) / 6, 1)
local x, y, w, h = mx + 8, my + 8, tooltipwidth + 4 + margin, fontHeight + margin
local x, y, w, h = mx + 8, my + 8, (tooltipwidth + 4 + margin), (fontHeight + margin)
local easiness = 3 -- hehe. magic numbers
local sx, sy = (w - softlimit(mx - tooltipx, w/easiness)/easiness) / w, (h - softlimit(my - tooltipy, h/easiness)/easiness) / h
local scale = 0.8
local sx, sy = ((w - softlimit(mx - tooltipx, w/easiness)/easiness) / w) * scale, ((h - softlimit(my - tooltipy, h/easiness)/easiness) / h) * scale
love.graphics.push()
@ -58,7 +60,7 @@ function self.render()
love.graphics.setScissor(0, 0, math.max(mx + (tooltipwidth + 2 + margin/2 + 16) * sx, 0), love.graphics.getHeight())
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setColor(1, 1, 1, a)
love.graphics.print(tooltiptext, 2 + margin/2, 2 + margin/2)
love.graphics.setScissor()