diff --git a/src/scripts/Theatre.js b/src/scripts/Theatre.js index 086da65..e8119fa 100644 --- a/src/scripts/Theatre.js +++ b/src/scripts/Theatre.js @@ -2300,8 +2300,15 @@ export class Theatre { let sprite = new PIXI.Sprite(resources[resName]); let portWidth = resources[resName].width; let portHeight = resources[resName].height; - let maxHeight = game.settings.get(CONSTANTS.MODULE_ID, "theatreImageSize"); - if (portHeight > maxHeight) { + + let usePercent = game.settings.get(CONSTANTS.MODULE_ID, "theatreImageUsePercent"); + let maxHeightPixel = game.settings.get(CONSTANTS.MODULE_ID, "theatreImageSize"); + let maxHeightPercent = window.innerHeight * game.settings.get(CONSTANTS.MODULE_ID, "theatreImageSizePercent"); + let useUniform = game.settings.get(CONSTANTS.MODULE_ID, "theatreImageSizeUniform"); + + let maxHeight = usePercent ? maxHeightPercent : maxHeightPixel; + + if (portHeight > maxHeight || useUniform) { portWidth *= maxHeight / portHeight; portHeight = maxHeight; } diff --git a/src/scripts/settings.js b/src/scripts/settings.js index d7c15ab..97a8e34 100644 --- a/src/scripts/settings.js +++ b/src/scripts/settings.js @@ -52,6 +52,33 @@ export const registerSettings = function () { type: Number, }); + + game.settings.register(CONSTANTS.MODULE_ID, "theatreImageUsePercent", { + name: "Use screen height as maximum image height", + scope: "world", + config: true, + default: false, + type: Boolean, + }); + + game.settings.register(CONSTANTS.MODULE_ID, "theatreImageSizePercent", { + name: "Maximum image height (percent)", + hint: "Set max image height as a percentage of the device screen height. Used only if the 'Use screen height as maximum image height' is enabled", + scope: "client", + config: true, + default: 0.7, + type: Number + }); + + game.settings.register(CONSTANTS.MODULE_ID, "theatreImageSizeUniform", { + name: "Uniform image height", + hint: "Set all images size to the maximum height", + scope: "world", + config: true, + default: false, + type: Boolean, + }); + game.settings.register(CONSTANTS.MODULE_ID, "theatreNarratorHeight", { name: "Theatre.UI.Settings.narrHeight", hint: "Theatre.UI.Settings.narrHeightHint",