[0.14] Progressbar size flickering on pause
Posted: Sun Sep 25, 2016 6:46 pm
So I have used a very short progressbar as a color indicator, but I want it to be smaller than specified in the data.lua.
However, at first they stay the size specified in data.lua, but when paused they flicker between the large size and the small size:
https://www.dropbox.com/s/n90zxvm6z52z1 ... 7.mp4?dl=0
Data.lua
control.lua
However, at first they stay the size specified in data.lua, but when paused they flicker between the large size and the small size:
https://www.dropbox.com/s/n90zxvm6z52z1 ... 7.mp4?dl=0
Data.lua
Code: Select all
data.raw["gui-style"].default.color_progess_bar =
{
type = "progressbar_style",
parent = "progressbar_style",
smooth_color = {r=1,g=1,b=1},
other_smooth_colors = {},
smooth_bar =
{
filename = "__Tasker__/graphics/color_bar.png",
priority = "extra-high-no-scale",
width = 1,
height = 52,
},
smooth_bar_background =
{
filename = "__Tasker__/graphics/color_bar.png",
priority = "extra-high-no-scale",
width = 1,
height = 52,
},
left_padding = 3,
width = 34,
height = 28,
}
local stepsize = get_stepsize()
for b = 0, 1+(stepsize)/2, stepsize do -- due to floating point erros the upper limit must be higher than 1, but lower than 1+stepsize
for g = 0, 1+(stepsize)/2, stepsize do
for r = 0, 1+(stepsize)/2 ,stepsize do
local c = (r + ((1+stepsize)/stepsize)*g + ((1+stepsize)/stepsize)^2*b) + stepsize/10-- add a stepsize since its less than and not less or equal than
local less_then = 0.99 + c / get_scale_factor() --maps the colors to [0.99,1.00] range.
table.insert(data.raw["gui-style"].default.color_progess_bar.other_smooth_colors, {less_then = less_then, color = {r = r, g = g, b = b}})
end
end
end
Code: Select all
local value = 0.99 + (task.color.r + ((1+global.step_size)/global.step_size)*task.color.g + ((1+global.step_size)/global.step_size)^2*task.color.b) / global.scale_factor
local color = frame.add{type = "progressbar", name = "task_name_color_" .. task_name, size = 35, value = value, style = "color_progess_bar"}
color.style.maximal_width = 25
color.style.maximal_height = 25