diff --git a/druid/custom/rich_input/rich_input.gui b/druid/custom/rich_input/rich_input.gui index ad0bb1d..c179f20 100644 --- a/druid/custom/rich_input/rich_input.gui +++ b/druid/custom/rich_input/rich_input.gui @@ -54,7 +54,7 @@ nodes { } type: TYPE_TEXT text: "Placeholder" - font: "text_bold" + font: "druid_text_bold" id: "placeholder_text" outline { x: 0.4 @@ -87,7 +87,7 @@ nodes { } type: TYPE_TEXT text: "User input" - font: "text_bold" + font: "druid_text_bold" id: "input_text" shadow { x: 1.0 @@ -145,7 +145,7 @@ nodes { } type: TYPE_TEXT text: "|" - font: "text_bold" + font: "druid_text_bold" id: "cursor_text" shadow { x: 1.0 diff --git a/druid/helper.lua b/druid/helper.lua index f24ca56..ac49d43 100644 --- a/druid/helper.lua +++ b/druid/helper.lua @@ -519,4 +519,21 @@ function M.remove_with_shift(array, index, shift_policy) end +---Get full position of node in the GUI tree +---@param node node GUI node +---@param root node|nil GUI root node to stop search +function M.get_full_position(node, root) + local position = gui.get_position(node) + local parent = gui.get_parent(node) + while parent and parent ~= root do + local parent_position = gui.get_position(parent) + position.x = position.x + parent_position.x + position.y = position.y + parent_position.y + parent = gui.get_parent(parent) + end + + return position +end + + return M diff --git a/druid/widget/fps_panel/fps_panel.lua b/druid/widget/fps_panel/fps_panel.lua index 33a2d99..58d9ed5 100644 --- a/druid/widget/fps_panel/fps_panel.lua +++ b/druid/widget/fps_panel/fps_panel.lua @@ -1,3 +1,4 @@ +local helper = require("druid.helper") local mini_graph = require("druid.widget.mini_graph.mini_graph") ---@class widget.fps_panel: druid.widget @@ -22,7 +23,13 @@ function M:init() self.mini_graph:set_samples(self.graph_samples) -- show last 30 seconds self.mini_graph:set_max_value(TARGET_FPS) - gui.set_parent(self:get_node("content"), self.mini_graph.content, true) + do -- Set parent manually + local parent_node = self.mini_graph.content + local position = helper.get_full_position(parent_node, self.mini_graph.root) + local content = self:get_node("content") + gui.set_parent(content, self.mini_graph.content) + gui.set_position(content, -position) + end self.text_min_fps = self.druid:new_text("text_min_fps") self.text_fps = self.druid:new_text("text_fps") diff --git a/druid/widget/memory_panel/memory_panel.lua b/druid/widget/memory_panel/memory_panel.lua index e90aeec..fad517c 100644 --- a/druid/widget/memory_panel/memory_panel.lua +++ b/druid/widget/memory_panel/memory_panel.lua @@ -1,3 +1,4 @@ +local helper = require("druid.helper") local mini_graph = require("druid.widget.mini_graph.mini_graph") ---@class widget.memory_panel: druid.widget @@ -5,13 +6,24 @@ local mini_graph = require("druid.widget.mini_graph.mini_graph") local M = {} function M:init() + self.root = self:get_node("root") self.delta_time = 0.1 self.samples_count = 30 self.memory_limit = 100 self.mini_graph = self.druid:new_widget(mini_graph, "mini_graph") self.mini_graph:set_samples(self.samples_count) - gui.set_parent(self:get_node("content"), self.mini_graph.content, true) + + -- This one is not works with scaled root + --gui.set_parent(self:get_node("content"), self.mini_graph.content, true) + + do -- Set parent manually + local parent_node = self.mini_graph.content + local position = helper.get_full_position(parent_node, self.mini_graph.root) + local content = self:get_node("content") + gui.set_parent(content, self.mini_graph.content) + gui.set_position(content, -position) + end self.max_value = self.druid:new_text("text_max_value") self.text_per_second = self.druid:new_text("text_per_second") diff --git a/druid/widget/properties_panel/properties/property_input.gui b/druid/widget/properties_panel/properties/property_input.gui index e82aaf3..c204d30 100644 --- a/druid/widget/properties_panel/properties/property_input.gui +++ b/druid/widget/properties_panel/properties/property_input.gui @@ -37,7 +37,7 @@ nodes { } type: TYPE_TEXT text: "Input" - font: "text_bold" + font: "druid_text_bold" id: "text_name" pivot: PIVOT_W outline { diff --git a/druid/widget/properties_panel/properties/property_text.gui b/druid/widget/properties_panel/properties/property_text.gui index 3ebf171..1f1af0a 100644 --- a/druid/widget/properties_panel/properties/property_text.gui +++ b/druid/widget/properties_panel/properties/property_text.gui @@ -37,7 +37,7 @@ nodes { } type: TYPE_TEXT text: "Text" - font: "text_bold" + font: "druid_text_bold" id: "text_name" pivot: PIVOT_W outline { @@ -74,7 +74,7 @@ nodes { } type: TYPE_TEXT text: "Text" - font: "text_bold" + font: "druid_text_bold" id: "text_right" pivot: PIVOT_E outline {