Story Viewer: fix situational incorrect scaling of background images
This commit is contained in:
parent
63403c90a5
commit
e150c7c070
1 changed files with 11 additions and 19 deletions
|
@ -152,24 +152,16 @@ void story_viewer::display_part(window& window)
|
|||
std::string width_formula = "(image_original_width)";
|
||||
std::string height_formula = "(image_original_height)";
|
||||
|
||||
// If scale width is true, the image will be stretched to screen width.
|
||||
if(layer.scale_horizontally()) {
|
||||
width_formula = "(width)";
|
||||
|
||||
// Override height formula to preserve ratio, if applicable.
|
||||
if(preserve_ratio) {
|
||||
height_formula = "(image_original_height * width / image_original_width)";
|
||||
}
|
||||
}
|
||||
|
||||
// If scale height is true, the image will be stretched to screen height.
|
||||
if(layer.scale_vertically()) {
|
||||
if(layer.scale_horizontally() && preserve_ratio) {
|
||||
height_formula = "(min((image_original_height * screen_width / image_original_width), height))";
|
||||
} else {
|
||||
height_formula = "(height)";
|
||||
|
||||
// Override width formula to preserve ratio, if applicable.
|
||||
if(preserve_ratio) {
|
||||
width_formula = "(image_original_width * height / image_original_height)";
|
||||
}
|
||||
|
||||
if(layer.scale_vertically() && preserve_ratio) {
|
||||
width_formula = "(min((image_original_width * screen_height / image_original_height), width))";
|
||||
} else {
|
||||
width_formula = "(width)";
|
||||
}
|
||||
|
||||
// Background layers are always centered.
|
||||
|
|
Loading…
Add table
Reference in a new issue