mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
updates in new components
This commit is contained in:
parent
c048224a1f
commit
14e0680f2f
@ -12,8 +12,8 @@ end
|
||||
|
||||
function M.set_state(self, indexes)
|
||||
for i = 1, #indexes do
|
||||
if self.checkbox[indexes[i]] then
|
||||
self.checkbox[indexes[i]]:set_state(true, true)
|
||||
if self.checkboxes[i] then
|
||||
self.checkboxes[i]:set_state(indexes[i], true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -76,6 +76,17 @@ function M.on_input(self, action_id, action)
|
||||
if action.released then
|
||||
self.is_drag = false
|
||||
end
|
||||
|
||||
return self.is_drag
|
||||
end
|
||||
|
||||
|
||||
function M.set(self, value)
|
||||
value = helper.clamp(value, 0, 1)
|
||||
|
||||
gui.set_position(self.node, self.start_pos + self.dist * value)
|
||||
self.value = value
|
||||
on_change_value(self)
|
||||
end
|
||||
|
||||
|
||||
|
@ -63,22 +63,27 @@ end
|
||||
|
||||
|
||||
local function setup_slider(self)
|
||||
self.druid:new_slider("slider_pin", vmath.vector3(95, 0, 0), function(_, value)
|
||||
local slider = 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)
|
||||
|
||||
slider:set(0.2)
|
||||
end
|
||||
|
||||
|
||||
local function setup_checkbox(self)
|
||||
self.druid:new_checkbox_group(
|
||||
{"radio1/check", "radio2/check", "radio3/check" },
|
||||
local group1 = self.druid:new_checkbox_group(
|
||||
{"radio1/check", "radio2/check", "radio3/check"},
|
||||
nil, true,
|
||||
{"radio1/back", "radio2/back", "radio3/back"})
|
||||
|
||||
self.druid:new_checkbox_group(
|
||||
{"checkbox1/check", "checkbox2/check", "checkbox3/check" },
|
||||
local group2 = self.druid:new_checkbox_group(
|
||||
{"checkbox1/check", "checkbox2/check", "checkbox3/check"},
|
||||
nil, false,
|
||||
{"checkbox1/back", "checkbox2/back", "checkbox3/back"})
|
||||
|
||||
group1:set_state({false, false, true})
|
||||
group2:set_state({true, false, true})
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user