avoid showing eases out-of-bounds

This commit is contained in:
jill 2021-09-19 21:34:14 +03:00
parent 6164974241
commit 6dabb64d53

View file

@ -99,18 +99,20 @@ function self.render()
-- polygone
-- this isnt done with a polygon because else itd waste a Bunch of ram and i kinda, dont want to do that?
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setScissor(x + margin, y + margin, w - (margin * 2), h - (margin * 2))
local last = (((graph[1] or 0) - 0.5) * zoome) + 0.5
for gx = 1, quality - 1 do
local a = gx/quality
local b = graph[gx + 1] or 0
b = ((b - 0.5) * zoome) + 0.5
local px, py = x + margin + gx * ((w - margin)/quality), y + h - margin - b * (h - margin * 2)
local ox, oy = x + margin + (gx - 1) * ((w - margin)/quality), y + h - margin - last * (h - margin * 2)
local px, py = x + margin + gx * ((w - margin * 2)/quality), y + h - margin - b * (h - margin * 2)
local ox, oy = x + margin + (gx - 1) * ((w - margin * 2)/quality), y + h - margin - last * (h - margin * 2)
if math.abs(b - last) < 1 then
love.graphics.line(ox, oy, px, py)
end
last = b
end
love.graphics.setScissor()
-- zoom lines
local a = math.min(math.abs(zoome - 1) * 10, 1)
@ -127,6 +129,7 @@ function self.render()
-- preview
if not screenshot then
love.graphics.setScissor(x - margin, 0, w + margin * 2, sh)
love.graphics.setColor(0.16, 0.16, 0.17, 1)
love.graphics.line(x + margin, y + h + padding * 2 + csize/2, x + w - margin, y + h + padding * 2 + csize/2)
love.graphics.setColor(0.3, 0.3, 0.31, 1)
@ -144,6 +147,7 @@ function self.render()
end
love.graphics.ellipse('fill', x + margin + (w - margin * 2) * da, y + h + padding * 2 + csize/2, csize * (1 + math.min(math.abs(a1 - a2), 3) * 1.2), csize)
love.graphics.setScissor()
end
end
end