more previewage

This commit is contained in:
24c02 2026-01-14 18:02:44 -05:00
parent 472465b521
commit 15061f834f
7 changed files with 19 additions and 6 deletions

View file

@ -69,16 +69,16 @@ module SnailMail
protected
# Helper methods to render components
def render_return_address(x, y, width, height, **options)
render ReturnAddressComponent.new(letter: letter, x: x, y: y, width: width, height: height, **options)
def render_return_address(x, y, width, height, **opts)
render ReturnAddressComponent.new(letter: letter, x: x, y: y, width: width, height: height, **opts.merge(preview_mode: preview_mode?))
end
def render_destination_address(x, y, width, height, **options)
render DestinationAddressComponent.new(letter: letter, x: x, y: y, width: width, height: height, **options)
def render_destination_address(x, y, width, height, **opts)
render DestinationAddressComponent.new(letter: letter, x: x, y: y, width: width, height: height, **opts.merge(preview_mode: preview_mode?))
end
def render_imb(x, y, width, **options)
render IMbComponent.new(letter: letter, x: x, y: y, width: width, **options)
def render_imb(x, y, width, **opts)
render IMbComponent.new(letter: letter, x: x, y: y, width: width, **opts.merge(preview_mode: preview_mode?))
end
def render_qr_code(x, y, size = 70)

View file

@ -37,6 +37,8 @@ module SnailMail
if stroke_box
stroke { rectangle([@x, @y], @width, @height) }
end
stroke_preview_bounds(@x, @y, @width, @height, label: "destination address")
end
end
end

View file

@ -31,6 +31,8 @@ module SnailMail
**opts,
)
end
stroke_preview_bounds(@x, @y, @width, 24, label: "IMb barcode")
end
private

View file

@ -21,6 +21,8 @@ module SnailMail
**options.except(:font)
)
end
stroke_preview_bounds(@x, @y, 50, @size, label: "letter ID")
end
end
end

View file

@ -12,10 +12,13 @@ module SnailMail
if letter.postage_type == "indicia"
IMI.render_indicium(self, letter, letter.usps_indicium, x_position)
FIM.render_fim_d(self, x_position - 62)
stroke_preview_bounds(x_position - 62, bounds.top, 200, 50, label: "postage + FIM-D")
elsif letter.postage_type == "stamps"
render_stamps_postage(x_position)
stroke_preview_bounds(bounds.right - 55, bounds.top - 5, 50, 50, label: "postage (stamps)")
else
render_generic_postage
stroke_preview_bounds(bounds.right - 55, bounds.top - 5, 52, 50, label: "postage")
end
end

View file

@ -16,6 +16,8 @@ module SnailMail
font("f25") do
text_box("scan this so we know you got it!", at: [@x + 3, @y + 22], width: 54, size: 6.4)
end
stroke_preview_bounds(@x, @y, @size, @size, label: "QR code")
end
end
end

View file

@ -31,6 +31,8 @@ module SnailMail
**opts,
)
end
stroke_preview_bounds(@x, @y, @width, @height, label: "return address")
end
private