Hang the wall frame landscape too, beside the portrait one
This commit is contained in:
@@ -219,6 +219,10 @@ function loadFaces(assets: RenderAssets) {
|
||||
return faces;
|
||||
}
|
||||
|
||||
// Both walls are one artwork on one code path: `wallframe` hangs the PNG turned
|
||||
// 90° CW (the portrait opening), `wallframe-landscape` lays it down as it is.
|
||||
const isWallframe = (id: FrameId) => id === 'wallframe' || id === 'wallframe-landscape';
|
||||
|
||||
function loadWallframe(assets: RenderAssets) {
|
||||
if (wallframeImage) return wallframeImage;
|
||||
wallframeImage = Skia.Image.MakeImageFromEncoded(assets.wallframe);
|
||||
@@ -254,7 +258,7 @@ export async function renderPhoto(input: RenderInput): Promise<RenderResult | nu
|
||||
const aspectWH = options?.aspect && options.aspect !== 'full' ? ASPECT_RATIO_W_H[options.aspect] : null;
|
||||
const cropRect = options?.cropRect ?? null;
|
||||
const ratioWH = cropRect ? null : options?.cropWH ?? aspectWH;
|
||||
if ((cropRect || ratioWH) && frameId !== 'wallframe') {
|
||||
if ((cropRect || ratioWH) && !isWallframe(frameId)) {
|
||||
const curAspect = width / height;
|
||||
let cropW = width;
|
||||
let cropH = height;
|
||||
@@ -534,13 +538,13 @@ export async function renderPhoto(input: RenderInput): Promise<RenderResult | nu
|
||||
stampCanvas = cardCanvas;
|
||||
stampW = outW;
|
||||
stampH = outH;
|
||||
} else if (frameId === 'wallframe') {
|
||||
} else if (isWallframe(frameId)) {
|
||||
flush(surface);
|
||||
const photoImg = own(surface.makeImageSnapshot());
|
||||
cardSource = photoImg;
|
||||
const pw = photoImg.width();
|
||||
const ph = photoImg.height();
|
||||
const wallLand = options?.wallframeLandscape === true;
|
||||
const wallLand = frameId === 'wallframe-landscape' || options?.wallframeLandscape === true;
|
||||
const outW = wallLand ? WALLFRAME_LAND_W : WALLFRAME_W;
|
||||
const outH = wallLand ? WALLFRAME_LAND_H : WALLFRAME_H;
|
||||
const cardSurface = createSurface(outW, outH);
|
||||
|
||||
Reference in New Issue
Block a user