From 403d1e0ace530bdbb9096c096f948de59e61cefb Mon Sep 17 00:00:00 2001 From: Insality Date: Fri, 17 Oct 2025 22:16:58 +0300 Subject: [PATCH] Update --- druid/helper.lua | 18 +++++------------- .../properties_panel/properties_panel.lua | 3 ++- example/druid.gui | 12 ++++++++++++ wiki/changelog.md | 1 + 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/druid/helper.lua b/druid/helper.lua index c38faca..021a2b2 100644 --- a/druid/helper.lua +++ b/druid/helper.lua @@ -182,21 +182,13 @@ end ---@param v2 number|nil Max value If nil, value will be clamped to negative infinity ---@return number value Clamped value function M.clamp(value, v1, v2) - if v1 and v2 then - if v1 > v2 then - v1, v2 = v2, v1 - end + v1 = v1 or -math.huge + v2 = v2 or math.huge + if v1 > v2 then + v1, v2 = v2, v1 end - if v1 and value < v1 then - return v1 - end - - if v2 and value > v2 then - return v2 - end - - return value + return math.max(v1, math.min(value, v2)) end diff --git a/druid/widget/properties_panel/properties_panel.lua b/druid/widget/properties_panel/properties_panel.lua index 0148030..83c30af 100644 --- a/druid/widget/properties_panel/properties_panel.lua +++ b/druid/widget/properties_panel/properties_panel.lua @@ -30,6 +30,7 @@ local COLOR_REFRESH_ACTIVE = "#8BD092" function M:init() self.root = self:get_node("root") + self.scale_root = gui.get_scale(self.root) self.content = self:get_node("content") self.container = self.druid:new_container(self.root) @@ -118,7 +119,7 @@ end function M:on_drag_widget(dx, dy) local position = self.container:get_position() - self.container:set_position(position.x + dx, position.y + dy) + self.container:set_position(position.x + dx * self.scale_root.x, position.y + dy * self.scale_root.y) end diff --git a/example/druid.gui b/example/druid.gui index 9856fc6..b8244ef 100644 --- a/example/druid.gui +++ b/example/druid.gui @@ -4081,6 +4081,18 @@ nodes { parent: "properties_panel/header" template_node_child: true } +nodes { + type: TYPE_BOX + id: "properties_panel/icon_refresh" + parent: "properties_panel/header" + template_node_child: true +} +nodes { + type: TYPE_BOX + id: "properties_panel/icon_back" + parent: "properties_panel/header" + template_node_child: true +} nodes { type: TYPE_BOX id: "properties_panel/content" diff --git a/wiki/changelog.md b/wiki/changelog.md index e7248dd..4ee0243 100644 --- a/wiki/changelog.md +++ b/wiki/changelog.md @@ -746,3 +746,4 @@ Please support me if you like this project! It will help me keep engaged to upda - Add "Pages" to manage a a big lists of properties with paginations support - Add `properties_panel:render_lua_table` to easily render your lua tables with a various types support (any simple types and vector, functions, events etc) - Add "Refresh" button, which active a 1-sec refresh for current page +- [#329](https://github.com/Insality/druid/issues/329) Allow numeric characters in RichText tags