Fix size of portrait images with the SIZE_NORMAL setting. (#7188)
This commit is contained in:
parent
9db0ebb7f5
commit
8860916225
3 changed files with 23 additions and 15 deletions
|
@ -14,20 +14,25 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// For Large the image gets drawn as big as possible.
|
||||
// constraint by: timeline width, manual heigh overrides, SIZE_LARGE.h
|
||||
const SIZE_LARGE = { w: 800, h: 600 };
|
||||
const SIZE_NORMAL = { w: 324, h: 220 };
|
||||
|
||||
// For Normal the image gets drawn to never exceed SIZE_NORMAL.w, SIZE_NORMAL.h
|
||||
// constraint by: timeline width, manual heigh overrides
|
||||
const SIZE_NORMAL_LANDSCAPE = { w: 324, h: 324 }; // for w > h
|
||||
const SIZE_NORMAL_PORTRAIT = { w: 324 * (9/16), h: 324 }; // for h > w
|
||||
export enum ImageSize {
|
||||
Normal = "normal",
|
||||
Large = "large",
|
||||
}
|
||||
|
||||
export function suggestedSize(size: ImageSize): { w: number, h: number } {
|
||||
export function suggestedSize(size: ImageSize, portrait = false): { w: number, h: number} {
|
||||
switch (size) {
|
||||
case ImageSize.Large:
|
||||
return SIZE_LARGE;
|
||||
case ImageSize.Normal:
|
||||
default:
|
||||
return SIZE_NORMAL;
|
||||
return portrait ? SIZE_NORMAL_PORTRAIT : SIZE_NORMAL_LANDSCAPE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue