Added brightness transition to projectsearch text/line on complete
This commit is contained in:
parent
0967740d88
commit
26d6e558f1
|
@ -12,6 +12,7 @@ local ResultsView = View:extend()
|
||||||
function ResultsView:new(text, fn)
|
function ResultsView:new(text, fn)
|
||||||
ResultsView.super.new(self)
|
ResultsView.super.new(self)
|
||||||
self.scrollable = true
|
self.scrollable = true
|
||||||
|
self.brightness = 0
|
||||||
self:begin_search(text, fn)
|
self:begin_search(text, fn)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ function ResultsView:begin_search(text, fn)
|
||||||
self.last_file_idx = i
|
self.last_file_idx = i
|
||||||
end
|
end
|
||||||
self.searching = false
|
self.searching = false
|
||||||
|
self.brightness = 100
|
||||||
core.redraw = true
|
core.redraw = true
|
||||||
end, self.results)
|
end, self.results)
|
||||||
|
|
||||||
|
@ -102,6 +104,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
function ResultsView:update()
|
function ResultsView:update()
|
||||||
|
self:move_towards("brightness", 0, 0.1)
|
||||||
ResultsView.super.update(self)
|
ResultsView.super.update(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -169,14 +172,16 @@ function ResultsView:draw()
|
||||||
text = string.format("Found %d matches for %q",
|
text = string.format("Found %d matches for %q",
|
||||||
#self.results, self.query)
|
#self.results, self.query)
|
||||||
end
|
end
|
||||||
renderer.draw_text(style.font, text, x, y, style.text)
|
local color = common.lerp(style.text, style.accent, self.brightness / 100)
|
||||||
|
renderer.draw_text(style.font, text, x, y, color)
|
||||||
|
|
||||||
-- horizontal line
|
-- horizontal line
|
||||||
local yoffset = self:get_results_yoffset()
|
local yoffset = self:get_results_yoffset()
|
||||||
local x = ox + style.padding.x
|
local x = ox + style.padding.x
|
||||||
local w = self.size.x - style.padding.x * 2
|
local w = self.size.x - style.padding.x * 2
|
||||||
local h = style.divider_size
|
local h = style.divider_size
|
||||||
renderer.draw_rect(x, oy + yoffset - style.padding.y, w, h, style.dim)
|
local color = common.lerp(style.dim, style.text, self.brightness / 100)
|
||||||
|
renderer.draw_rect(x, oy + yoffset - style.padding.y, w, h, color)
|
||||||
if self.searching then
|
if self.searching then
|
||||||
renderer.draw_rect(x, oy + yoffset - style.padding.y, w * per, h, style.text)
|
renderer.draw_rect(x, oy + yoffset - style.padding.y, w * per, h, style.text)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue