Skip to content

Commit

Permalink
fix(packages): Cast measurements to numbers before use in PDF functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Jul 8, 2020
1 parent 03fcd07 commit 5f2d2e3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/rotate.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
local pdf = require("justenoughlibtexpdf")

local enter = function(self)
local enter = function (self)
if not self.rotate then return end
local x = -math.rad(self.rotate)
-- Keep center point the same
pdf:gsave()
local cx = self:left()
local cy = -self:bottom()

pdf.setmatrix(1,0,0,1,cx + math.sin(x) * self:height(),cy)
local cx = self:left():tonumber()
local cy = -self:bottom():tonumber()
pdf.setmatrix(1, 0, 0, 1, cx + math.sin(x) * self:height():tonumber(), cy)
pdf.setmatrix(math.cos(x), math.sin(x), -math.sin(x), math.cos(x), 0, 0)
pdf.setmatrix(1,0,0,1,-cx,-cy)
pdf.setmatrix(1, 0, 0, 1, -cx, -cy)
end

local leave = function(self)
Expand Down

0 comments on commit 5f2d2e3

Please sign in to comment.