class Pettanr.View.Image @thumbnail_size: () -> [Manifest.manifest().magic_numbers['thumbnail_width'], Manifest.manifest().magic_numbers['thumbnail_height']] @to_thumbnail_size: (w, h) -> s = @thumbnail_size() @fix_size_both(s[0], s[1], w, h) @minicon_size: () -> [Math.floor(Manifest.manifest().magic_numbers['thumbnail_width'] / 2), Math.floor(Manifest.manifest().magic_numbers['thumbnail_height'] / 2)] @to_minicon_size: (w, h) -> s = @minicon_size() @fix_size_both(s[0], s[1], w, h) @fix_size_both: (limw, limh, w, h)-> wr = if w > limw limw*100/w else 100 hr = if h > limh limh*100/h else 100 r = if wr < hr [Math.floor(w*wr/100), Math.floor(h*wr/100)] else [Math.floor(w*hr/100), Math.floor(h*hr/100)] r @image_dir: () -> '/images/' @icon_error_file: () -> new Pettanr.ImageFile(@image_dir() + 'error.png') @icon_prof_file: () -> new Pettanr.ImageFile(@image_dir() + 'prof.gif') @icon_edit_file: () -> new Pettanr.ImageFile(@image_dir() + 'edit.png') @icon_destroy_file: () -> new Pettanr.ImageFile(@image_dir() + 'remove.png') @icon_inspire_file: () -> new Pettanr.ImageFile(@image_dir() + 'inspire.gif') @icon_loading_file: () -> new Pettanr.ImageFile(@image_dir() + 'loading.gif') @icon_root_file: () -> new Pettanr.ImageFile(@image_dir() + 'root.png') @icon_pick_file: (type) -> new Pettanr.ImageFile(@image_dir() + type + '.gif')