improved layout customize page

This commit is contained in:
Codex Agent
2025-12-12 23:19:23 +01:00
parent a35f81705d
commit a35b56f09d
6 changed files with 626 additions and 440 deletions

View File

@@ -682,6 +682,7 @@ export async function createFabricObject({
content: element.content,
});
const hasRotation = typeof element.rotation === 'number' && element.rotation !== 0;
const baseConfig = {
left: element.x,
top: element.y,
@@ -689,6 +690,9 @@ export async function createFabricObject({
selectable: !readOnly,
hasBorders: !readOnly,
hasControls: !readOnly,
originX: hasRotation ? 'center' : 'left',
originY: hasRotation ? 'center' : 'top',
angle: element.rotation ?? 0,
} as FabricObjectWithId;
switch (element.type) {
@@ -961,6 +965,8 @@ export async function loadImageObject(
} else {
// Use direct Image constructor approach for better compatibility
const img = new Image();
// Avoid tainting canvas when reading remote QR images / logos
img.crossOrigin = 'anonymous';
img.onload = () => {
if (resolved) return;
console.debug('[Invites][Fabric] image loaded', {

View File

@@ -6,6 +6,7 @@ import { FabricRenderOptions, renderFabricLayout } from './DesignerCanvas';
const PDF_PAGE_SIZES: Record<string, { width: number; height: number }> = {
a4: { width: 595.28, height: 841.89 },
a5: { width: 419.53, height: 595.28 },
letter: { width: 612, height: 792 },
};