diff --git a/attached_assets/image_1760176035030.png b/attached_assets/image_1760176035030.png new file mode 100644 index 0000000..46606ae Binary files /dev/null and b/attached_assets/image_1760176035030.png differ diff --git a/server/routes.ts b/server/routes.ts index a5a52a6..5ec5613 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -556,24 +556,54 @@ export async function registerRoutes(app: Express): Promise { // Add ribbon overlay if (ribbon) { const ribbonSize = 150; - const positions: Record = { - top_left: { x: 0, y: 0, rotation: -45 }, - top_right: { x: width - ribbonSize, y: 0, rotation: 45 }, - bottom_left: { x: 0, y: height - ribbonSize, rotation: -135 }, - bottom_right: { x: width - ribbonSize, y: height - ribbonSize, rotation: 135 } - }; - - const pos = positions[ribbon.position] || positions.top_left; const color = ribbon.color === 'red' ? '#dc2626' : '#eab308'; const fontSize = ribbon.text.length <= 5 ? 22 : ribbon.text.length <= 8 ? 18 : ribbon.text.length <= 11 ? 15 : 12; + // Position mapping for each corner + const positions: Record = { + north_west: { + x: 0, + y: 0, + polygon: `0,0 ${ribbonSize},0 0,${ribbonSize}`, // Top-left triangle + textX: ribbonSize * 0.3, + textY: ribbonSize * 0.3, + textRotation: -45 + }, + north_east: { + x: width - ribbonSize, + y: 0, + polygon: `0,0 ${ribbonSize},0 ${ribbonSize},${ribbonSize}`, // Top-right triangle + textX: ribbonSize * 0.7, + textY: ribbonSize * 0.3, + textRotation: 45 + }, + south_west: { + x: 0, + y: height - ribbonSize, + polygon: `0,0 0,${ribbonSize} ${ribbonSize},${ribbonSize}`, // Bottom-left triangle + textX: ribbonSize * 0.3, + textY: ribbonSize * 0.7, + textRotation: -135 + }, + south_east: { + x: width - ribbonSize, + y: height - ribbonSize, + polygon: `${ribbonSize},0 0,${ribbonSize} ${ribbonSize},${ribbonSize}`, // Bottom-right triangle + textX: ribbonSize * 0.7, + textY: ribbonSize * 0.7, + textRotation: 135 + } + }; + + const pos = positions[ribbon.position] || positions.north_west; + const ribbonSvg = ` - - - + + + transform="rotate(${pos.textRotation}, ${pos.textX}, ${pos.textY})"> ${ribbon.text}