Fix page outer path

This commit is contained in:
Júlio César Batista 2022-12-05 18:52:08 -08:00
parent f929c82730
commit 58cd8d6922
No known key found for this signature in database
GPG key ID: 10C4B861BF314878

View file

@ -19,18 +19,29 @@ func NewPage(box *geo.Box) Shape {
} }
func pageOuterPath(box *geo.Box) *svg.SvgPathContext { func pageOuterPath(box *geo.Box) *svg.SvgPathContext {
pc := svg.NewSVGPathContext(box.TopLeft, box.Width/66, box.Height/79.0) // base page size
const PAGE_WIDTH = 66.
const PAGE_HEIGHT = 79.
pc := svg.NewSVGPathContext(box.TopLeft, 1., 1.)
pc.StartAt(pc.Absolute(0.5, 0)) pc.StartAt(pc.Absolute(0.5, 0))
pc.H(false, 45.1836) baseX := box.Width - PAGE_WIDTH
pc.C(false, 46.3544, 0.0, 47.479, 0.456297, 48.3189, 1.27202) pc.H(false, baseX+45.1836) // = width-(66+45.1836)
pc.L(false, 64.6353, 17.12) pc.C(false, baseX+46.3544, 0.0, baseX+47.479, 0.456297, baseX+48.3189, 1.27202)
pc.C(false, 65.5077, 17.9674, 66.0, 19.1318, 66.0, 20.348) pc.L(false, baseX+64.6353, 17.12)
pc.V(false, 78.5) pc.C(false, baseX+65.5077, 17.9674, baseX+66., 19.1318, baseX+66., 20.348)
pc.C(false, 66.0, 78.7761, 65.7761, 79.0, 65.5, 79.0) // baseY is not needed above because the coordinates start at 0
pc.H(false, 0.499999) baseY := box.Height - PAGE_HEIGHT
pc.C(false, 0.223857, 79.0, 0.0, 78.7761, 0.0, 78.5) pc.V(false, baseY+78.5)
pc.V(false, 0.499999) pc.C(false, baseX+66.0, baseY+78.7761, baseX+65.7761, baseY+79.0, baseX+65.5, baseY+79.0)
pc.C(false, 0.0, 0.223857, 0.223857, 0.0, 0.5, 0.0)
// these are the corners and they should change as the shape grows
scaleX := box.Width / PAGE_WIDTH
scaleY := box.Height / PAGE_HEIGHT
pc.H(false, scaleX*.499999)
pc.C(false, scaleX*0.223857, baseY+79.0, 0.0, baseY+78.7761, 0.0, baseY+78.5)
pc.V(false, scaleY*0.499999)
pc.C(false, 0.0, scaleY*0.223857, scaleX*0.223857, 0.0, scaleX*0.5, 0.0)
pc.Z() pc.Z()
return pc return pc
} }