Skip to content

Commit

Permalink
Fix extra page for PDF sprues
Browse files Browse the repository at this point in the history
Fixes #246
  • Loading branch information
andymeneely committed Jul 31, 2018
1 parent 1bc9e3f commit 3d1f1ff
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Squib follows [semantic versioning](http://semver.org).

Bugs:
* Fixed bug on circle and other shapes that had an extra stroke from a previous text call (#248)
* Fixed extra page on all sprue saves (#246)

Chores:
* Bumped deps: Pango et al. to 3.2.7, Cairo to 1.15.13.
Expand Down
9 changes: 4 additions & 5 deletions lib/squib/graphics/save_sprue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ def render_sheet(range)
card = @deck.cards[i]
slot = slots[i % per_sheet]

draw_card cc, card,
slot['x'], slot['y'],
slot['rotate'],
draw_card cc, card,
slot['x'], slot['y'],
slot['rotate'],
@sheet_args.trim, @sheet_args.trim_radius

bar.increment
end

draw_overlay_above_cards cc
cc = draw_page cc
cc.target.finish
end
end
Expand All @@ -61,7 +60,7 @@ def full_filename
private

def next_page_if_needed(cc, i, per_sheet)
return cc unless (i != 0) && (i % per_sheet).zero?
return cc unless (i != 0) && (i % per_sheet) == 0

draw_overlay_above_cards cc
cc = draw_page cc
Expand Down
2 changes: 1 addition & 1 deletion samples/sprues/_hex_tiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
)
text(
str: %w[One Two Three Four Five Six Seven Eight Nine],
x: '27mm', y: '35mm', width: '11.8mm', height: '6mm',
x: '22mm', y: '35mm', width: '21.8mm', height: '6mm',
align: :center, valign: :middle
)
save_pdf file: 'hex_tiles.pdf',
Expand Down

0 comments on commit 3d1f1ff

Please sign in to comment.