Skip to content

Commit

Permalink
make-cards: Draw the crosshairs before the margin translation
Browse files Browse the repository at this point in the history
  • Loading branch information
bpeel committed Nov 29, 2022
1 parent c5baa12 commit 50412c1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions make-cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ def _draw_crosshairs(self):

for y in range(0, LINES_PER_PAGE + 1):
for x in range(0, COLUMNS_PER_PAGE + 1):
self.cr.move_to(CARD_WIDTH * x,
CARD_HEIGHT * y - CROSSHAIR_SIZE / 2.0)
self.cr.move_to(CARD_WIDTH * x + MARGIN,
CARD_HEIGHT * y -
CROSSHAIR_SIZE / 2.0 +
MARGIN)
self.cr.rel_line_to(0, CROSSHAIR_SIZE)
self.cr.rel_move_to(CROSSHAIR_SIZE / 2.0,
-CROSSHAIR_SIZE / 2.0)
Expand Down Expand Up @@ -172,19 +174,19 @@ def flush_card(self):

card_in_page = self.card_num % CARDS_PER_PAGE

if card_in_page == 0:
if self.card_num != 0:
self.cr.show_page()

self._draw_crosshairs()

self.cr.save()
self.cr.translate(MARGIN,
card_in_page //
COLUMNS_PER_PAGE *
CARD_HEIGHT +
MARGIN)

if card_in_page == 0:
if self.card_num != 0:
self.cr.show_page()

self._draw_crosshairs()

page_num = self.card_num // CARDS_PER_PAGE
column = self.card_num % COLUMNS_PER_PAGE

Expand Down

0 comments on commit 50412c1

Please sign in to comment.