Skip to content

Commit

Permalink
Fix journal issue with resize frame
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktor-obrebski committed Aug 1, 2024
1 parent e7001f4 commit cec0dc5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
14 changes: 4 additions & 10 deletions gui/journal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ local RESIZE_MIN = {w=32, h=10}

JOURNAL_PERSIST_KEY = 'journal'

local INVISIBLE_FRAME = {
frame_pen=gui.CLEAR_PEN,
signature_pen=false,
}

journal_config = journal_config or json.open('dfhack-config/journal.json')

JournalWindow = defclass(JournalWindow, widgets.Window)
Expand Down Expand Up @@ -88,7 +83,6 @@ function JournalWindow:init()

interior_b=true,
frame_style_t=false,
frmae_style=INVISIBLE_FRAME,
},
text_editor.TextEditor{
view_id='journal_editor',
Expand Down Expand Up @@ -227,11 +221,11 @@ function JournalWindow:ensurePanelsRelSize()
local divider = self.subviews.table_of_contents_divider

toc_panel.frame.w = math.min(
math.max(toc_panel.frame.w, toc_panel.resize_min.w),
self.frame.w - editor.resize_min.w
math.max(toc_panel.frame_parent_rect.w, toc_panel.resize_min.w),
self.frame_parent_rect.w - editor.resize_min.w
)
editor.frame.l = toc_panel.visible and toc_panel.frame.w or 1
divider.frame.l = editor.frame.l - 1
editor.frame.l = toc_panel.visible and toc_panel.frame_parent_rect.w or 1
divider.frame.l = editor.frame_parent_rect.l - 1
end

function JournalWindow:preUpdateLayout()
Expand Down
5 changes: 5 additions & 0 deletions internal/journal/table_of_contents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
local gui = require 'gui'
local widgets = require 'gui.widgets'

local INVISIBLE_FRAME = {
frame_pen=gui.CLEAR_PEN,
signature_pen=false,
}

TableOfContents = defclass(TableOfContents, widgets.Panel)
TableOfContents.ATTRS {
frame_style=INVISIBLE_FRAME,
Expand Down

0 comments on commit cec0dc5

Please sign in to comment.