Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions color_cards_sprite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/mtg_card_maker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class Template
def initialize(width: CARD_WIDTH, height: CARD_HEIGHT, embed_font: false)
@width = width
@height = height
@svg = Victor::SVG.new width: width, height: height
@svg = Victor::SVG.new width: width, height: height, viewBox: "0 0 #{width} #{height}"
embed_font(embed: embed_font)
end

Expand Down
7 changes: 6 additions & 1 deletion lib/mtg_card_maker/sprite_sheet_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ def add_card_to_sprite(xml, card_file, index, embed_font)
return unless svg_element

xml.g(transform: "translate(#{position[:x]}, #{position[:y]})") do
add_card_children(xml, svg_element, embed_font)
# Add the card with its own viewBox for proper scaling
xml.svg(viewBox: "0 0 #{CARD_WIDTH} #{CARD_HEIGHT}",
width: CARD_WIDTH,
height: CARD_HEIGHT) do
add_card_children(xml, svg_element, embed_font)
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion output_card.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion spec/fixtures/art_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion spec/fixtures/border_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion spec/fixtures/complete_card.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion spec/fixtures/frame_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion spec/fixtures/name_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion spec/fixtures/power_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion spec/fixtures/text_box_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion spec/fixtures/type_line_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.