mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 18:37:44 +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)
|
function M.set_state(self, indexes)
|
||||||
for i = 1, #indexes do
|
for i = 1, #indexes do
|
||||||
if self.checkbox[indexes[i]] then
|
if self.checkboxes[i] then
|
||||||
self.checkbox[indexes[i]]:set_state(true, true)
|
self.checkboxes[i]:set_state(indexes[i], true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -76,6 +76,17 @@ function M.on_input(self, action_id, action)
|
|||||||
if action.released then
|
if action.released then
|
||||||
self.is_drag = false
|
self.is_drag = false
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,22 +63,27 @@ end
|
|||||||
|
|
||||||
|
|
||||||
local function setup_slider(self)
|
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) .. "%")
|
gui.set_text(gui.get_node("text_progress_slider"), math.ceil(value * 100) .. "%")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
slider:set(0.2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function setup_checkbox(self)
|
local function setup_checkbox(self)
|
||||||
self.druid:new_checkbox_group(
|
local group1 = self.druid:new_checkbox_group(
|
||||||
{"radio1/check", "radio2/check", "radio3/check" },
|
{"radio1/check", "radio2/check", "radio3/check"},
|
||||||
nil, true,
|
nil, true,
|
||||||
{"radio1/back", "radio2/back", "radio3/back"})
|
{"radio1/back", "radio2/back", "radio3/back"})
|
||||||
|
|
||||||
self.druid:new_checkbox_group(
|
local group2 = self.druid:new_checkbox_group(
|
||||||
{"checkbox1/check", "checkbox2/check", "checkbox3/check" },
|
{"checkbox1/check", "checkbox2/check", "checkbox3/check"},
|
||||||
nil, false,
|
nil, false,
|
||||||
{"checkbox1/back", "checkbox2/back", "checkbox3/back"})
|
{"checkbox1/back", "checkbox2/back", "checkbox3/back"})
|
||||||
|
|
||||||
|
group1:set_state({false, false, true})
|
||||||
|
group2:set_state({true, false, true})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user