Skip to content

Commit

Permalink
fix(frames): Update frame constraints with new frame IDs after \makec…
Browse files Browse the repository at this point in the history
…olumns

Frames whose constrains are bound to the content frame now synchonize
their right edge to the last column created by the \makecolumns command.
  • Loading branch information
jodros authored and alerque committed Oct 27, 2023
1 parent c7ae6e6 commit b2d6b4f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/frametricks/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,18 @@ function package:registerCommands ()
end, "Breaks the current frame in two vertically at the current location or at a point <offset> below the current location")

self:registerCommand("makecolumns", function (options, _)
local aligned = {}
options.columns = options.columns or 2
for key in pairs(SILE.frames) do
-- this must be checked before makecolumns() call, since the function changes the right() value of content
if SILE.getFrame(key):right() == SILE.getFrame("content"):right() and key ~= "content" then
table.insert(aligned, key)
end
end
makecolumns(options)
for _, frame in ipairs(aligned) do
SILE.getFrame(frame):constrain("right", SILE.getFrame("content_col"..options.columns-1):right())
end
end, "Split the current frame into multiple columns")

self:registerCommand("breakframehorizontal", function (options, _)
Expand Down

0 comments on commit b2d6b4f

Please sign in to comment.