mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
add simple slider component
This commit is contained in:
@@ -11,7 +11,7 @@ end
|
||||
local function random_progress(progress, text)
|
||||
local rnd = math.random()
|
||||
|
||||
gui.set_text(text, math.ceil(rnd * 100))
|
||||
gui.set_text(text, math.ceil(rnd * 100) .. "%")
|
||||
progress:to(rnd)
|
||||
end
|
||||
|
||||
@@ -38,10 +38,10 @@ end
|
||||
|
||||
|
||||
local function setup_progress(self)
|
||||
local progress = self.druid:new_progress("progress_fill", "x", 0.4)
|
||||
random_progress(progress, gui.get_node("text_progress"))
|
||||
self.progress = self.druid:new_progress("progress_fill", "x", 0.4)
|
||||
random_progress(self.progress, gui.get_node("text_progress"))
|
||||
timer.delay(2, true, function()
|
||||
random_progress(progress, gui.get_node("text_progress_amount"))
|
||||
random_progress(self.progress, gui.get_node("text_progress_amount"))
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -62,6 +62,13 @@ local function setup_grid(self)
|
||||
end
|
||||
|
||||
|
||||
local function setup_slider(self)
|
||||
self.druid:new_slider("slider_pin", vmath.vector3(95, 0, 0), function(_, value)
|
||||
gui.set_text(gui.get_node("text_progress_slider"), math.ceil(value * 100) .. "%")
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
local function setup_checkbox(self)
|
||||
self.druid:new_checkbox("radio1/check", nil, "radio1/back")
|
||||
self.druid:new_checkbox("radio2/check", nil, "radio2/back")
|
||||
@@ -97,6 +104,7 @@ function M.setup_page(self)
|
||||
setup_timer(self)
|
||||
setup_checkbox(self)
|
||||
setup_scroll(self)
|
||||
setup_slider(self)
|
||||
setup_back_handler(self)
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user