mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
Update widgets
This commit is contained in:
parent
37d7168bd6
commit
606f400719
@ -261,6 +261,7 @@ local function update_text_with_anchor_shift(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---@param self druid.text
|
||||||
local function update_adjust(self)
|
local function update_adjust(self)
|
||||||
if not self.adjust_type or self.adjust_type == const.TEXT_ADJUST.NO_ADJUST then
|
if not self.adjust_type or self.adjust_type == const.TEXT_ADJUST.NO_ADJUST then
|
||||||
reset_default_scale(self)
|
reset_default_scale(self)
|
||||||
|
@ -252,12 +252,16 @@ function M:on_input(action_id, action)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if action_id == const.ACTION_LEFT and (action.pressed or action.repeated) then
|
if self.input.is_selected then
|
||||||
self.input:move_selection(-1, self.is_lshift, self.is_lctrl)
|
if action_id == const.ACTION_LEFT and (action.pressed or action.repeated) then
|
||||||
end
|
self.input:move_selection(-1, self.is_lshift, self.is_lctrl)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
if action_id == const.ACTION_RIGHT and (action.pressed or action.repeated) then
|
if action_id == const.ACTION_RIGHT and (action.pressed or action.repeated) then
|
||||||
self.input:move_selection(1, self.is_lshift, self.is_lctrl)
|
self.input:move_selection(1, self.is_lshift, self.is_lctrl)
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -265,7 +269,7 @@ end
|
|||||||
--- Set placeholder text
|
--- Set placeholder text
|
||||||
---@param placeholder_text string The placeholder text
|
---@param placeholder_text string The placeholder text
|
||||||
function M:set_placeholder(placeholder_text)
|
function M:set_placeholder(placeholder_text)
|
||||||
self.placeholder:set_to(placeholder_text)
|
self.placeholder:set_text(placeholder_text)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ local M = {}
|
|||||||
function M:init()
|
function M:init()
|
||||||
self.root = self:get_node("root")
|
self.root = self:get_node("root")
|
||||||
self.text_name = self.druid:new_text("text_name")
|
self.text_name = self.druid:new_text("text_name")
|
||||||
:set_text_adjust("trim_left")
|
:set_text_adjust("scale_then_trim_left", 0.3)
|
||||||
|
|
||||||
self.selected = self:get_node("selected")
|
self.selected = self:get_node("selected")
|
||||||
gui.set_alpha(self.selected, 0)
|
gui.set_alpha(self.selected, 0)
|
||||||
|
@ -17,6 +17,7 @@ function M:init()
|
|||||||
gui.set_alpha(self.selected, 0)
|
gui.set_alpha(self.selected, 0)
|
||||||
|
|
||||||
self.text_name = self.druid:new_text("text_name")
|
self.text_name = self.druid:new_text("text_name")
|
||||||
|
:set_text_adjust("scale_then_trim_left", 0.3)
|
||||||
|
|
||||||
self.button = self.druid:new_button("button", self.on_click)
|
self.button = self.druid:new_button("button", self.on_click)
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ local M = {}
|
|||||||
function M:init()
|
function M:init()
|
||||||
self.root = self:get_node("root")
|
self.root = self:get_node("root")
|
||||||
self.text_name = self.druid:new_text("text_name")
|
self.text_name = self.druid:new_text("text_name")
|
||||||
|
:set_text_adjust("scale_then_trim_left", 0.3)
|
||||||
|
|
||||||
self.selected = self:get_node("selected")
|
self.selected = self:get_node("selected")
|
||||||
gui.set_alpha(self.selected, 0)
|
gui.set_alpha(self.selected, 0)
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ function M:init()
|
|||||||
gui.set_alpha(self.selected, 0)
|
gui.set_alpha(self.selected, 0)
|
||||||
|
|
||||||
self.text_name = self.druid:new_text("text_name")
|
self.text_name = self.druid:new_text("text_name")
|
||||||
|
:set_text_adjust("scale_then_trim_left", 0.3)
|
||||||
|
|
||||||
self.text_value = self.druid:new_text("text_value")
|
self.text_value = self.druid:new_text("text_value")
|
||||||
self.button_left = self.druid:new_button("button_left", self.on_button_left)
|
self.button_left = self.druid:new_button("button_left", self.on_button_left)
|
||||||
self.button_right = self.druid:new_button("button_right", self.on_button_right)
|
self.button_right = self.druid:new_button("button_right", self.on_button_right)
|
||||||
|
@ -15,6 +15,8 @@ function M:init()
|
|||||||
self._value = 0
|
self._value = 0
|
||||||
|
|
||||||
self.text_name = self.druid:new_text("text_name")
|
self.text_name = self.druid:new_text("text_name")
|
||||||
|
:set_text_adjust("scale_then_trim_left", 0.3)
|
||||||
|
|
||||||
self.text_value = self.druid:new_text("text_value")
|
self.text_value = self.druid:new_text("text_value")
|
||||||
self.slider = self.druid:new_slider("slider_pin", vmath.vector3(55, 0, 0), self._on_slider_change_by_user) --[[@as druid.slider]]
|
self.slider = self.druid:new_slider("slider_pin", vmath.vector3(55, 0, 0), self._on_slider_change_by_user) --[[@as druid.slider]]
|
||||||
self.slider:set_input_node("slider")
|
self.slider:set_input_node("slider")
|
||||||
|
@ -9,6 +9,7 @@ function M:init()
|
|||||||
self.root = self:get_node("root")
|
self.root = self:get_node("root")
|
||||||
self.text_name = self.druid:new_text("text_name")
|
self.text_name = self.druid:new_text("text_name")
|
||||||
:set_text_adjust("scale_when_trim_left", 0.3)
|
:set_text_adjust("scale_when_trim_left", 0.3)
|
||||||
|
|
||||||
self.text_right = self.druid:new_text("text_right", "")
|
self.text_right = self.druid:new_text("text_right", "")
|
||||||
|
|
||||||
self.container = self.druid:new_container(self.root)
|
self.container = self.druid:new_container(self.root)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user