diff --git a/dropdown.lua b/dropdown.lua index 455a389..9d76d6a 100644 --- a/dropdown.lua +++ b/dropdown.lua @@ -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) diff --git a/slider.lua b/slider.lua index b16b3ff..21bb29c 100644 --- a/slider.lua +++ b/slider.lua @@ -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) diff --git a/tooltips.lua b/tooltips.lua index c16eaea..1c98e7c 100644 --- a/tooltips.lua +++ b/tooltips.lua @@ -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()