diff --git a/druid/base/text.lua b/druid/base/text.lua index 5396cec..773f57d 100755 --- a/druid/base/text.lua +++ b/druid/base/text.lua @@ -261,6 +261,7 @@ local function update_text_with_anchor_shift(self) end +---@param self druid.text local function update_adjust(self) if not self.adjust_type or self.adjust_type == const.TEXT_ADJUST.NO_ADJUST then reset_default_scale(self) diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index 36f9491..db14b7b 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -252,12 +252,16 @@ function M:on_input(action_id, action) end end - if action_id == const.ACTION_LEFT and (action.pressed or action.repeated) then - self.input:move_selection(-1, self.is_lshift, self.is_lctrl) - end + if self.input.is_selected then + if action_id == const.ACTION_LEFT and (action.pressed or action.repeated) then + 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 - self.input:move_selection(1, self.is_lshift, self.is_lctrl) + if action_id == const.ACTION_RIGHT and (action.pressed or action.repeated) then + self.input:move_selection(1, self.is_lshift, self.is_lctrl) + return true + end end end @@ -265,7 +269,7 @@ end --- Set placeholder text ---@param placeholder_text string The placeholder text function M:set_placeholder(placeholder_text) - self.placeholder:set_to(placeholder_text) + self.placeholder:set_text(placeholder_text) return self end diff --git a/druid/widget/properties_panel/properties/property_button.lua b/druid/widget/properties_panel/properties/property_button.lua index 085a437..d7fa92f 100644 --- a/druid/widget/properties_panel/properties/property_button.lua +++ b/druid/widget/properties_panel/properties/property_button.lua @@ -12,7 +12,7 @@ local M = {} function M:init() self.root = self:get_node("root") 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") gui.set_alpha(self.selected, 0) diff --git a/druid/widget/properties_panel/properties/property_checkbox.lua b/druid/widget/properties_panel/properties/property_checkbox.lua index 57d82e1..bf4c2dc 100644 --- a/druid/widget/properties_panel/properties/property_checkbox.lua +++ b/druid/widget/properties_panel/properties/property_checkbox.lua @@ -17,6 +17,7 @@ function M:init() gui.set_alpha(self.selected, 0) 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) diff --git a/druid/widget/properties_panel/properties/property_input.lua b/druid/widget/properties_panel/properties/property_input.lua index 83c7c0a..7f18847 100644 --- a/druid/widget/properties_panel/properties/property_input.lua +++ b/druid/widget/properties_panel/properties/property_input.lua @@ -10,6 +10,8 @@ local M = {} function M:init() self.root = self:get_node("root") self.text_name = self.druid:new_text("text_name") + :set_text_adjust("scale_then_trim_left", 0.3) + self.selected = self:get_node("selected") gui.set_alpha(self.selected, 0) diff --git a/druid/widget/properties_panel/properties/property_left_right_selector.lua b/druid/widget/properties_panel/properties/property_left_right_selector.lua index b6e5ed7..8a442ed 100644 --- a/druid/widget/properties_panel/properties/property_left_right_selector.lua +++ b/druid/widget/properties_panel/properties/property_left_right_selector.lua @@ -16,6 +16,8 @@ function M:init() gui.set_alpha(self.selected, 0) 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.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) diff --git a/druid/widget/properties_panel/properties/property_slider.lua b/druid/widget/properties_panel/properties/property_slider.lua index 16c74f4..91b975c 100644 --- a/druid/widget/properties_panel/properties/property_slider.lua +++ b/druid/widget/properties_panel/properties/property_slider.lua @@ -15,6 +15,8 @@ function M:init() self._value = 0 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.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") diff --git a/druid/widget/properties_panel/properties/property_text.lua b/druid/widget/properties_panel/properties/property_text.lua index a150e7d..192a99c 100644 --- a/druid/widget/properties_panel/properties/property_text.lua +++ b/druid/widget/properties_panel/properties/property_text.lua @@ -9,6 +9,7 @@ function M:init() self.root = self:get_node("root") self.text_name = self.druid:new_text("text_name") :set_text_adjust("scale_when_trim_left", 0.3) + self.text_right = self.druid:new_text("text_right", "") self.container = self.druid:new_container(self.root)