Use SVG for the magnified outfit viewer when editing pet appearance
This commit is contained in:
parent
b2a23b3e7b
commit
addf2d6cc5
3 changed files with 9 additions and 4 deletions
|
@ -77,13 +77,15 @@ module OutfitsHelper
|
|||
|
||||
private
|
||||
|
||||
def parse_outfit_viewer_options(outfit=nil, pet_state: nil, **html_options)
|
||||
def parse_outfit_viewer_options(
|
||||
outfit=nil, pet_state: nil, preferred_image_format: :png, **html_options
|
||||
)
|
||||
outfit = Outfit.new(pet_state:) if outfit.nil? && pet_state.present?
|
||||
|
||||
if outfit.nil?
|
||||
raise ArgumentError, "outfit viewer must have outfit or pet state"
|
||||
end
|
||||
|
||||
{outfit:, html_options:}
|
||||
{outfit:, preferred_image_format:, html_options:}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
}
|
||||
- if swf_asset.canvas_movie?
|
||||
%iframe{src: swf_asset_path(swf_asset, playing: outfit_viewer_is_playing ? true : nil)}
|
||||
- elsif swf_asset.image_url.present?
|
||||
- elsif preferred_image_format == :svg && swf_asset.svg_url?
|
||||
= image_tag swf_asset.svg_url, alt: "", loading: "lazy"
|
||||
- elsif swf_asset.image_url?
|
||||
= image_tag swf_asset.image_url, alt: "", loading: "lazy"
|
||||
- else
|
||||
/ No movie or image available for SWF asset: #{swf_asset.url}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
= content_tag "support-outfit-viewer", **html_options do
|
||||
-# Render an outfit viewer in a magnifier. Use SVG for maximum clarity!
|
||||
%magic-magnifier
|
||||
= outfit_viewer outfit
|
||||
= outfit_viewer outfit, preferred_image_format: :svg
|
||||
|
||||
%table
|
||||
%thead
|
||||
|
|
Loading…
Reference in a new issue