This commit is contained in:
Insality
2025-03-10 22:40:12 +02:00
parent 6c5210a0fa
commit c13a31711f
3 changed files with 61 additions and 5 deletions

View File

@@ -41,10 +41,7 @@ function M.new(context, style)
M.set_default_style(default_style)
end
local new_instance = setmetatable({}, { __index = druid_instance })
new_instance:initialize(context, style)
return new_instance
return druid_instance.create_druid_instance(context, style)
end

View File

@@ -207,7 +207,10 @@ end
---Druid class constructor
---@param context table Druid context. Usually it is self of gui script
---@param style table? Druid style table
function M:initialize(context, style)
---@return druid.instance
function M.create_druid_instance(context, style)
local self = setmetatable({}, { __index = M })
self._context = context
self._style = style or settings.default_style
self._is_late_remove_enabled = false
@@ -224,6 +227,8 @@ function M:initialize(context, style)
events.subscribe("druid.window_event", self.on_window_event, self)
events.subscribe("druid.language_change", self.on_language_change, self)
return self
end