Let the GPS and custom watermarks be rotated
This commit is contained in:
@@ -46,6 +46,10 @@ export interface ExportOptions {
|
||||
size?: number;
|
||||
font?: string | null;
|
||||
} | null;
|
||||
// WATERMARK tab ROTATE chip: clockwise degrees (0/90/180/270) applied to
|
||||
// BOTH the GPS lines and the custom text, each around its own anchor (the
|
||||
// same anchor Viewfinder rotates around, so the preview matches the file).
|
||||
watermarkRotation?: number;
|
||||
// Library framed-window photo reposition (Viewfinder.getFrameWindowZoom):
|
||||
// after pinch/drag inside a polaroid card window or a wall-frame opening,
|
||||
// s = scale and u/v = the fraction of the photo's cover plane sitting at the
|
||||
@@ -596,10 +600,16 @@ export async function processAndExportPhoto(
|
||||
baseY = stampH - fontSize * 1.5;
|
||||
}
|
||||
|
||||
// Spin the whole two-line block around its top-left (the anchor the
|
||||
// viewfinder uses). 0 = the historical upright look.
|
||||
const wmRot = options?.watermarkRotation ?? 0;
|
||||
stampCanvas.save();
|
||||
if (wmRot) stampCanvas.rotate(wmRot, baseX, baseY - Math.round(fontSize * 2.4));
|
||||
stampCanvas.drawText('📍', baseX, baseY - fontSize * 1.4, iconPaint, iconFont);
|
||||
stampCanvas.drawText(locationName, baseX + gap, baseY - fontSize * 1.4, textPaint, font);
|
||||
stampCanvas.drawText('📷', baseX, baseY, iconPaint, iconFont);
|
||||
stampCanvas.drawText(timestampStr, baseX + gap, baseY, textPaint, font);
|
||||
stampCanvas.restore();
|
||||
}
|
||||
|
||||
// Custom watermark: baseline at the dragged fraction of the photo/window
|
||||
@@ -623,7 +633,11 @@ export async function processAndExportPhoto(
|
||||
wmPaint.setColor(Skia.Color(customWm.color ?? '#f59e0b'));
|
||||
const tx = area.dx + clamp01(customWm.x) * area.dw;
|
||||
const ty = area.dy + clamp01(customWm.y) * area.dh + Math.round(wmSize * 0.35);
|
||||
const wmRot = options?.watermarkRotation ?? 0;
|
||||
stampCanvas.save();
|
||||
if (wmRot) stampCanvas.rotate(wmRot, tx, ty);
|
||||
stampCanvas.drawText(customWm.text, tx, ty, wmPaint, wmFont);
|
||||
stampCanvas.restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user