Skip to content

Commit

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

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 77a6f1b commit a724c85
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/frametricks/init.lua
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 a724c85

Please sign in to comment.