This commit is contained in:
Insality
2024-11-27 23:34:50 +02:00
parent 06f682e8e4
commit 434dce55ce
16 changed files with 252 additions and 157 deletions

View File

@@ -21,7 +21,7 @@ function M:init()
self.max = 1
self.text_name = self.druid:new_text("text_name")
:set_text_adjust("scale_then_trim_left", 0.3)
:set_text_adjust("scale_then_trim", 0.3)
self.text_value = self.druid:new_text("text_value")
self.slider = self.druid:new_slider("slider_pin", vmath.vector3(55, 0, 0), self.update_value) --[[@as druid.slider]]
@@ -46,6 +46,20 @@ function M:set_text_function(callback)
end
--- Sets the text property of the slider
---@param text string
function M:set_text_property(text)
self.text_name:set_text(text)
end
--- Sets the callback function for when the slider value changes
---@param callback fun(value:number)
function M:on_change(callback)
self.on_change_value:subscribe(callback)
end
---@param value number
function M:set_value(value, is_instant)
local diff = math.abs(self.max - self.min)