fix: resolve text preview error, add default panels

This commit is contained in:
2026-02-04 18:03:47 +05:00
parent d31e446fbd
commit bc7ed2498f
6 changed files with 105 additions and 63 deletions
+9 -10
View File
@@ -38,18 +38,17 @@ export class ExportService {
ctx.drawImage(bgImage, 0, 0, 320, panel.height);
// Рисуем текст
panel.texts.forEach((textItem) => {
ctx.font = `${textItem.fontSize}px ${textItem.fontFamily}`;
ctx.fillStyle = textItem.color;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
const textItem = panel.text;
ctx.font = `${textItem.fontSize}px ${textItem.fontFamily}`;
ctx.fillStyle = textItem.color;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
// Calculate position based on existing system
const x = 160; // Center of 320px panel
const y = panel.height / 2 + textItem.verticalOffset;
// Calculate position based on existing system
const x = 160; // Center of 320px panel
const y = panel.height / 2 + textItem.verticalOffset;
ctx.fillText(textItem.text, x, y);
});
ctx.fillText(textItem.text, x, y);
// Конвертируем в blob и сохраняем
canvas.toBlob((blob) => {
+1 -1
View File
@@ -14,7 +14,7 @@ export interface TextItem {
export interface Panel {
id: string;
backgroundImage: string;
texts: TextItem[];
text: TextItem;
height: number;
createdAt: Date;
updatedAt: Date;