fix position of title overlay; force refresh on resize

develop
Myk Taylor 2023-04-27 12:59:06 -07:00
parent 719c47cf5c
commit fab05ca887
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 10 additions and 2 deletions

@ -510,7 +510,7 @@ end
local function _render_viewscreen_widgets(vs_name, dc) local function _render_viewscreen_widgets(vs_name, dc)
local vs_widgets = active_viewscreen_widgets[vs_name] local vs_widgets = active_viewscreen_widgets[vs_name]
if not vs_widgets then return false end if not vs_widgets then return end
dc = dc or gui.Painter.new() dc = dc or gui.Painter.new()
for _,db_entry in pairs(vs_widgets) do for _,db_entry in pairs(vs_widgets) do
local w = db_entry.widget local w = db_entry.widget
@ -518,11 +518,18 @@ local function _render_viewscreen_widgets(vs_name, dc)
detect_frame_change(w, function() w:render(dc) end) detect_frame_change(w, function() w:render(dc) end)
end end
end end
return dc
end end
local force_refresh
function render_viewscreen_widgets(vs_name) function render_viewscreen_widgets(vs_name)
local dc = _render_viewscreen_widgets(vs_name, nil) local dc = _render_viewscreen_widgets(vs_name, nil)
_render_viewscreen_widgets('all', dc) _render_viewscreen_widgets('all', dc)
if force_refresh then
force_refresh = nil
df.global.gps.force_full_display_count = 1
end
end end
-- called when the DF window is resized -- called when the DF window is resized
@ -531,6 +538,7 @@ function reposition_widgets()
for _,db_entry in pairs(widget_db) do for _,db_entry in pairs(widget_db) do
db_entry.widget:updateLayout(sr) db_entry.widget:updateLayout(sr)
end end
force_refresh = true
end end
-- ------------------------------------------------- -- -- ------------------------------------------------- --
@ -568,7 +576,7 @@ end
TitleVersionOverlay = defclass(TitleVersionOverlay, OverlayWidget) TitleVersionOverlay = defclass(TitleVersionOverlay, OverlayWidget)
TitleVersionOverlay.ATTRS{ TitleVersionOverlay.ATTRS{
default_pos={x=50, y=-2}, default_pos={x=7, y=2},
default_enabled=true, default_enabled=true,
viewscreens='title/Default', viewscreens='title/Default',
frame={w=35, h=3}, frame={w=35, h=3},