mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Basic examples done
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
local helper = require("druid.helper")
|
||||
|
||||
---@class examples.basic_slider: druid.widget
|
||||
---@field root node
|
||||
---@field slider druid.slider
|
||||
@@ -18,4 +20,13 @@ function M:on_slider_change(value)
|
||||
end
|
||||
|
||||
|
||||
---@param output_log output_list
|
||||
function M:on_example_created(output_log)
|
||||
self.slider.on_change_value:subscribe(function(_, value)
|
||||
value = helper.round(value, 2)
|
||||
output_log:add_log_text("Slider Value: " .. value)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
@@ -1,3 +1,5 @@
|
||||
local helper = require("druid.helper")
|
||||
|
||||
---@class examples.basic_slider_stepped: druid.widget
|
||||
---@field root node
|
||||
---@field slider druid.slider
|
||||
@@ -20,4 +22,13 @@ function M:on_slider_change(value)
|
||||
end
|
||||
|
||||
|
||||
---@param output_log output_list
|
||||
function M:on_example_created(output_log)
|
||||
self.slider.on_change_value:subscribe(function(_, value)
|
||||
value = helper.round(value, 2)
|
||||
output_log:add_log_text("Slider Value: " .. value)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
@@ -1,3 +1,5 @@
|
||||
local helper = require("druid.helper")
|
||||
|
||||
---@class examples.basic_slider_vertical: druid.widget
|
||||
---@field root node
|
||||
---@field slider druid.slider
|
||||
@@ -18,4 +20,14 @@ function M:on_slider_change(value)
|
||||
end
|
||||
|
||||
|
||||
---@param output_log output_list
|
||||
function M:on_example_created(output_log)
|
||||
self.slider.on_change_value:subscribe(function(_, value)
|
||||
value = helper.round(value, 2)
|
||||
output_log:add_log_text("Slider Value: " .. value)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user