Skip to content

Commit

Permalink
feat: frames can be declared using (x, y) coordinates as its center
Browse files Browse the repository at this point in the history
  • Loading branch information
jodros committed Dec 31, 2023
1 parent 84771ae commit 06094be
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@ SILE.framePrototype = pl.class({
end
end
-- Add definitions of width and height
for method in pairs(alldims) do
if spec[method] then
self:constrain(method, spec[method])
if self.x and self.y then
self:constrain("left", self.x .. "-(" .. spec["width"] .. "/2)")
self:constrain("right", self.x .. "+(" .. spec["width"] .. "/2)")
self:constrain("top", self.y .. "-(" .. spec["height"] .. "/2)")
self:constrain("bottom", self.y .. "+(" .. spec["height"] .. "/2)")
else
for method in pairs(alldims) do
if spec[method] then
self:constrain(method, spec[method])
end
end
end
end
Expand Down

0 comments on commit 06094be

Please sign in to comment.