embroidery-qc-image 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -76
- package/dist/components/EmbroideryQCImage.d.ts.map +1 -1
- package/dist/index.esm.js +34 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/index.css +0 -14
- package/dist/index.esm.css +0 -14
package/README.md
CHANGED
|
@@ -1,73 +1,85 @@
|
|
|
1
|
-
#
|
|
1
|
+
# embroidery-qc-image
|
|
2
2
|
|
|
3
|
-
React component for rendering embroidery
|
|
3
|
+
React component for rendering embroidery qc image. This package allows you to display custom embroidered designs on product mockups with configurable text, icons, colors, and fonts.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install embroidery-qc-image
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
|
-
import React from
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
14
|
+
import React from "react";
|
|
15
|
+
import { EmbroideryQCImage } from "embroidery-qc-image";
|
|
16
|
+
import "embroidery-qc-image/dist/index.css";
|
|
17
|
+
|
|
18
|
+
// Example configuration
|
|
19
|
+
const exampleConfig = {
|
|
20
|
+
image_url:
|
|
21
|
+
"https://i.etsystatic.com/34592503/r/il/5d3e59/7253371633/il_fullxfull.7253371633_kgqr.jpg",
|
|
22
|
+
sides: [
|
|
23
|
+
{
|
|
24
|
+
print_side: "Chest",
|
|
25
|
+
postitions: [
|
|
26
|
+
{
|
|
27
|
+
type: "TEXT" as const,
|
|
28
|
+
text: "Brian <3",
|
|
29
|
+
text_shape: "No Curved",
|
|
30
|
+
color: null,
|
|
31
|
+
font: "Brittany",
|
|
32
|
+
floral_pattern: null,
|
|
33
|
+
character_colors: ["Pink (1148)", "Lavender (1032)"],
|
|
34
|
+
change_character_to_heart: true,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "TEXT" as const,
|
|
38
|
+
text: "EST. 2009",
|
|
39
|
+
text_shape: "No Curved",
|
|
40
|
+
color: "Light Denim (1133)",
|
|
41
|
+
font: "Arial",
|
|
42
|
+
character_colors: null,
|
|
43
|
+
floral_pattern: "P61",
|
|
44
|
+
change_character_to_heart: null,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: "ICON" as const,
|
|
48
|
+
icon: "Heart 1",
|
|
49
|
+
layer_colors: ["White (9)", "Red (1037)"],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
print_side: "Sleeve",
|
|
55
|
+
postitions: [
|
|
56
|
+
{
|
|
57
|
+
type: "TEXT" as const,
|
|
58
|
+
text: "Ayanna",
|
|
59
|
+
text_shape: "No Curved",
|
|
60
|
+
color: "Terra Cotta (1477)",
|
|
61
|
+
font: "Blackmate",
|
|
62
|
+
character_colors: null,
|
|
63
|
+
change_character_to_heart: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: "TEXT" as const,
|
|
67
|
+
text: "Ryan",
|
|
68
|
+
text_shape: "No Curved",
|
|
69
|
+
color: "Terra Cotta (1477)",
|
|
70
|
+
font: "Millie",
|
|
71
|
+
character_colors: null,
|
|
72
|
+
change_character_to_heart: true,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
};
|
|
67
78
|
|
|
79
|
+
const App: React.FC = () => {
|
|
68
80
|
return (
|
|
69
|
-
<div>
|
|
70
|
-
<
|
|
81
|
+
<div style={{ padding: "20px", maxWidth: "800px", margin: "0 auto" }}>
|
|
82
|
+
<EmbroideryQCImage config={exampleConfig} />
|
|
71
83
|
</div>
|
|
72
84
|
);
|
|
73
85
|
};
|
|
@@ -77,27 +89,27 @@ export default App;
|
|
|
77
89
|
|
|
78
90
|
## Props
|
|
79
91
|
|
|
80
|
-
###
|
|
92
|
+
### EmbroideryQCImage
|
|
81
93
|
|
|
82
94
|
| Prop | Type | Required | Description |
|
|
83
95
|
|------|------|----------|-------------|
|
|
84
|
-
| config | `
|
|
96
|
+
| config | `EmbroideryQCConfig` | Yes | Configuration object containing embroidery details |
|
|
85
97
|
| className | `string` | No | Additional CSS classes |
|
|
86
98
|
| style | `React.CSSProperties` | No | Inline styles |
|
|
87
99
|
|
|
88
100
|
## Configuration Structure
|
|
89
101
|
|
|
90
|
-
###
|
|
102
|
+
### EmbroideryQCConfig
|
|
91
103
|
|
|
92
104
|
```typescript
|
|
93
|
-
interface
|
|
94
|
-
image_url?: string; // Optional
|
|
105
|
+
interface EmbroideryQCConfig {
|
|
106
|
+
image_url?: string; // Optional mockup image URL (displayed at bottom-right)
|
|
95
107
|
sides: Side[]; // Array of sides to render
|
|
96
108
|
}
|
|
97
109
|
|
|
98
110
|
interface Side {
|
|
99
111
|
print_side: string; // e.g., "Chest", "Sleeve"
|
|
100
|
-
postitions: Position[]; // Array of positions to render
|
|
112
|
+
postitions: Position[]; // Array of positions to render (note: "postitions" spelling)
|
|
101
113
|
}
|
|
102
114
|
|
|
103
115
|
type Position = TextPosition | IconPosition;
|
|
@@ -105,12 +117,12 @@ type Position = TextPosition | IconPosition;
|
|
|
105
117
|
interface TextPosition {
|
|
106
118
|
type: 'TEXT';
|
|
107
119
|
text: string; // Text content
|
|
108
|
-
text_shape
|
|
109
|
-
color
|
|
110
|
-
font
|
|
111
|
-
character_colors
|
|
112
|
-
change_character_to_heart
|
|
113
|
-
floral_pattern?: string;
|
|
120
|
+
text_shape?: string | null; // Optional: "No Curved" or other shapes
|
|
121
|
+
color?: string | null; // Optional: Color for entire text
|
|
122
|
+
font?: string | null; // Optional: Font name
|
|
123
|
+
character_colors?: string[] | null; // Optional: Array of colors for alternating characters
|
|
124
|
+
change_character_to_heart?: boolean | null; // Optional: Replace <3 with ❤
|
|
125
|
+
floral_pattern?: string | null; // Optional: Floral pattern name
|
|
114
126
|
}
|
|
115
127
|
|
|
116
128
|
interface IconPosition {
|
|
@@ -122,23 +134,36 @@ interface IconPosition {
|
|
|
122
134
|
|
|
123
135
|
## Features
|
|
124
136
|
|
|
125
|
-
- ✅ Render custom text on mockup images
|
|
137
|
+
- ✅ Render custom text on mockup images with automatic text wrapping
|
|
126
138
|
- ✅ Support for icon placement with multi-layer colors
|
|
127
139
|
- ✅ Character-level color customization (alternating colors)
|
|
128
|
-
- ✅ Font loading from CDN
|
|
140
|
+
- ✅ Font loading from CDN with automatic fallback
|
|
129
141
|
- ✅ Multiple print sides (Chest, Sleeve, etc.)
|
|
130
|
-
- ✅ Floral pattern support
|
|
142
|
+
- ✅ Floral pattern support with inline display
|
|
131
143
|
- ✅ Heart emoji conversion (<3 → ❤)
|
|
132
|
-
- ✅
|
|
133
|
-
- ✅
|
|
144
|
+
- ✅ Automatic font scaling to fit canvas (only scales down, never up)
|
|
145
|
+
- ✅ Smart layout with uniform property grouping
|
|
146
|
+
- ✅ Color swatches displayed inline with labels
|
|
147
|
+
- ✅ Automatic word wrapping for long text
|
|
148
|
+
- ✅ Fixed canvas size (4200x4800)
|
|
149
|
+
- ✅ TypeScript support with full type definitions
|
|
134
150
|
|
|
135
151
|
## Supported Colors
|
|
136
152
|
|
|
137
|
-
The component automatically maps color names to hex values:
|
|
153
|
+
The component automatically maps color names to hex values for text rendering:
|
|
138
154
|
- `White (9)`, `Black (8)`, `Red (9)`, `Red (1307)`, `Blue (9)`, `Green (9)`
|
|
139
155
|
- `Forest Green (1397)`, `Brown (9)`, `Cream (9)`, `Beige (9)`
|
|
140
156
|
- `Navy (9)`, `Maroon (9)` and more...
|
|
141
157
|
|
|
158
|
+
## Thread Colors (Màu chỉ)
|
|
159
|
+
|
|
160
|
+
Thread color swatches are automatically loaded and displayed inline with color labels:
|
|
161
|
+
```
|
|
162
|
+
https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/thread-colors/{ColorName}.png
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The swatches are displayed next to "Màu chỉ:" labels, showing visual representation of the thread colors used in the embroidery design.
|
|
166
|
+
|
|
142
167
|
## Font Loading
|
|
143
168
|
|
|
144
169
|
Fonts are automatically loaded from:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbroideryQCImage.d.ts","sourceRoot":"","sources":["../../src/components/EmbroideryQCImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAY,MAAM,UAAU,CAAC;AAC5D,OAAO,yBAAyB,CAAC;AA2EjC,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"EmbroideryQCImage.d.ts","sourceRoot":"","sources":["../../src/components/EmbroideryQCImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAY,MAAM,UAAU,CAAC;AAC5D,OAAO,yBAAyB,CAAC;AA2EjC,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAo8BvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
|
|
4
|
+
function styleInject(css, ref) {
|
|
5
|
+
if ( ref === void 0 ) ref = {};
|
|
6
|
+
var insertAt = ref.insertAt;
|
|
7
|
+
|
|
8
|
+
if (typeof document === 'undefined') { return; }
|
|
9
|
+
|
|
10
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
11
|
+
var style = document.createElement('style');
|
|
12
|
+
style.type = 'text/css';
|
|
13
|
+
|
|
14
|
+
if (insertAt === 'top') {
|
|
15
|
+
if (head.firstChild) {
|
|
16
|
+
head.insertBefore(style, head.firstChild);
|
|
17
|
+
} else {
|
|
18
|
+
head.appendChild(style);
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
head.appendChild(style);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (style.styleSheet) {
|
|
25
|
+
style.styleSheet.cssText = css;
|
|
26
|
+
} else {
|
|
27
|
+
style.appendChild(document.createTextNode(css));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var css_248z = ".render-embroidery {\r\n display: inline-block;\r\n position: relative;\r\n width: 100%;\r\n max-width: 100%;\r\n}\r\n\r\n.render-embroidery-canvas {\r\n display: block;\r\n width: 100%;\r\n height: auto;\r\n image-rendering: high-quality;\r\n background: transparent;\r\n}\r\n";
|
|
32
|
+
styleInject(css_248z);
|
|
33
|
+
|
|
4
34
|
// Color mapping
|
|
5
35
|
const COLOR_MAP = {
|
|
6
36
|
"Army (1394)": "#4B5320",
|
|
@@ -471,7 +501,7 @@ const EmbroideryQCImage = ({ config, className = "", style = {}, }) => {
|
|
|
471
501
|
group.positions.forEach((position, index) => {
|
|
472
502
|
if (index === 0 && groupIndex !== 0)
|
|
473
503
|
currentY += 50 * scaleFactor;
|
|
474
|
-
const drawnHeight = renderText(ctx, position, padding, currentY, sideWidth,
|
|
504
|
+
const drawnHeight = renderText(ctx, position, padding, currentY, sideWidth, sideTextCounter, {
|
|
475
505
|
font: !sideUniform.font,
|
|
476
506
|
shape: !sideUniform.shape,
|
|
477
507
|
floral: !sideUniform.floral,
|
|
@@ -555,7 +585,7 @@ const EmbroideryQCImage = ({ config, className = "", style = {}, }) => {
|
|
|
555
585
|
ctx.restore();
|
|
556
586
|
return cursorY - y;
|
|
557
587
|
};
|
|
558
|
-
const renderText = (ctx, position, x, y, maxWidth,
|
|
588
|
+
const renderText = (ctx, position, x, y, maxWidth, displayIndex, showLabels, scaleFactor = 1) => {
|
|
559
589
|
ctx.save();
|
|
560
590
|
// Info labels
|
|
561
591
|
// Unified font sizing for labels and content (side title uses its own larger size)
|
|
@@ -579,7 +609,7 @@ const EmbroideryQCImage = ({ config, className = "", style = {}, }) => {
|
|
|
579
609
|
ctx.textBaseline = "top";
|
|
580
610
|
// Label for text line
|
|
581
611
|
const textLabel = `Text ${displayIndex}: `;
|
|
582
|
-
ctx.font =
|
|
612
|
+
ctx.font = `bold ${fontSize}px ${labelFontFamily}`;
|
|
583
613
|
const labelWidth = ctx.measureText(textLabel).width;
|
|
584
614
|
ctx.fillStyle = "#444444";
|
|
585
615
|
ctx.fillText(textLabel, x, currentYCursor);
|
|
@@ -746,7 +776,7 @@ const EmbroideryQCImage = ({ config, className = "", style = {}, }) => {
|
|
|
746
776
|
});
|
|
747
777
|
});
|
|
748
778
|
};
|
|
749
|
-
return (jsx("div", { className: `render-embroidery ${className}`, style: style, children: jsx("canvas", { ref: canvasRef, className: "render-embroidery-canvas" }) }));
|
|
779
|
+
return (jsx("div", { className: `render-embroidery${className ? ` ${className}` : ""}`, style: style, children: jsx("canvas", { ref: canvasRef, className: "render-embroidery-canvas" }) }));
|
|
750
780
|
};
|
|
751
781
|
|
|
752
782
|
export { EmbroideryQCImage };
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/components/EmbroideryQCImage.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from \"react\";\r\nimport { EmbroideryQCImageProps, Position } from \"../types\";\r\nimport \"./EmbroideryQCImage.css\";\r\n\r\n// Color mapping\r\nconst COLOR_MAP: Record<string, string> = {\r\n \"Army (1394)\": \"#4B5320\",\r\n Army: \"#4B5320\",\r\n \"Black (8)\": \"#000000\",\r\n Black: \"#000000\",\r\n \"Bubblegum (1309)\": \"#FFC1CC\",\r\n Bubblegum: \"#FFC1CC\",\r\n \"Carolina Blue (1274)\": \"#7BAFD4\",\r\n \"Carolina Blue\": \"#7BAFD4\",\r\n \"Celadon (1098)\": \"#ACE1AF\",\r\n Celadon: \"#ACE1AF\",\r\n \"Coffee Bean (1145)\": \"#6F4E37\",\r\n \"Coffee Bean\": \"#6F4E37\",\r\n \"Daffodil (1180)\": \"#FFFF31\",\r\n Daffodil: \"#FFFF31\",\r\n \"Dark Gray (1131)\": \"#A9A9A9\",\r\n \"Dark Gray\": \"#A9A9A9\",\r\n \"Doe Skin Beige (1344)\": \"#F5E6D3\",\r\n \"Doe Skin Beige\": \"#F5E6D3\",\r\n \"Dusty Blue (1373)\": \"#6699CC\",\r\n \"Dusty Blue\": \"#6699CC\",\r\n \"Forest Green (1397)\": \"#228B22\",\r\n \"Forest Green\": \"#228B22\",\r\n \"Gold (1425)\": \"#FFD700\",\r\n Gold: \"#FFD700\",\r\n \"Gray (1118)\": \"#808080\",\r\n Gray: \"#808080\",\r\n \"Ivory (1072)\": \"#FFFFF0\",\r\n Ivory: \"#FFFFF0\",\r\n \"Lavender (1032)\": \"#E6E6FA\",\r\n Lavender: \"#E6E6FA\",\r\n \"Light Denim (1133)\": \"#B0C4DE\",\r\n \"Light Denim\": \"#B0C4DE\",\r\n \"Light Salmon (1018)\": \"#FFA07A\",\r\n \"Light Salmon\": \"#FFA07A\",\r\n \"Maroon (1374)\": \"#800000\",\r\n Maroon: \"#800000\",\r\n \"Navy Blue (1044)\": \"#000080\",\r\n \"Navy Blue\": \"#000080\",\r\n \"Olive Green (1157)\": \"#556B2F\",\r\n \"Olive Green\": \"#556B2F\",\r\n \"Orange (1278)\": \"#FFA500\",\r\n Orange: \"#FFA500\",\r\n \"Peach Blush (1053)\": \"#FFCCCB\",\r\n \"Peach Blush\": \"#FFCCCB\",\r\n \"Pink (1148)\": \"#FFC0CB\",\r\n Pink: \"#FFC0CB\",\r\n \"Purple (1412)\": \"#800080\",\r\n Purple: \"#800080\",\r\n \"Red (1037)\": \"#FF0000\",\r\n Red: \"#FF0000\",\r\n \"Silver Sage (1396)\": \"#A8A8A8\",\r\n \"Silver Sage\": \"#A8A8A8\",\r\n \"Summer Sky (1432)\": \"#87CEEB\",\r\n \"Summer Sky\": \"#87CEEB\",\r\n \"Terra Cotta (1477)\": \"#E2725B\",\r\n \"Terra Cotta\": \"#E2725B\",\r\n \"Sand (1055)\": \"#F4A460\",\r\n Sand: \"#F4A460\",\r\n \"White (9)\": \"#FFFFFF\",\r\n White: \"#FFFFFF\",\r\n};\r\n\r\nconst FONT_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/fonts\";\r\nconst ICON_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/icons\";\r\nconst FLORAL_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/florals\";\r\nconst THREAD_COLOR_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/thread-colors\";\r\n\r\nconst EmbroideryQCImage: React.FC<EmbroideryQCImageProps> = ({\r\n config,\r\n className = \"\",\r\n style = {},\r\n}) => {\r\n const [canvasSize] = useState({ width: 4200, height: 4800 });\r\n const [loadedFonts, setLoadedFonts] = useState<Set<string>>(new Set());\r\n const [imagesLoaded, setImagesLoaded] = useState(0);\r\n const canvasRef = useRef<HTMLCanvasElement>(null);\r\n const imageRefs = useRef<Map<string, HTMLImageElement>>(new Map());\r\n\r\n // Load fonts\r\n useEffect(() => {\r\n const loadFonts = async () => {\r\n if (!config.sides || config.sides.length === 0) return;\r\n\r\n const fontsToLoad = new Set<string>();\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"TEXT\" && position.font) {\r\n fontsToLoad.add(position.font);\r\n }\r\n });\r\n });\r\n\r\n for (const fontName of fontsToLoad) {\r\n if (loadedFonts.has(fontName)) continue;\r\n\r\n try {\r\n await loadFont(fontName);\r\n setLoadedFonts((prev) => new Set(prev).add(fontName));\r\n } catch (error) {\r\n console.warn(`Could not load font ${fontName}:`, error);\r\n }\r\n }\r\n };\r\n\r\n loadFonts();\r\n }, [config.sides, loadedFonts]);\r\n\r\n // Load images\r\n useEffect(() => {\r\n const loadImages = async () => {\r\n if (!config.sides || config.sides.length === 0) return;\r\n\r\n // Load mockup image (not background). It will be drawn at bottom-right.\r\n if (config.image_url) {\r\n // Try with CORS first. If it fails (no CORS headers), retry without CORS\r\n const loadMockup = (useCors: boolean) => {\r\n const img = new Image();\r\n if (useCors) img.crossOrigin = \"anonymous\";\r\n img.onload = () => {\r\n imageRefs.current.set(\"mockup\", img);\r\n setImagesLoaded((prev) => prev + 1);\r\n };\r\n img.onerror = () => {\r\n if (useCors) {\r\n // Retry without CORS; canvas may become tainted on export\r\n loadMockup(false);\r\n }\r\n };\r\n img.src = config.image_url as string;\r\n };\r\n loadMockup(true);\r\n }\r\n\r\n // Load icons\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"ICON\") {\r\n const iconUrl = `${ICON_BASE_URL}/${position.icon}.png`;\r\n if (!imageRefs.current.has(iconUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = iconUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(iconUrl, img);\r\n }\r\n }\r\n\r\n if (position.type === \"TEXT\" && position.floral_pattern) {\r\n const floralUrl = `${FLORAL_BASE_URL}/${position.floral_pattern}.png`;\r\n if (!imageRefs.current.has(floralUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = floralUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(floralUrl, img);\r\n }\r\n }\r\n\r\n // Load thread color images for TEXT positions\r\n if (position.type === \"TEXT\") {\r\n // Load color image if position has color\r\n if (position.color) {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${position.color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n }\r\n\r\n // Load character color images\r\n if (\r\n position.character_colors &&\r\n position.character_colors.length > 0\r\n ) {\r\n position.character_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n });\r\n }\r\n }\r\n\r\n // Load thread color images for ICON positions\r\n if (position.type === \"ICON\" && position.layer_colors) {\r\n position.layer_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n });\r\n }\r\n });\r\n });\r\n };\r\n\r\n loadImages();\r\n }, [config]);\r\n\r\n // Render canvas\r\n useEffect(() => {\r\n const renderCanvas = () => {\r\n if (!canvasRef.current || !config.sides || config.sides.length === 0) {\r\n return;\r\n }\r\n\r\n const canvas = canvasRef.current;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) return;\r\n\r\n canvas.width = canvasSize.width;\r\n canvas.height = canvasSize.height;\r\n\r\n // Clear with white background\r\n ctx.fillStyle = \"#FFFFFF\";\r\n ctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\r\n // Collect floral images (for later drawing)\r\n const floralAssets: HTMLImageElement[] = [];\r\n const seenFlorals = new Set<string>();\r\n if (config.sides) {\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"TEXT\" && position.floral_pattern) {\r\n const floralUrl = `${FLORAL_BASE_URL}/${position.floral_pattern}.png`;\r\n if (!seenFlorals.has(floralUrl)) {\r\n const img = imageRefs.current.get(floralUrl);\r\n if (img && img.complete && img.naturalWidth > 0) {\r\n floralAssets.push(img);\r\n seenFlorals.add(floralUrl);\r\n }\r\n }\r\n }\r\n });\r\n });\r\n }\r\n\r\n // Helper function to draw mockup and florals\r\n const drawMockupAndFlorals = () => {\r\n const mockupImg = imageRefs.current.get(\"mockup\");\r\n const margin = 40; // small padding\r\n let mockupBox: { x: number; y: number; w: number; h: number } | null =\r\n null;\r\n if (mockupImg && mockupImg.complete && mockupImg.naturalWidth > 0) {\r\n const maxTargetWidth = Math.min(1800, canvas.width * 0.375);\r\n const maxTargetHeight = canvas.height * 0.375;\r\n const scale = Math.min(\r\n maxTargetWidth / mockupImg.naturalWidth,\r\n maxTargetHeight / mockupImg.naturalHeight\r\n );\r\n const targetWidth = Math.max(\r\n 1,\r\n Math.floor(mockupImg.naturalWidth * scale)\r\n );\r\n const targetHeight = Math.max(\r\n 1,\r\n Math.floor(mockupImg.naturalHeight * scale)\r\n );\r\n const targetX = canvas.width - margin - targetWidth;\r\n const targetY = canvas.height - margin - targetHeight;\r\n mockupBox = {\r\n x: targetX,\r\n y: targetY,\r\n w: targetWidth,\r\n h: targetHeight,\r\n };\r\n ctx.drawImage(mockupImg, targetX, targetY, targetWidth, targetHeight);\r\n }\r\n\r\n // Draw florals to the left of mockup\r\n if (mockupBox && floralAssets.length > 0) {\r\n const spacing = 300;\r\n const targetHeight = mockupBox.h;\r\n const floralFixedH = Math.min(900, targetHeight);\r\n let currentX = mockupBox.x - spacing;\r\n for (let i = floralAssets.length - 1; i >= 0; i--) {\r\n const img = floralAssets[i];\r\n const ratio = img.naturalWidth / Math.max(1, img.naturalHeight);\r\n const h = floralFixedH;\r\n const w = Math.max(1, Math.floor(h * ratio));\r\n currentX -= w;\r\n const y = mockupBox.y + (targetHeight - h);\r\n ctx.drawImage(img, currentX, y, w, h);\r\n currentX -= spacing;\r\n }\r\n }\r\n };\r\n\r\n // New approach: Draw images first (bottom layer), then text on top\r\n // This allows text to overlay images when needed\r\n\r\n // Pass 1: Measure actual height with original size (use offscreen canvas for measurement)\r\n const measureCanvas = document.createElement(\"canvas\");\r\n measureCanvas.width = canvas.width;\r\n measureCanvas.height = canvas.height;\r\n const measureCtx = measureCanvas.getContext(\"2d\");\r\n if (!measureCtx) return;\r\n\r\n // Set up measurement context\r\n measureCtx.font = ctx.font;\r\n measureCtx.textAlign = ctx.textAlign;\r\n measureCtx.textBaseline = ctx.textBaseline;\r\n\r\n let measureY = 40;\r\n const measureSpacing = 100;\r\n config.sides.forEach((side) => {\r\n const sideHeight = renderSide(\r\n measureCtx,\r\n side,\r\n measureY,\r\n canvas.width,\r\n 1\r\n );\r\n measureY += sideHeight + measureSpacing;\r\n });\r\n const totalMeasuredHeight = measureY; // Total height used\r\n\r\n // Calculate scale factor - only scale down when necessary\r\n // Keep original font sizes (no scale up) - font size is the maximum\r\n const topPadding = 40;\r\n // No bottom padding - content can go to bottom, mockup will overlay\r\n const targetContentHeight = canvas.height - topPadding;\r\n\r\n // Only scale down if content exceeds canvas height\r\n // Never scale up - preserve original font sizes\r\n let scaleFactor = 1;\r\n if (totalMeasuredHeight > targetContentHeight) {\r\n // Scale down to fit exactly\r\n scaleFactor = targetContentHeight / totalMeasuredHeight;\r\n scaleFactor = Math.max(0.5, scaleFactor); // Minimum scale to prevent tiny fonts\r\n }\r\n // If content fits, keep scaleFactor = 1 (original font sizes)\r\n\r\n // Draw mockup and florals first (bottom layer)\r\n drawMockupAndFlorals();\r\n\r\n // Draw content on top (top layer) - text will overlay images if needed\r\n let currentY = topPadding * scaleFactor;\r\n config.sides.forEach((side) => {\r\n const sideHeight = renderSide(\r\n ctx,\r\n side,\r\n currentY,\r\n canvas.width,\r\n scaleFactor\r\n );\r\n currentY += sideHeight + measureSpacing * scaleFactor;\r\n });\r\n };\r\n\r\n // Delay rendering to ensure fonts and images are loaded\r\n const timer = setTimeout(renderCanvas, 100);\r\n return () => clearTimeout(timer);\r\n }, [config, canvasSize, loadedFonts, imagesLoaded]);\r\n\r\n // Helper function to wrap and draw text with word wrapping\r\n // Returns: { height: number, lastLineWidth: number, lastLineY: number }\r\n const fillTextWrapped = (\r\n ctx: CanvasRenderingContext2D,\r\n text: string,\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n lineHeight: number\r\n ): { height: number; lastLineWidth: number; lastLineY: number } => {\r\n const words = text.split(\" \");\r\n const lines: string[] = [];\r\n let currentLine = words[0];\r\n\r\n for (let i = 1; i < words.length; i++) {\r\n const word = words[i];\r\n const testLine = currentLine + \" \" + word;\r\n const metrics = ctx.measureText(testLine);\r\n if (metrics.width > maxWidth && currentLine.length > 0) {\r\n lines.push(currentLine);\r\n currentLine = word;\r\n } else {\r\n currentLine = testLine;\r\n }\r\n }\r\n lines.push(currentLine);\r\n\r\n let currentY = y;\r\n lines.forEach((line) => {\r\n ctx.fillText(line, x, currentY);\r\n currentY += lineHeight;\r\n });\r\n\r\n const lastLineWidth = ctx.measureText(lines[lines.length - 1]).width;\r\n const lastLineY = y + (lines.length - 1) * lineHeight;\r\n\r\n return {\r\n height: lines.length * lineHeight,\r\n lastLineWidth,\r\n lastLineY,\r\n };\r\n };\r\n\r\n // Helper to wrap and draw multi-color text (for character_colors)\r\n const fillTextWrappedMultiColor = (\r\n ctx: CanvasRenderingContext2D,\r\n text: string,\r\n colors: string[],\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n lineHeight: number\r\n ): number => {\r\n const words = text.split(\" \");\r\n const lines: string[] = [];\r\n const lineStartIndices: number[] = [0];\r\n let currentLine = words[0];\r\n let currentCharIndex = words[0].length;\r\n\r\n for (let i = 1; i < words.length; i++) {\r\n const word = words[i];\r\n const testLine = currentLine + \" \" + word;\r\n const metrics = ctx.measureText(testLine);\r\n if (metrics.width > maxWidth && currentLine.length > 0) {\r\n lines.push(currentLine);\r\n lineStartIndices.push(currentCharIndex + 1); // +1 for space\r\n currentLine = word;\r\n currentCharIndex += word.length + 1;\r\n } else {\r\n currentLine = testLine;\r\n currentCharIndex += word.length + 1;\r\n }\r\n }\r\n lines.push(currentLine);\r\n\r\n let currentY = y;\r\n lines.forEach((line, lineIdx) => {\r\n let currentX = x;\r\n const startCharIdx = lineIdx > 0 ? lineStartIndices[lineIdx] : 0;\r\n for (let i = 0; i < line.length; i++) {\r\n const char = line[i];\r\n const globalCharIdx = startCharIdx + i;\r\n const colorIndex = globalCharIdx % colors.length;\r\n const color = colors[colorIndex];\r\n ctx.fillStyle = COLOR_MAP[color] || \"#000000\";\r\n ctx.fillText(char, currentX, currentY);\r\n currentX += ctx.measureText(char).width;\r\n }\r\n currentY += lineHeight;\r\n });\r\n\r\n return lines.length * lineHeight;\r\n };\r\n\r\n const renderSide = (\r\n ctx: CanvasRenderingContext2D,\r\n side: any,\r\n startY: number,\r\n width: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n let currentY = startY;\r\n const padding = 40 * scaleFactor;\r\n const sideWidth = width - 2 * padding;\r\n const sectionHeight = 200 * scaleFactor;\r\n\r\n // No background section anymore - just white background\r\n\r\n // Group positions by common properties for optimization\r\n const textGroups: Array<{\r\n positions: Array<Position & { type: \"TEXT\" }>;\r\n properties: any;\r\n }> = [];\r\n let currentGroup: Array<Position & { type: \"TEXT\" }> | null = null;\r\n let currentProps: any = null;\r\n\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"TEXT\") {\r\n if (\r\n !currentGroup ||\r\n currentProps.font !== position.font ||\r\n currentProps.text_shape !== position.text_shape ||\r\n currentProps.color !== position.color ||\r\n currentProps.character_colors?.join(\",\") !==\r\n position.character_colors?.join(\",\")\r\n ) {\r\n // Start new group\r\n if (currentGroup) {\r\n textGroups.push({\r\n positions: currentGroup,\r\n properties: currentProps,\r\n });\r\n }\r\n currentGroup = [position];\r\n currentProps = {\r\n font: position.font,\r\n text_shape: position.text_shape,\r\n color: position.color,\r\n character_colors: position.character_colors,\r\n };\r\n } else {\r\n currentGroup.push(position);\r\n }\r\n }\r\n });\r\n\r\n if (currentGroup) {\r\n textGroups.push({ positions: currentGroup, properties: currentProps });\r\n }\r\n\r\n // Draw side header\r\n ctx.save();\r\n const headerFontSize = 200 * scaleFactor;\r\n ctx.font = `bold ${headerFontSize}px Times New Roman`;\r\n ctx.fillStyle = \"#000000\";\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n const headerResult = fillTextWrapped(\r\n ctx,\r\n side.print_side.toUpperCase(),\r\n padding,\r\n currentY,\r\n sideWidth,\r\n headerFontSize\r\n );\r\n currentY += headerResult.height + 50 * scaleFactor;\r\n ctx.restore();\r\n\r\n // Compute side-level uniform properties across all TEXT positions\r\n const allTextPositions: Array<Position & { type: \"TEXT\" }> = [];\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"TEXT\") allTextPositions.push(position as any);\r\n });\r\n\r\n const sideFonts = new Set(allTextPositions.map((p) => (p as any).font));\r\n const sideShapes = new Set(\r\n allTextPositions.map((p) => (p as any).text_shape)\r\n );\r\n const sideFlorals = new Set(\r\n allTextPositions.map((p) => (p as any).floral_pattern ?? \"None\")\r\n );\r\n const colorKeyOf = (p: any) =>\r\n p.character_colors && p.character_colors.length > 0\r\n ? p.character_colors.join(\",\")\r\n : p.color ?? \"None\";\r\n const sideColors = new Set(allTextPositions.map((p) => colorKeyOf(p)));\r\n\r\n const sideUniform = {\r\n font: sideFonts.size === 1,\r\n shape: sideShapes.size === 1,\r\n floral: sideFlorals.size === 1,\r\n color: sideColors.size === 1,\r\n };\r\n\r\n // Render side-level labels once for uniform properties\r\n currentY += renderSideUniformLabels(\r\n ctx,\r\n {\r\n font: sideUniform.font ? [...sideFonts][0] : null,\r\n shape: sideUniform.shape ? [...sideShapes][0] : null,\r\n floral: sideUniform.floral ? [...sideFlorals][0] : null,\r\n color: sideUniform.color ? [...sideColors][0] : null,\r\n },\r\n padding,\r\n currentY,\r\n sideWidth,\r\n scaleFactor\r\n );\r\n\r\n // Render text groups first\r\n let sideTextCounter = 1;\r\n textGroups.forEach((group, groupIndex) => {\r\n group.positions.forEach((position, index) => {\r\n if (index === 0 && groupIndex !== 0) currentY += 50 * scaleFactor;\r\n const drawnHeight = renderText(\r\n ctx,\r\n position,\r\n padding,\r\n currentY,\r\n sideWidth,\r\n group.properties,\r\n group.positions.length,\r\n index,\r\n sideTextCounter,\r\n {\r\n font: !sideUniform.font,\r\n shape: !sideUniform.shape,\r\n floral: !sideUniform.floral,\r\n color: !sideUniform.color,\r\n },\r\n scaleFactor\r\n );\r\n sideTextCounter += 1;\r\n // add padding only if something was actually drawn\r\n if (drawnHeight > 0) {\r\n currentY += drawnHeight + 40 * scaleFactor;\r\n }\r\n });\r\n });\r\n\r\n // Render ICON titles/values (no images here)\r\n currentY += 30 * scaleFactor; // minimal spacing before icon labels\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"ICON\") {\r\n currentY += renderIconLabels(\r\n ctx,\r\n position as any,\r\n padding,\r\n currentY,\r\n sideWidth,\r\n scaleFactor\r\n );\r\n currentY += 10 * scaleFactor;\r\n }\r\n });\r\n\r\n return Math.max(currentY - startY, sectionHeight);\r\n };\r\n\r\n const renderSideUniformLabels = (\r\n ctx: CanvasRenderingContext2D,\r\n values: {\r\n font: string | null;\r\n shape: string | null;\r\n floral: string | null;\r\n color: string | null;\r\n },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n const labelFontFamily = \"Arial\";\r\n const fontSize = 180 * scaleFactor;\r\n const lineGap = 20 * scaleFactor;\r\n ctx.save();\r\n ctx.font = `${fontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let cursorY = y;\r\n let rendered = 0;\r\n if (values.font) {\r\n const fontText = `Font: ${values.font}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n fontText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.shape && values.shape !== \"None\") {\r\n const shapeText = `Kiểu chữ: ${values.shape}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n shapeText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.color && values.color !== \"None\") {\r\n const colorText = `Màu chỉ: ${values.color}`;\r\n // Reserve space for swatches (estimate: max 5 swatches × 200px each = 1000px)\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const result = fillTextWrapped(\r\n ctx,\r\n colorText,\r\n x,\r\n cursorY,\r\n textMaxWidth,\r\n fontSize + lineGap\r\n );\r\n // Draw swatches inline for side-level color, preserving aspect ratio; 75% of previous size\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(fontSize * 2.025);\r\n let swatchX = x + Math.ceil(result.lastLineWidth) + 100 * scaleFactor;\r\n const swatchY = result.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n const colorTokens = values.color.includes(\",\")\r\n ? values.color.split(\",\").map((s) => s.trim())\r\n : [values.color];\r\n colorTokens.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor;\r\n }\r\n });\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.floral && values.floral !== \"None\") {\r\n const floralText = `Mẫu hoa: ${values.floral}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n floralText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (rendered > 0) cursorY += 50 * scaleFactor; // extra gap before first text line\r\n\r\n ctx.restore();\r\n return cursorY - y;\r\n };\r\n\r\n const renderText = (\r\n ctx: CanvasRenderingContext2D,\r\n position: Position & { type: \"TEXT\" },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n properties: any,\r\n totalTexts: number,\r\n textIndex: number,\r\n displayIndex: number,\r\n showLabels: {\r\n font: boolean;\r\n shape: boolean;\r\n floral: boolean;\r\n color: boolean;\r\n },\r\n scaleFactor: number = 1\r\n ): number => {\r\n ctx.save();\r\n\r\n // Info labels\r\n // Unified font sizing for labels and content (side title uses its own larger size)\r\n const infoLineGap = 30 * scaleFactor;\r\n const labelFontFamily = \"Arial\";\r\n // Use a unified content font size for both labels and text content\r\n const fontSize = 180 * scaleFactor;\r\n const infoFontSize = fontSize;\r\n ctx.font = `${infoFontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let currentYCursor = y;\r\n let drawnHeight = 0; // accumulate only when something is actually drawn\r\n\r\n // Text value with unified font size\r\n let displayText = position.text;\r\n if (position.change_character_to_heart && displayText.includes(\"<3\")) {\r\n displayText = displayText.replace(/<3/g, \"❤\");\r\n }\r\n\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n\r\n // Label for text line\r\n const textLabel = `Text ${displayIndex}: `;\r\n ctx.font = `${fontSize}px ${labelFontFamily}`;\r\n const labelWidth = ctx.measureText(textLabel).width;\r\n ctx.fillStyle = \"#444444\";\r\n ctx.fillText(textLabel, x, currentYCursor);\r\n\r\n // Calculate available width for text content\r\n const textMaxWidth = maxWidth - labelWidth;\r\n\r\n // Handle character_colors (alternating colors)\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n // Switch to content font\r\n ctx.font = `${fontSize}px ${position.font}`;\r\n const textHeight = fillTextWrappedMultiColor(\r\n ctx,\r\n displayText,\r\n position.character_colors,\r\n x + labelWidth,\r\n currentYCursor,\r\n textMaxWidth,\r\n fontSize\r\n );\r\n currentYCursor += textHeight;\r\n drawnHeight += textHeight;\r\n } else {\r\n // No color specified\r\n // Draw text in content font, black (non-bold)\r\n ctx.font = `${fontSize}px ${position.font}`;\r\n ctx.fillStyle = COLOR_MAP[position.color ?? \"None\"] || \"#000000\";\r\n const textResult = fillTextWrapped(\r\n ctx,\r\n displayText,\r\n x + labelWidth,\r\n currentYCursor,\r\n textMaxWidth,\r\n fontSize\r\n );\r\n currentYCursor += textResult.height;\r\n drawnHeight += textResult.height;\r\n }\r\n\r\n // After text, print Kiểu chữ (when not uniform), then Font and Color as needed\r\n currentYCursor += infoLineGap;\r\n ctx.font = `${infoFontSize}px ${labelFontFamily}`;\r\n ctx.fillStyle = \"#444444\";\r\n if (showLabels.shape && position.text_shape) {\r\n const shapeLabelAfter = `Kiểu chữ: ${position.text_shape}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n shapeLabelAfter,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n if (showLabels.font && position.font) {\r\n const fontLabel = `Font: ${position.font}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n fontLabel,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n if (showLabels.color) {\r\n let colorLabelValue = \"None\";\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n colorLabelValue = position.character_colors.join(\", \");\r\n } else if (position.color) {\r\n colorLabelValue = position.color;\r\n }\r\n if (colorLabelValue !== \"None\") {\r\n const colorLabel = `Màu chỉ: ${colorLabelValue}`;\r\n // Reserve space for swatches\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const result = fillTextWrapped(\r\n ctx,\r\n colorLabel,\r\n x,\r\n currentYCursor,\r\n textMaxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n\r\n // Draw color swatch images inline with Color label for TEXT, preserve aspect ratio; 75% of previous size\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(infoFontSize * 2.025);\r\n let swatchX = x + Math.ceil(result.lastLineWidth) + 100 * scaleFactor; // spacing after text\r\n const swatchY =\r\n result.lastLineY + Math.floor(infoFontSize / 2 - swatchH / 2);\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n position.character_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor;\r\n }\r\n });\r\n } else if (position.color) {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${position.color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n }\r\n }\r\n\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n }\r\n\r\n // Show floral label after color block when not uniform at side level\r\n if (showLabels.floral && position.floral_pattern) {\r\n const floralText = `Mẫu hoa: ${position.floral_pattern}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n floralText,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n\r\n // (Floral per-position label is printed above the text when needed; avoid duplicate after text)\r\n\r\n ctx.restore();\r\n return drawnHeight;\r\n };\r\n\r\n const renderIconLabels = (\r\n ctx: CanvasRenderingContext2D,\r\n position: Position & { type: \"ICON\" },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n const labelFontFamily = \"Arial\";\r\n const fontSize = 180 * scaleFactor;\r\n const lineGap = 30 * scaleFactor;\r\n ctx.save();\r\n ctx.font = `${fontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let cursorY = y;\r\n const iconText = `Icon: ${position.icon}`;\r\n const iconResult = fillTextWrapped(\r\n ctx,\r\n iconText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n // draw icon image inline with text, preserve aspect ratio; match line height\r\n const iconUrl = `${ICON_BASE_URL}/${position.icon}.png`;\r\n {\r\n const img = imageRefs.current.get(iconUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const swatchH = fontSize;\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n // Put icon on last line of wrapped text\r\n const iconX =\r\n x + Math.ceil(iconResult.lastLineWidth) + 100 * scaleFactor;\r\n const iconY =\r\n iconResult.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n ctx.drawImage(img, iconX, iconY, swatchW, swatchH);\r\n }\r\n }\r\n cursorY += iconResult.height;\r\n\r\n // Draw color line only when there are layer colors\r\n if (position.layer_colors && position.layer_colors.length > 0) {\r\n const colorLabelValue = position.layer_colors.join(\", \");\r\n const colorText = `Màu chỉ: ${colorLabelValue}`;\r\n // Reserve space for swatches\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const colorResult = fillTextWrapped(\r\n ctx,\r\n colorText,\r\n x,\r\n cursorY,\r\n textMaxWidth,\r\n fontSize + lineGap\r\n );\r\n\r\n // Draw color swatch images (only for icon)\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(fontSize * 2.025); // 75% of previous size\r\n let swatchX =\r\n x + Math.ceil(colorResult.lastLineWidth) + 100 * scaleFactor; // spacing after text\r\n const swatchY =\r\n colorResult.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n position.layer_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor; // spacing between swatches\r\n }\r\n });\r\n cursorY += colorResult.height;\r\n }\r\n\r\n ctx.restore();\r\n return cursorY - y;\r\n };\r\n\r\n const loadFont = (fontName: string): Promise<void> => {\r\n return new Promise((resolve, reject) => {\r\n // Try to load from CDN\r\n const fontUrl = `${FONT_BASE_URL}/${fontName}.woff2`;\r\n const fontFace = new FontFace(fontName, `url(${fontUrl})`);\r\n\r\n fontFace\r\n .load()\r\n .then((loadedFont) => {\r\n document.fonts.add(loadedFont);\r\n resolve();\r\n })\r\n .catch(() => {\r\n // Font loading failed, will use fallback\r\n console.warn(`Could not load font ${fontName} from CDN`);\r\n resolve(); // Still resolve to not block rendering\r\n });\r\n });\r\n };\r\n\r\n return (\r\n <div className={`render-embroidery ${className}`} style={style}>\r\n <canvas ref={canvasRef} className=\"render-embroidery-canvas\" />\r\n </div>\r\n );\r\n};\r\n\r\nexport default EmbroideryQCImage;\r\n"],"names":["_jsx"],"mappings":";;;AAIA;AACA,MAAM,SAAS,GAA2B;AACxC,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,WAAW,EAAE,SAAS;AACtB,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,kBAAkB,EAAE,SAAS;AAC7B,IAAA,SAAS,EAAE,SAAS;AACpB,IAAA,sBAAsB,EAAE,SAAS;AACjC,IAAA,eAAe,EAAE,SAAS;AAC1B,IAAA,gBAAgB,EAAE,SAAS;AAC3B,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,oBAAoB,EAAE,SAAS;AAC/B,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,iBAAiB,EAAE,SAAS;AAC5B,IAAA,QAAQ,EAAE,SAAS;AACnB,IAAA,kBAAkB,EAAE,SAAS;AAC7B,IAAA,WAAW,EAAE,SAAS;AACtB,IAAA,uBAAuB,EAAE,SAAS;AAClC,IAAA,gBAAgB,EAAE,SAAS;AAC3B,IAAA,mBAAmB,EAAE,SAAS;AAC9B,IAAA,YAAY,EAAE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,QAAQ;YACpD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAA,IAAA,EAAO,OAAO,CAAA,CAAA,CAAG,CAAC;YAE1D;AACG,iBAAA,IAAI;AACJ,iBAAA,IAAI,CAAC,CAAC,UAAU,KAAI;AACnB,gBAAA,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC;AAC9B,gBAAA,OAAO,EAAE;AACX,YAAA,CAAC;iBACA,KAAK,CAAC,MAAK;;AAEV,gBAAA,OAAO,CAAC,IAAI,CAAC,uBAAuB,QAAQ,CAAA,SAAA,CAAW,CAAC;gBACxD,OAAO,EAAE,CAAC;AACZ,YAAA,CAAC,CAAC;AACN,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC;IAED,QACEA,aAAK,SAAS,EAAE,qBAAqB,SAAS,CAAA,CAAE,EAAE,KAAK,EAAE,KAAK,YAC5DA,GAAA,CAAA,QAAA,EAAA,EAAQ,GAAG,EAAE,SAAS,EAAE,SAAS,EAAC,0BAA0B,EAAA,CAAG,EAAA,CAC3D;AAEV;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/components/EmbroideryQCImage.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React, { useState, useEffect, useRef } from \"react\";\r\nimport { EmbroideryQCImageProps, Position } from \"../types\";\r\nimport \"./EmbroideryQCImage.css\";\r\n\r\n// Color mapping\r\nconst COLOR_MAP: Record<string, string> = {\r\n \"Army (1394)\": \"#4B5320\",\r\n Army: \"#4B5320\",\r\n \"Black (8)\": \"#000000\",\r\n Black: \"#000000\",\r\n \"Bubblegum (1309)\": \"#FFC1CC\",\r\n Bubblegum: \"#FFC1CC\",\r\n \"Carolina Blue (1274)\": \"#7BAFD4\",\r\n \"Carolina Blue\": \"#7BAFD4\",\r\n \"Celadon (1098)\": \"#ACE1AF\",\r\n Celadon: \"#ACE1AF\",\r\n \"Coffee Bean (1145)\": \"#6F4E37\",\r\n \"Coffee Bean\": \"#6F4E37\",\r\n \"Daffodil (1180)\": \"#FFFF31\",\r\n Daffodil: \"#FFFF31\",\r\n \"Dark Gray (1131)\": \"#A9A9A9\",\r\n \"Dark Gray\": \"#A9A9A9\",\r\n \"Doe Skin Beige (1344)\": \"#F5E6D3\",\r\n \"Doe Skin Beige\": \"#F5E6D3\",\r\n \"Dusty Blue (1373)\": \"#6699CC\",\r\n \"Dusty Blue\": \"#6699CC\",\r\n \"Forest Green (1397)\": \"#228B22\",\r\n \"Forest Green\": \"#228B22\",\r\n \"Gold (1425)\": \"#FFD700\",\r\n Gold: \"#FFD700\",\r\n \"Gray (1118)\": \"#808080\",\r\n Gray: \"#808080\",\r\n \"Ivory (1072)\": \"#FFFFF0\",\r\n Ivory: \"#FFFFF0\",\r\n \"Lavender (1032)\": \"#E6E6FA\",\r\n Lavender: \"#E6E6FA\",\r\n \"Light Denim (1133)\": \"#B0C4DE\",\r\n \"Light Denim\": \"#B0C4DE\",\r\n \"Light Salmon (1018)\": \"#FFA07A\",\r\n \"Light Salmon\": \"#FFA07A\",\r\n \"Maroon (1374)\": \"#800000\",\r\n Maroon: \"#800000\",\r\n \"Navy Blue (1044)\": \"#000080\",\r\n \"Navy Blue\": \"#000080\",\r\n \"Olive Green (1157)\": \"#556B2F\",\r\n \"Olive Green\": \"#556B2F\",\r\n \"Orange (1278)\": \"#FFA500\",\r\n Orange: \"#FFA500\",\r\n \"Peach Blush (1053)\": \"#FFCCCB\",\r\n \"Peach Blush\": \"#FFCCCB\",\r\n \"Pink (1148)\": \"#FFC0CB\",\r\n Pink: \"#FFC0CB\",\r\n \"Purple (1412)\": \"#800080\",\r\n Purple: \"#800080\",\r\n \"Red (1037)\": \"#FF0000\",\r\n Red: \"#FF0000\",\r\n \"Silver Sage (1396)\": \"#A8A8A8\",\r\n \"Silver Sage\": \"#A8A8A8\",\r\n \"Summer Sky (1432)\": \"#87CEEB\",\r\n \"Summer Sky\": \"#87CEEB\",\r\n \"Terra Cotta (1477)\": \"#E2725B\",\r\n \"Terra Cotta\": \"#E2725B\",\r\n \"Sand (1055)\": \"#F4A460\",\r\n Sand: \"#F4A460\",\r\n \"White (9)\": \"#FFFFFF\",\r\n White: \"#FFFFFF\",\r\n};\r\n\r\nconst FONT_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/fonts\";\r\nconst ICON_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/icons\";\r\nconst FLORAL_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/florals\";\r\nconst THREAD_COLOR_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/thread-colors\";\r\n\r\nconst EmbroideryQCImage: React.FC<EmbroideryQCImageProps> = ({\r\n config,\r\n className = \"\",\r\n style = {},\r\n}) => {\r\n const [canvasSize] = useState({ width: 4200, height: 4800 });\r\n const [loadedFonts, setLoadedFonts] = useState<Set<string>>(new Set());\r\n const [imagesLoaded, setImagesLoaded] = useState(0);\r\n const canvasRef = useRef<HTMLCanvasElement>(null);\r\n const imageRefs = useRef<Map<string, HTMLImageElement>>(new Map());\r\n\r\n // Load fonts\r\n useEffect(() => {\r\n const loadFonts = async () => {\r\n if (!config.sides || config.sides.length === 0) return;\r\n\r\n const fontsToLoad = new Set<string>();\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"TEXT\" && position.font) {\r\n fontsToLoad.add(position.font);\r\n }\r\n });\r\n });\r\n\r\n for (const fontName of fontsToLoad) {\r\n if (loadedFonts.has(fontName)) continue;\r\n\r\n try {\r\n await loadFont(fontName);\r\n setLoadedFonts((prev) => new Set(prev).add(fontName));\r\n } catch (error) {\r\n console.warn(`Could not load font ${fontName}:`, error);\r\n }\r\n }\r\n };\r\n\r\n loadFonts();\r\n }, [config.sides, loadedFonts]);\r\n\r\n // Load images\r\n useEffect(() => {\r\n const loadImages = async () => {\r\n if (!config.sides || config.sides.length === 0) return;\r\n\r\n // Load mockup image (not background). It will be drawn at bottom-right.\r\n if (config.image_url) {\r\n // Try with CORS first. If it fails (no CORS headers), retry without CORS\r\n const loadMockup = (useCors: boolean) => {\r\n const img = new Image();\r\n if (useCors) img.crossOrigin = \"anonymous\";\r\n img.onload = () => {\r\n imageRefs.current.set(\"mockup\", img);\r\n setImagesLoaded((prev) => prev + 1);\r\n };\r\n img.onerror = () => {\r\n if (useCors) {\r\n // Retry without CORS; canvas may become tainted on export\r\n loadMockup(false);\r\n }\r\n };\r\n img.src = config.image_url as string;\r\n };\r\n loadMockup(true);\r\n }\r\n\r\n // Load icons\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"ICON\") {\r\n const iconUrl = `${ICON_BASE_URL}/${position.icon}.png`;\r\n if (!imageRefs.current.has(iconUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = iconUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(iconUrl, img);\r\n }\r\n }\r\n\r\n if (position.type === \"TEXT\" && position.floral_pattern) {\r\n const floralUrl = `${FLORAL_BASE_URL}/${position.floral_pattern}.png`;\r\n if (!imageRefs.current.has(floralUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = floralUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(floralUrl, img);\r\n }\r\n }\r\n\r\n // Load thread color images for TEXT positions\r\n if (position.type === \"TEXT\") {\r\n // Load color image if position has color\r\n if (position.color) {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${position.color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n }\r\n\r\n // Load character color images\r\n if (\r\n position.character_colors &&\r\n position.character_colors.length > 0\r\n ) {\r\n position.character_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n });\r\n }\r\n }\r\n\r\n // Load thread color images for ICON positions\r\n if (position.type === \"ICON\" && position.layer_colors) {\r\n position.layer_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n });\r\n }\r\n });\r\n });\r\n };\r\n\r\n loadImages();\r\n }, [config]);\r\n\r\n // Render canvas\r\n useEffect(() => {\r\n const renderCanvas = () => {\r\n if (!canvasRef.current || !config.sides || config.sides.length === 0) {\r\n return;\r\n }\r\n\r\n const canvas = canvasRef.current;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) return;\r\n\r\n canvas.width = canvasSize.width;\r\n canvas.height = canvasSize.height;\r\n\r\n // Clear with white background\r\n ctx.fillStyle = \"#FFFFFF\";\r\n ctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\r\n // Collect floral images (for later drawing)\r\n const floralAssets: HTMLImageElement[] = [];\r\n const seenFlorals = new Set<string>();\r\n if (config.sides) {\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"TEXT\" && position.floral_pattern) {\r\n const floralUrl = `${FLORAL_BASE_URL}/${position.floral_pattern}.png`;\r\n if (!seenFlorals.has(floralUrl)) {\r\n const img = imageRefs.current.get(floralUrl);\r\n if (img && img.complete && img.naturalWidth > 0) {\r\n floralAssets.push(img);\r\n seenFlorals.add(floralUrl);\r\n }\r\n }\r\n }\r\n });\r\n });\r\n }\r\n\r\n // Helper function to draw mockup and florals\r\n const drawMockupAndFlorals = () => {\r\n const mockupImg = imageRefs.current.get(\"mockup\");\r\n const margin = 40; // small padding\r\n let mockupBox: { x: number; y: number; w: number; h: number } | null =\r\n null;\r\n if (mockupImg && mockupImg.complete && mockupImg.naturalWidth > 0) {\r\n const maxTargetWidth = Math.min(1800, canvas.width * 0.375);\r\n const maxTargetHeight = canvas.height * 0.375;\r\n const scale = Math.min(\r\n maxTargetWidth / mockupImg.naturalWidth,\r\n maxTargetHeight / mockupImg.naturalHeight\r\n );\r\n const targetWidth = Math.max(\r\n 1,\r\n Math.floor(mockupImg.naturalWidth * scale)\r\n );\r\n const targetHeight = Math.max(\r\n 1,\r\n Math.floor(mockupImg.naturalHeight * scale)\r\n );\r\n const targetX = canvas.width - margin - targetWidth;\r\n const targetY = canvas.height - margin - targetHeight;\r\n mockupBox = {\r\n x: targetX,\r\n y: targetY,\r\n w: targetWidth,\r\n h: targetHeight,\r\n };\r\n ctx.drawImage(mockupImg, targetX, targetY, targetWidth, targetHeight);\r\n }\r\n\r\n // Draw florals to the left of mockup\r\n if (mockupBox && floralAssets.length > 0) {\r\n const spacing = 300;\r\n const targetHeight = mockupBox.h;\r\n const floralFixedH = Math.min(900, targetHeight);\r\n let currentX = mockupBox.x - spacing;\r\n for (let i = floralAssets.length - 1; i >= 0; i--) {\r\n const img = floralAssets[i];\r\n const ratio = img.naturalWidth / Math.max(1, img.naturalHeight);\r\n const h = floralFixedH;\r\n const w = Math.max(1, Math.floor(h * ratio));\r\n currentX -= w;\r\n const y = mockupBox.y + (targetHeight - h);\r\n ctx.drawImage(img, currentX, y, w, h);\r\n currentX -= spacing;\r\n }\r\n }\r\n };\r\n\r\n // New approach: Draw images first (bottom layer), then text on top\r\n // This allows text to overlay images when needed\r\n\r\n // Pass 1: Measure actual height with original size (use offscreen canvas for measurement)\r\n const measureCanvas = document.createElement(\"canvas\");\r\n measureCanvas.width = canvas.width;\r\n measureCanvas.height = canvas.height;\r\n const measureCtx = measureCanvas.getContext(\"2d\");\r\n if (!measureCtx) return;\r\n\r\n // Set up measurement context\r\n measureCtx.font = ctx.font;\r\n measureCtx.textAlign = ctx.textAlign;\r\n measureCtx.textBaseline = ctx.textBaseline;\r\n\r\n let measureY = 40;\r\n const measureSpacing = 100;\r\n config.sides.forEach((side) => {\r\n const sideHeight = renderSide(\r\n measureCtx,\r\n side,\r\n measureY,\r\n canvas.width,\r\n 1\r\n );\r\n measureY += sideHeight + measureSpacing;\r\n });\r\n const totalMeasuredHeight = measureY; // Total height used\r\n\r\n // Calculate scale factor - only scale down when necessary\r\n // Keep original font sizes (no scale up) - font size is the maximum\r\n const topPadding = 40;\r\n // No bottom padding - content can go to bottom, mockup will overlay\r\n const targetContentHeight = canvas.height - topPadding;\r\n\r\n // Only scale down if content exceeds canvas height\r\n // Never scale up - preserve original font sizes\r\n let scaleFactor = 1;\r\n if (totalMeasuredHeight > targetContentHeight) {\r\n // Scale down to fit exactly\r\n scaleFactor = targetContentHeight / totalMeasuredHeight;\r\n scaleFactor = Math.max(0.5, scaleFactor); // Minimum scale to prevent tiny fonts\r\n }\r\n // If content fits, keep scaleFactor = 1 (original font sizes)\r\n\r\n // Draw mockup and florals first (bottom layer)\r\n drawMockupAndFlorals();\r\n\r\n // Draw content on top (top layer) - text will overlay images if needed\r\n let currentY = topPadding * scaleFactor;\r\n config.sides.forEach((side) => {\r\n const sideHeight = renderSide(\r\n ctx,\r\n side,\r\n currentY,\r\n canvas.width,\r\n scaleFactor\r\n );\r\n currentY += sideHeight + measureSpacing * scaleFactor;\r\n });\r\n };\r\n\r\n // Delay rendering to ensure fonts and images are loaded\r\n const timer = setTimeout(renderCanvas, 100);\r\n return () => clearTimeout(timer);\r\n }, [config, canvasSize, loadedFonts, imagesLoaded]);\r\n\r\n // Helper function to wrap and draw text with word wrapping\r\n // Returns: { height: number, lastLineWidth: number, lastLineY: number }\r\n const fillTextWrapped = (\r\n ctx: CanvasRenderingContext2D,\r\n text: string,\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n lineHeight: number\r\n ): { height: number; lastLineWidth: number; lastLineY: number } => {\r\n const words = text.split(\" \");\r\n const lines: string[] = [];\r\n let currentLine = words[0];\r\n\r\n for (let i = 1; i < words.length; i++) {\r\n const word = words[i];\r\n const testLine = currentLine + \" \" + word;\r\n const metrics = ctx.measureText(testLine);\r\n if (metrics.width > maxWidth && currentLine.length > 0) {\r\n lines.push(currentLine);\r\n currentLine = word;\r\n } else {\r\n currentLine = testLine;\r\n }\r\n }\r\n lines.push(currentLine);\r\n\r\n let currentY = y;\r\n lines.forEach((line) => {\r\n ctx.fillText(line, x, currentY);\r\n currentY += lineHeight;\r\n });\r\n\r\n const lastLineWidth = ctx.measureText(lines[lines.length - 1]).width;\r\n const lastLineY = y + (lines.length - 1) * lineHeight;\r\n\r\n return {\r\n height: lines.length * lineHeight,\r\n lastLineWidth,\r\n lastLineY,\r\n };\r\n };\r\n\r\n // Helper to wrap and draw multi-color text (for character_colors)\r\n const fillTextWrappedMultiColor = (\r\n ctx: CanvasRenderingContext2D,\r\n text: string,\r\n colors: string[],\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n lineHeight: number\r\n ): number => {\r\n const words = text.split(\" \");\r\n const lines: string[] = [];\r\n const lineStartIndices: number[] = [0];\r\n let currentLine = words[0];\r\n let currentCharIndex = words[0].length;\r\n\r\n for (let i = 1; i < words.length; i++) {\r\n const word = words[i];\r\n const testLine = currentLine + \" \" + word;\r\n const metrics = ctx.measureText(testLine);\r\n if (metrics.width > maxWidth && currentLine.length > 0) {\r\n lines.push(currentLine);\r\n lineStartIndices.push(currentCharIndex + 1); // +1 for space\r\n currentLine = word;\r\n currentCharIndex += word.length + 1;\r\n } else {\r\n currentLine = testLine;\r\n currentCharIndex += word.length + 1;\r\n }\r\n }\r\n lines.push(currentLine);\r\n\r\n let currentY = y;\r\n lines.forEach((line, lineIdx) => {\r\n let currentX = x;\r\n const startCharIdx = lineIdx > 0 ? lineStartIndices[lineIdx] : 0;\r\n for (let i = 0; i < line.length; i++) {\r\n const char = line[i];\r\n const globalCharIdx = startCharIdx + i;\r\n const colorIndex = globalCharIdx % colors.length;\r\n const color = colors[colorIndex];\r\n ctx.fillStyle = COLOR_MAP[color] || \"#000000\";\r\n ctx.fillText(char, currentX, currentY);\r\n currentX += ctx.measureText(char).width;\r\n }\r\n currentY += lineHeight;\r\n });\r\n\r\n return lines.length * lineHeight;\r\n };\r\n\r\n const renderSide = (\r\n ctx: CanvasRenderingContext2D,\r\n side: any,\r\n startY: number,\r\n width: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n let currentY = startY;\r\n const padding = 40 * scaleFactor;\r\n const sideWidth = width - 2 * padding;\r\n const sectionHeight = 200 * scaleFactor;\r\n\r\n // No background section anymore - just white background\r\n\r\n // Group positions by common properties for optimization\r\n const textGroups: Array<{\r\n positions: Array<Position & { type: \"TEXT\" }>;\r\n properties: any;\r\n }> = [];\r\n let currentGroup: Array<Position & { type: \"TEXT\" }> | null = null;\r\n let currentProps: any = null;\r\n\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"TEXT\") {\r\n if (\r\n !currentGroup ||\r\n currentProps.font !== position.font ||\r\n currentProps.text_shape !== position.text_shape ||\r\n currentProps.color !== position.color ||\r\n currentProps.character_colors?.join(\",\") !==\r\n position.character_colors?.join(\",\")\r\n ) {\r\n // Start new group\r\n if (currentGroup) {\r\n textGroups.push({\r\n positions: currentGroup,\r\n properties: currentProps,\r\n });\r\n }\r\n currentGroup = [position];\r\n currentProps = {\r\n font: position.font,\r\n text_shape: position.text_shape,\r\n color: position.color,\r\n character_colors: position.character_colors,\r\n };\r\n } else {\r\n currentGroup.push(position);\r\n }\r\n }\r\n });\r\n\r\n if (currentGroup) {\r\n textGroups.push({ positions: currentGroup, properties: currentProps });\r\n }\r\n\r\n // Draw side header\r\n ctx.save();\r\n const headerFontSize = 200 * scaleFactor;\r\n ctx.font = `bold ${headerFontSize}px Times New Roman`;\r\n ctx.fillStyle = \"#000000\";\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n const headerResult = fillTextWrapped(\r\n ctx,\r\n side.print_side.toUpperCase(),\r\n padding,\r\n currentY,\r\n sideWidth,\r\n headerFontSize\r\n );\r\n currentY += headerResult.height + 50 * scaleFactor;\r\n ctx.restore();\r\n\r\n // Compute side-level uniform properties across all TEXT positions\r\n const allTextPositions: Array<Position & { type: \"TEXT\" }> = [];\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"TEXT\") allTextPositions.push(position as any);\r\n });\r\n\r\n const sideFonts = new Set(allTextPositions.map((p) => (p as any).font));\r\n const sideShapes = new Set(\r\n allTextPositions.map((p) => (p as any).text_shape)\r\n );\r\n const sideFlorals = new Set(\r\n allTextPositions.map((p) => (p as any).floral_pattern ?? \"None\")\r\n );\r\n const colorKeyOf = (p: any) =>\r\n p.character_colors && p.character_colors.length > 0\r\n ? p.character_colors.join(\",\")\r\n : p.color ?? \"None\";\r\n const sideColors = new Set(allTextPositions.map((p) => colorKeyOf(p)));\r\n\r\n const sideUniform = {\r\n font: sideFonts.size === 1,\r\n shape: sideShapes.size === 1,\r\n floral: sideFlorals.size === 1,\r\n color: sideColors.size === 1,\r\n };\r\n\r\n // Render side-level labels once for uniform properties\r\n currentY += renderSideUniformLabels(\r\n ctx,\r\n {\r\n font: sideUniform.font ? [...sideFonts][0] : null,\r\n shape: sideUniform.shape ? [...sideShapes][0] : null,\r\n floral: sideUniform.floral ? [...sideFlorals][0] : null,\r\n color: sideUniform.color ? [...sideColors][0] : null,\r\n },\r\n padding,\r\n currentY,\r\n sideWidth,\r\n scaleFactor\r\n );\r\n\r\n // Render text groups first\r\n let sideTextCounter = 1;\r\n textGroups.forEach((group, groupIndex) => {\r\n group.positions.forEach((position, index) => {\r\n if (index === 0 && groupIndex !== 0) currentY += 50 * scaleFactor;\r\n const drawnHeight = renderText(\r\n ctx,\r\n position,\r\n padding,\r\n currentY,\r\n sideWidth,\r\n sideTextCounter,\r\n {\r\n font: !sideUniform.font,\r\n shape: !sideUniform.shape,\r\n floral: !sideUniform.floral,\r\n color: !sideUniform.color,\r\n },\r\n scaleFactor\r\n );\r\n sideTextCounter += 1;\r\n // add padding only if something was actually drawn\r\n if (drawnHeight > 0) {\r\n currentY += drawnHeight + 40 * scaleFactor;\r\n }\r\n });\r\n });\r\n\r\n // Render ICON titles/values (no images here)\r\n currentY += 30 * scaleFactor; // minimal spacing before icon labels\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"ICON\") {\r\n currentY += renderIconLabels(\r\n ctx,\r\n position as any,\r\n padding,\r\n currentY,\r\n sideWidth,\r\n scaleFactor\r\n );\r\n currentY += 10 * scaleFactor;\r\n }\r\n });\r\n\r\n return Math.max(currentY - startY, sectionHeight);\r\n };\r\n\r\n const renderSideUniformLabels = (\r\n ctx: CanvasRenderingContext2D,\r\n values: {\r\n font: string | null;\r\n shape: string | null;\r\n floral: string | null;\r\n color: string | null;\r\n },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n const labelFontFamily = \"Arial\";\r\n const fontSize = 180 * scaleFactor;\r\n const lineGap = 20 * scaleFactor;\r\n ctx.save();\r\n ctx.font = `${fontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let cursorY = y;\r\n let rendered = 0;\r\n if (values.font) {\r\n const fontText = `Font: ${values.font}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n fontText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.shape && values.shape !== \"None\") {\r\n const shapeText = `Kiểu chữ: ${values.shape}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n shapeText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.color && values.color !== \"None\") {\r\n const colorText = `Màu chỉ: ${values.color}`;\r\n // Reserve space for swatches (estimate: max 5 swatches × 200px each = 1000px)\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const result = fillTextWrapped(\r\n ctx,\r\n colorText,\r\n x,\r\n cursorY,\r\n textMaxWidth,\r\n fontSize + lineGap\r\n );\r\n // Draw swatches inline for side-level color, preserving aspect ratio; 75% of previous size\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(fontSize * 2.025);\r\n let swatchX = x + Math.ceil(result.lastLineWidth) + 100 * scaleFactor;\r\n const swatchY = result.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n const colorTokens = values.color.includes(\",\")\r\n ? values.color.split(\",\").map((s) => s.trim())\r\n : [values.color];\r\n colorTokens.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor;\r\n }\r\n });\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.floral && values.floral !== \"None\") {\r\n const floralText = `Mẫu hoa: ${values.floral}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n floralText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (rendered > 0) cursorY += 50 * scaleFactor; // extra gap before first text line\r\n\r\n ctx.restore();\r\n return cursorY - y;\r\n };\r\n\r\n const renderText = (\r\n ctx: CanvasRenderingContext2D,\r\n position: Position & { type: \"TEXT\" },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n displayIndex: number,\r\n showLabels: {\r\n font: boolean;\r\n shape: boolean;\r\n floral: boolean;\r\n color: boolean;\r\n },\r\n scaleFactor: number = 1\r\n ): number => {\r\n ctx.save();\r\n\r\n // Info labels\r\n // Unified font sizing for labels and content (side title uses its own larger size)\r\n const infoLineGap = 30 * scaleFactor;\r\n const labelFontFamily = \"Arial\";\r\n // Use a unified content font size for both labels and text content\r\n const fontSize = 180 * scaleFactor;\r\n const infoFontSize = fontSize;\r\n ctx.font = `${infoFontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let currentYCursor = y;\r\n let drawnHeight = 0; // accumulate only when something is actually drawn\r\n\r\n // Text value with unified font size\r\n let displayText = position.text;\r\n if (position.change_character_to_heart && displayText.includes(\"<3\")) {\r\n displayText = displayText.replace(/<3/g, \"❤\");\r\n }\r\n\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n\r\n // Label for text line\r\n const textLabel = `Text ${displayIndex}: `;\r\n ctx.font = `bold ${fontSize}px ${labelFontFamily}`;\r\n const labelWidth = ctx.measureText(textLabel).width;\r\n ctx.fillStyle = \"#444444\";\r\n ctx.fillText(textLabel, x, currentYCursor);\r\n\r\n // Calculate available width for text content\r\n const textMaxWidth = maxWidth - labelWidth;\r\n\r\n // Handle character_colors (alternating colors)\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n // Switch to content font\r\n ctx.font = `${fontSize}px ${position.font}`;\r\n const textHeight = fillTextWrappedMultiColor(\r\n ctx,\r\n displayText,\r\n position.character_colors,\r\n x + labelWidth,\r\n currentYCursor,\r\n textMaxWidth,\r\n fontSize\r\n );\r\n currentYCursor += textHeight;\r\n drawnHeight += textHeight;\r\n } else {\r\n // No color specified\r\n // Draw text in content font, black (non-bold)\r\n ctx.font = `${fontSize}px ${position.font}`;\r\n ctx.fillStyle = COLOR_MAP[position.color ?? \"None\"] || \"#000000\";\r\n const textResult = fillTextWrapped(\r\n ctx,\r\n displayText,\r\n x + labelWidth,\r\n currentYCursor,\r\n textMaxWidth,\r\n fontSize\r\n );\r\n currentYCursor += textResult.height;\r\n drawnHeight += textResult.height;\r\n }\r\n\r\n // After text, print Kiểu chữ (when not uniform), then Font and Color as needed\r\n currentYCursor += infoLineGap;\r\n ctx.font = `${infoFontSize}px ${labelFontFamily}`;\r\n ctx.fillStyle = \"#444444\";\r\n if (showLabels.shape && position.text_shape) {\r\n const shapeLabelAfter = `Kiểu chữ: ${position.text_shape}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n shapeLabelAfter,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n if (showLabels.font && position.font) {\r\n const fontLabel = `Font: ${position.font}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n fontLabel,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n if (showLabels.color) {\r\n let colorLabelValue = \"None\";\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n colorLabelValue = position.character_colors.join(\", \");\r\n } else if (position.color) {\r\n colorLabelValue = position.color;\r\n }\r\n if (colorLabelValue !== \"None\") {\r\n const colorLabel = `Màu chỉ: ${colorLabelValue}`;\r\n // Reserve space for swatches\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const result = fillTextWrapped(\r\n ctx,\r\n colorLabel,\r\n x,\r\n currentYCursor,\r\n textMaxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n\r\n // Draw color swatch images inline with Color label for TEXT, preserve aspect ratio; 75% of previous size\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(infoFontSize * 2.025);\r\n let swatchX = x + Math.ceil(result.lastLineWidth) + 100 * scaleFactor; // spacing after text\r\n const swatchY =\r\n result.lastLineY + Math.floor(infoFontSize / 2 - swatchH / 2);\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n position.character_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor;\r\n }\r\n });\r\n } else if (position.color) {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${position.color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n }\r\n }\r\n\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n }\r\n\r\n // Show floral label after color block when not uniform at side level\r\n if (showLabels.floral && position.floral_pattern) {\r\n const floralText = `Mẫu hoa: ${position.floral_pattern}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n floralText,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n\r\n // (Floral per-position label is printed above the text when needed; avoid duplicate after text)\r\n\r\n ctx.restore();\r\n return drawnHeight;\r\n };\r\n\r\n const renderIconLabels = (\r\n ctx: CanvasRenderingContext2D,\r\n position: Position & { type: \"ICON\" },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n const labelFontFamily = \"Arial\";\r\n const fontSize = 180 * scaleFactor;\r\n const lineGap = 30 * scaleFactor;\r\n ctx.save();\r\n ctx.font = `${fontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let cursorY = y;\r\n const iconText = `Icon: ${position.icon}`;\r\n const iconResult = fillTextWrapped(\r\n ctx,\r\n iconText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n // draw icon image inline with text, preserve aspect ratio; match line height\r\n const iconUrl = `${ICON_BASE_URL}/${position.icon}.png`;\r\n {\r\n const img = imageRefs.current.get(iconUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const swatchH = fontSize;\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n // Put icon on last line of wrapped text\r\n const iconX =\r\n x + Math.ceil(iconResult.lastLineWidth) + 100 * scaleFactor;\r\n const iconY =\r\n iconResult.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n ctx.drawImage(img, iconX, iconY, swatchW, swatchH);\r\n }\r\n }\r\n cursorY += iconResult.height;\r\n\r\n // Draw color line only when there are layer colors\r\n if (position.layer_colors && position.layer_colors.length > 0) {\r\n const colorLabelValue = position.layer_colors.join(\", \");\r\n const colorText = `Màu chỉ: ${colorLabelValue}`;\r\n // Reserve space for swatches\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const colorResult = fillTextWrapped(\r\n ctx,\r\n colorText,\r\n x,\r\n cursorY,\r\n textMaxWidth,\r\n fontSize + lineGap\r\n );\r\n\r\n // Draw color swatch images (only for icon)\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(fontSize * 2.025); // 75% of previous size\r\n let swatchX =\r\n x + Math.ceil(colorResult.lastLineWidth) + 100 * scaleFactor; // spacing after text\r\n const swatchY =\r\n colorResult.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n position.layer_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor; // spacing between swatches\r\n }\r\n });\r\n cursorY += colorResult.height;\r\n }\r\n\r\n ctx.restore();\r\n return cursorY - y;\r\n };\r\n\r\n const loadFont = (fontName: string): Promise<void> => {\r\n return new Promise((resolve, reject) => {\r\n // Try to load from CDN\r\n const fontUrl = `${FONT_BASE_URL}/${fontName}.woff2`;\r\n const fontFace = new FontFace(fontName, `url(${fontUrl})`);\r\n\r\n fontFace\r\n .load()\r\n .then((loadedFont) => {\r\n document.fonts.add(loadedFont);\r\n resolve();\r\n })\r\n .catch(() => {\r\n // Font loading failed, will use fallback\r\n console.warn(`Could not load font ${fontName} from CDN`);\r\n resolve(); // Still resolve to not block rendering\r\n });\r\n });\r\n };\r\n\r\n return (\r\n <div className={`render-embroidery${className ? ` ${className}` : \"\"}`} style={style}>\r\n <canvas ref={canvasRef} className=\"render-embroidery-canvas\" />\r\n </div>\r\n );\r\n};\r\n\r\nexport default EmbroideryQCImage;\r\n"],"names":["_jsx"],"mappings":";;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ;;AAE7B,EAAE,IAAY,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,CAAC;;AAEzD,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU;;AAEzB,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;AAC/C,IAAI,CAAC,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7B,IAAI;AACJ,EAAE,CAAC,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,EAAE;;AAEF,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG;AAClC,EAAE,CAAC,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACnD,EAAE;AACF;;;;;ACrBA;AACA,MAAM,SAAS,GAA2B;AACxC,IAAA,aAAa,EAAE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AG,EAAA,CAC3D;AAEV;;;;","x_google_ignoreList":[0]}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
|
|
6
|
+
function styleInject(css, ref) {
|
|
7
|
+
if ( ref === void 0 ) ref = {};
|
|
8
|
+
var insertAt = ref.insertAt;
|
|
9
|
+
|
|
10
|
+
if (typeof document === 'undefined') { return; }
|
|
11
|
+
|
|
12
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
13
|
+
var style = document.createElement('style');
|
|
14
|
+
style.type = 'text/css';
|
|
15
|
+
|
|
16
|
+
if (insertAt === 'top') {
|
|
17
|
+
if (head.firstChild) {
|
|
18
|
+
head.insertBefore(style, head.firstChild);
|
|
19
|
+
} else {
|
|
20
|
+
head.appendChild(style);
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
head.appendChild(style);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (style.styleSheet) {
|
|
27
|
+
style.styleSheet.cssText = css;
|
|
28
|
+
} else {
|
|
29
|
+
style.appendChild(document.createTextNode(css));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var css_248z = ".render-embroidery {\r\n display: inline-block;\r\n position: relative;\r\n width: 100%;\r\n max-width: 100%;\r\n}\r\n\r\n.render-embroidery-canvas {\r\n display: block;\r\n width: 100%;\r\n height: auto;\r\n image-rendering: high-quality;\r\n background: transparent;\r\n}\r\n";
|
|
34
|
+
styleInject(css_248z);
|
|
35
|
+
|
|
6
36
|
// Color mapping
|
|
7
37
|
const COLOR_MAP = {
|
|
8
38
|
"Army (1394)": "#4B5320",
|
|
@@ -473,7 +503,7 @@ const EmbroideryQCImage = ({ config, className = "", style = {}, }) => {
|
|
|
473
503
|
group.positions.forEach((position, index) => {
|
|
474
504
|
if (index === 0 && groupIndex !== 0)
|
|
475
505
|
currentY += 50 * scaleFactor;
|
|
476
|
-
const drawnHeight = renderText(ctx, position, padding, currentY, sideWidth,
|
|
506
|
+
const drawnHeight = renderText(ctx, position, padding, currentY, sideWidth, sideTextCounter, {
|
|
477
507
|
font: !sideUniform.font,
|
|
478
508
|
shape: !sideUniform.shape,
|
|
479
509
|
floral: !sideUniform.floral,
|
|
@@ -557,7 +587,7 @@ const EmbroideryQCImage = ({ config, className = "", style = {}, }) => {
|
|
|
557
587
|
ctx.restore();
|
|
558
588
|
return cursorY - y;
|
|
559
589
|
};
|
|
560
|
-
const renderText = (ctx, position, x, y, maxWidth,
|
|
590
|
+
const renderText = (ctx, position, x, y, maxWidth, displayIndex, showLabels, scaleFactor = 1) => {
|
|
561
591
|
ctx.save();
|
|
562
592
|
// Info labels
|
|
563
593
|
// Unified font sizing for labels and content (side title uses its own larger size)
|
|
@@ -581,7 +611,7 @@ const EmbroideryQCImage = ({ config, className = "", style = {}, }) => {
|
|
|
581
611
|
ctx.textBaseline = "top";
|
|
582
612
|
// Label for text line
|
|
583
613
|
const textLabel = `Text ${displayIndex}: `;
|
|
584
|
-
ctx.font =
|
|
614
|
+
ctx.font = `bold ${fontSize}px ${labelFontFamily}`;
|
|
585
615
|
const labelWidth = ctx.measureText(textLabel).width;
|
|
586
616
|
ctx.fillStyle = "#444444";
|
|
587
617
|
ctx.fillText(textLabel, x, currentYCursor);
|
|
@@ -748,7 +778,7 @@ const EmbroideryQCImage = ({ config, className = "", style = {}, }) => {
|
|
|
748
778
|
});
|
|
749
779
|
});
|
|
750
780
|
};
|
|
751
|
-
return (jsxRuntime.jsx("div", { className: `render-embroidery ${className}`, style: style, children: jsxRuntime.jsx("canvas", { ref: canvasRef, className: "render-embroidery-canvas" }) }));
|
|
781
|
+
return (jsxRuntime.jsx("div", { className: `render-embroidery${className ? ` ${className}` : ""}`, style: style, children: jsxRuntime.jsx("canvas", { ref: canvasRef, className: "render-embroidery-canvas" }) }));
|
|
752
782
|
};
|
|
753
783
|
|
|
754
784
|
exports.EmbroideryQCImage = EmbroideryQCImage;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/EmbroideryQCImage.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from \"react\";\r\nimport { EmbroideryQCImageProps, Position } from \"../types\";\r\nimport \"./EmbroideryQCImage.css\";\r\n\r\n// Color mapping\r\nconst COLOR_MAP: Record<string, string> = {\r\n \"Army (1394)\": \"#4B5320\",\r\n Army: \"#4B5320\",\r\n \"Black (8)\": \"#000000\",\r\n Black: \"#000000\",\r\n \"Bubblegum (1309)\": \"#FFC1CC\",\r\n Bubblegum: \"#FFC1CC\",\r\n \"Carolina Blue (1274)\": \"#7BAFD4\",\r\n \"Carolina Blue\": \"#7BAFD4\",\r\n \"Celadon (1098)\": \"#ACE1AF\",\r\n Celadon: \"#ACE1AF\",\r\n \"Coffee Bean (1145)\": \"#6F4E37\",\r\n \"Coffee Bean\": \"#6F4E37\",\r\n \"Daffodil (1180)\": \"#FFFF31\",\r\n Daffodil: \"#FFFF31\",\r\n \"Dark Gray (1131)\": \"#A9A9A9\",\r\n \"Dark Gray\": \"#A9A9A9\",\r\n \"Doe Skin Beige (1344)\": \"#F5E6D3\",\r\n \"Doe Skin Beige\": \"#F5E6D3\",\r\n \"Dusty Blue (1373)\": \"#6699CC\",\r\n \"Dusty Blue\": \"#6699CC\",\r\n \"Forest Green (1397)\": \"#228B22\",\r\n \"Forest Green\": \"#228B22\",\r\n \"Gold (1425)\": \"#FFD700\",\r\n Gold: \"#FFD700\",\r\n \"Gray (1118)\": \"#808080\",\r\n Gray: \"#808080\",\r\n \"Ivory (1072)\": \"#FFFFF0\",\r\n Ivory: \"#FFFFF0\",\r\n \"Lavender (1032)\": \"#E6E6FA\",\r\n Lavender: \"#E6E6FA\",\r\n \"Light Denim (1133)\": \"#B0C4DE\",\r\n \"Light Denim\": \"#B0C4DE\",\r\n \"Light Salmon (1018)\": \"#FFA07A\",\r\n \"Light Salmon\": \"#FFA07A\",\r\n \"Maroon (1374)\": \"#800000\",\r\n Maroon: \"#800000\",\r\n \"Navy Blue (1044)\": \"#000080\",\r\n \"Navy Blue\": \"#000080\",\r\n \"Olive Green (1157)\": \"#556B2F\",\r\n \"Olive Green\": \"#556B2F\",\r\n \"Orange (1278)\": \"#FFA500\",\r\n Orange: \"#FFA500\",\r\n \"Peach Blush (1053)\": \"#FFCCCB\",\r\n \"Peach Blush\": \"#FFCCCB\",\r\n \"Pink (1148)\": \"#FFC0CB\",\r\n Pink: \"#FFC0CB\",\r\n \"Purple (1412)\": \"#800080\",\r\n Purple: \"#800080\",\r\n \"Red (1037)\": \"#FF0000\",\r\n Red: \"#FF0000\",\r\n \"Silver Sage (1396)\": \"#A8A8A8\",\r\n \"Silver Sage\": \"#A8A8A8\",\r\n \"Summer Sky (1432)\": \"#87CEEB\",\r\n \"Summer Sky\": \"#87CEEB\",\r\n \"Terra Cotta (1477)\": \"#E2725B\",\r\n \"Terra Cotta\": \"#E2725B\",\r\n \"Sand (1055)\": \"#F4A460\",\r\n Sand: \"#F4A460\",\r\n \"White (9)\": \"#FFFFFF\",\r\n White: \"#FFFFFF\",\r\n};\r\n\r\nconst FONT_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/fonts\";\r\nconst ICON_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/icons\";\r\nconst FLORAL_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/florals\";\r\nconst THREAD_COLOR_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/thread-colors\";\r\n\r\nconst EmbroideryQCImage: React.FC<EmbroideryQCImageProps> = ({\r\n config,\r\n className = \"\",\r\n style = {},\r\n}) => {\r\n const [canvasSize] = useState({ width: 4200, height: 4800 });\r\n const [loadedFonts, setLoadedFonts] = useState<Set<string>>(new Set());\r\n const [imagesLoaded, setImagesLoaded] = useState(0);\r\n const canvasRef = useRef<HTMLCanvasElement>(null);\r\n const imageRefs = useRef<Map<string, HTMLImageElement>>(new Map());\r\n\r\n // Load fonts\r\n useEffect(() => {\r\n const loadFonts = async () => {\r\n if (!config.sides || config.sides.length === 0) return;\r\n\r\n const fontsToLoad = new Set<string>();\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"TEXT\" && position.font) {\r\n fontsToLoad.add(position.font);\r\n }\r\n });\r\n });\r\n\r\n for (const fontName of fontsToLoad) {\r\n if (loadedFonts.has(fontName)) continue;\r\n\r\n try {\r\n await loadFont(fontName);\r\n setLoadedFonts((prev) => new Set(prev).add(fontName));\r\n } catch (error) {\r\n console.warn(`Could not load font ${fontName}:`, error);\r\n }\r\n }\r\n };\r\n\r\n loadFonts();\r\n }, [config.sides, loadedFonts]);\r\n\r\n // Load images\r\n useEffect(() => {\r\n const loadImages = async () => {\r\n if (!config.sides || config.sides.length === 0) return;\r\n\r\n // Load mockup image (not background). It will be drawn at bottom-right.\r\n if (config.image_url) {\r\n // Try with CORS first. If it fails (no CORS headers), retry without CORS\r\n const loadMockup = (useCors: boolean) => {\r\n const img = new Image();\r\n if (useCors) img.crossOrigin = \"anonymous\";\r\n img.onload = () => {\r\n imageRefs.current.set(\"mockup\", img);\r\n setImagesLoaded((prev) => prev + 1);\r\n };\r\n img.onerror = () => {\r\n if (useCors) {\r\n // Retry without CORS; canvas may become tainted on export\r\n loadMockup(false);\r\n }\r\n };\r\n img.src = config.image_url as string;\r\n };\r\n loadMockup(true);\r\n }\r\n\r\n // Load icons\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"ICON\") {\r\n const iconUrl = `${ICON_BASE_URL}/${position.icon}.png`;\r\n if (!imageRefs.current.has(iconUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = iconUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(iconUrl, img);\r\n }\r\n }\r\n\r\n if (position.type === \"TEXT\" && position.floral_pattern) {\r\n const floralUrl = `${FLORAL_BASE_URL}/${position.floral_pattern}.png`;\r\n if (!imageRefs.current.has(floralUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = floralUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(floralUrl, img);\r\n }\r\n }\r\n\r\n // Load thread color images for TEXT positions\r\n if (position.type === \"TEXT\") {\r\n // Load color image if position has color\r\n if (position.color) {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${position.color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n }\r\n\r\n // Load character color images\r\n if (\r\n position.character_colors &&\r\n position.character_colors.length > 0\r\n ) {\r\n position.character_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n });\r\n }\r\n }\r\n\r\n // Load thread color images for ICON positions\r\n if (position.type === \"ICON\" && position.layer_colors) {\r\n position.layer_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n });\r\n }\r\n });\r\n });\r\n };\r\n\r\n loadImages();\r\n }, [config]);\r\n\r\n // Render canvas\r\n useEffect(() => {\r\n const renderCanvas = () => {\r\n if (!canvasRef.current || !config.sides || config.sides.length === 0) {\r\n return;\r\n }\r\n\r\n const canvas = canvasRef.current;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) return;\r\n\r\n canvas.width = canvasSize.width;\r\n canvas.height = canvasSize.height;\r\n\r\n // Clear with white background\r\n ctx.fillStyle = \"#FFFFFF\";\r\n ctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\r\n // Collect floral images (for later drawing)\r\n const floralAssets: HTMLImageElement[] = [];\r\n const seenFlorals = new Set<string>();\r\n if (config.sides) {\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"TEXT\" && position.floral_pattern) {\r\n const floralUrl = `${FLORAL_BASE_URL}/${position.floral_pattern}.png`;\r\n if (!seenFlorals.has(floralUrl)) {\r\n const img = imageRefs.current.get(floralUrl);\r\n if (img && img.complete && img.naturalWidth > 0) {\r\n floralAssets.push(img);\r\n seenFlorals.add(floralUrl);\r\n }\r\n }\r\n }\r\n });\r\n });\r\n }\r\n\r\n // Helper function to draw mockup and florals\r\n const drawMockupAndFlorals = () => {\r\n const mockupImg = imageRefs.current.get(\"mockup\");\r\n const margin = 40; // small padding\r\n let mockupBox: { x: number; y: number; w: number; h: number } | null =\r\n null;\r\n if (mockupImg && mockupImg.complete && mockupImg.naturalWidth > 0) {\r\n const maxTargetWidth = Math.min(1800, canvas.width * 0.375);\r\n const maxTargetHeight = canvas.height * 0.375;\r\n const scale = Math.min(\r\n maxTargetWidth / mockupImg.naturalWidth,\r\n maxTargetHeight / mockupImg.naturalHeight\r\n );\r\n const targetWidth = Math.max(\r\n 1,\r\n Math.floor(mockupImg.naturalWidth * scale)\r\n );\r\n const targetHeight = Math.max(\r\n 1,\r\n Math.floor(mockupImg.naturalHeight * scale)\r\n );\r\n const targetX = canvas.width - margin - targetWidth;\r\n const targetY = canvas.height - margin - targetHeight;\r\n mockupBox = {\r\n x: targetX,\r\n y: targetY,\r\n w: targetWidth,\r\n h: targetHeight,\r\n };\r\n ctx.drawImage(mockupImg, targetX, targetY, targetWidth, targetHeight);\r\n }\r\n\r\n // Draw florals to the left of mockup\r\n if (mockupBox && floralAssets.length > 0) {\r\n const spacing = 300;\r\n const targetHeight = mockupBox.h;\r\n const floralFixedH = Math.min(900, targetHeight);\r\n let currentX = mockupBox.x - spacing;\r\n for (let i = floralAssets.length - 1; i >= 0; i--) {\r\n const img = floralAssets[i];\r\n const ratio = img.naturalWidth / Math.max(1, img.naturalHeight);\r\n const h = floralFixedH;\r\n const w = Math.max(1, Math.floor(h * ratio));\r\n currentX -= w;\r\n const y = mockupBox.y + (targetHeight - h);\r\n ctx.drawImage(img, currentX, y, w, h);\r\n currentX -= spacing;\r\n }\r\n }\r\n };\r\n\r\n // New approach: Draw images first (bottom layer), then text on top\r\n // This allows text to overlay images when needed\r\n\r\n // Pass 1: Measure actual height with original size (use offscreen canvas for measurement)\r\n const measureCanvas = document.createElement(\"canvas\");\r\n measureCanvas.width = canvas.width;\r\n measureCanvas.height = canvas.height;\r\n const measureCtx = measureCanvas.getContext(\"2d\");\r\n if (!measureCtx) return;\r\n\r\n // Set up measurement context\r\n measureCtx.font = ctx.font;\r\n measureCtx.textAlign = ctx.textAlign;\r\n measureCtx.textBaseline = ctx.textBaseline;\r\n\r\n let measureY = 40;\r\n const measureSpacing = 100;\r\n config.sides.forEach((side) => {\r\n const sideHeight = renderSide(\r\n measureCtx,\r\n side,\r\n measureY,\r\n canvas.width,\r\n 1\r\n );\r\n measureY += sideHeight + measureSpacing;\r\n });\r\n const totalMeasuredHeight = measureY; // Total height used\r\n\r\n // Calculate scale factor - only scale down when necessary\r\n // Keep original font sizes (no scale up) - font size is the maximum\r\n const topPadding = 40;\r\n // No bottom padding - content can go to bottom, mockup will overlay\r\n const targetContentHeight = canvas.height - topPadding;\r\n\r\n // Only scale down if content exceeds canvas height\r\n // Never scale up - preserve original font sizes\r\n let scaleFactor = 1;\r\n if (totalMeasuredHeight > targetContentHeight) {\r\n // Scale down to fit exactly\r\n scaleFactor = targetContentHeight / totalMeasuredHeight;\r\n scaleFactor = Math.max(0.5, scaleFactor); // Minimum scale to prevent tiny fonts\r\n }\r\n // If content fits, keep scaleFactor = 1 (original font sizes)\r\n\r\n // Draw mockup and florals first (bottom layer)\r\n drawMockupAndFlorals();\r\n\r\n // Draw content on top (top layer) - text will overlay images if needed\r\n let currentY = topPadding * scaleFactor;\r\n config.sides.forEach((side) => {\r\n const sideHeight = renderSide(\r\n ctx,\r\n side,\r\n currentY,\r\n canvas.width,\r\n scaleFactor\r\n );\r\n currentY += sideHeight + measureSpacing * scaleFactor;\r\n });\r\n };\r\n\r\n // Delay rendering to ensure fonts and images are loaded\r\n const timer = setTimeout(renderCanvas, 100);\r\n return () => clearTimeout(timer);\r\n }, [config, canvasSize, loadedFonts, imagesLoaded]);\r\n\r\n // Helper function to wrap and draw text with word wrapping\r\n // Returns: { height: number, lastLineWidth: number, lastLineY: number }\r\n const fillTextWrapped = (\r\n ctx: CanvasRenderingContext2D,\r\n text: string,\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n lineHeight: number\r\n ): { height: number; lastLineWidth: number; lastLineY: number } => {\r\n const words = text.split(\" \");\r\n const lines: string[] = [];\r\n let currentLine = words[0];\r\n\r\n for (let i = 1; i < words.length; i++) {\r\n const word = words[i];\r\n const testLine = currentLine + \" \" + word;\r\n const metrics = ctx.measureText(testLine);\r\n if (metrics.width > maxWidth && currentLine.length > 0) {\r\n lines.push(currentLine);\r\n currentLine = word;\r\n } else {\r\n currentLine = testLine;\r\n }\r\n }\r\n lines.push(currentLine);\r\n\r\n let currentY = y;\r\n lines.forEach((line) => {\r\n ctx.fillText(line, x, currentY);\r\n currentY += lineHeight;\r\n });\r\n\r\n const lastLineWidth = ctx.measureText(lines[lines.length - 1]).width;\r\n const lastLineY = y + (lines.length - 1) * lineHeight;\r\n\r\n return {\r\n height: lines.length * lineHeight,\r\n lastLineWidth,\r\n lastLineY,\r\n };\r\n };\r\n\r\n // Helper to wrap and draw multi-color text (for character_colors)\r\n const fillTextWrappedMultiColor = (\r\n ctx: CanvasRenderingContext2D,\r\n text: string,\r\n colors: string[],\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n lineHeight: number\r\n ): number => {\r\n const words = text.split(\" \");\r\n const lines: string[] = [];\r\n const lineStartIndices: number[] = [0];\r\n let currentLine = words[0];\r\n let currentCharIndex = words[0].length;\r\n\r\n for (let i = 1; i < words.length; i++) {\r\n const word = words[i];\r\n const testLine = currentLine + \" \" + word;\r\n const metrics = ctx.measureText(testLine);\r\n if (metrics.width > maxWidth && currentLine.length > 0) {\r\n lines.push(currentLine);\r\n lineStartIndices.push(currentCharIndex + 1); // +1 for space\r\n currentLine = word;\r\n currentCharIndex += word.length + 1;\r\n } else {\r\n currentLine = testLine;\r\n currentCharIndex += word.length + 1;\r\n }\r\n }\r\n lines.push(currentLine);\r\n\r\n let currentY = y;\r\n lines.forEach((line, lineIdx) => {\r\n let currentX = x;\r\n const startCharIdx = lineIdx > 0 ? lineStartIndices[lineIdx] : 0;\r\n for (let i = 0; i < line.length; i++) {\r\n const char = line[i];\r\n const globalCharIdx = startCharIdx + i;\r\n const colorIndex = globalCharIdx % colors.length;\r\n const color = colors[colorIndex];\r\n ctx.fillStyle = COLOR_MAP[color] || \"#000000\";\r\n ctx.fillText(char, currentX, currentY);\r\n currentX += ctx.measureText(char).width;\r\n }\r\n currentY += lineHeight;\r\n });\r\n\r\n return lines.length * lineHeight;\r\n };\r\n\r\n const renderSide = (\r\n ctx: CanvasRenderingContext2D,\r\n side: any,\r\n startY: number,\r\n width: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n let currentY = startY;\r\n const padding = 40 * scaleFactor;\r\n const sideWidth = width - 2 * padding;\r\n const sectionHeight = 200 * scaleFactor;\r\n\r\n // No background section anymore - just white background\r\n\r\n // Group positions by common properties for optimization\r\n const textGroups: Array<{\r\n positions: Array<Position & { type: \"TEXT\" }>;\r\n properties: any;\r\n }> = [];\r\n let currentGroup: Array<Position & { type: \"TEXT\" }> | null = null;\r\n let currentProps: any = null;\r\n\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"TEXT\") {\r\n if (\r\n !currentGroup ||\r\n currentProps.font !== position.font ||\r\n currentProps.text_shape !== position.text_shape ||\r\n currentProps.color !== position.color ||\r\n currentProps.character_colors?.join(\",\") !==\r\n position.character_colors?.join(\",\")\r\n ) {\r\n // Start new group\r\n if (currentGroup) {\r\n textGroups.push({\r\n positions: currentGroup,\r\n properties: currentProps,\r\n });\r\n }\r\n currentGroup = [position];\r\n currentProps = {\r\n font: position.font,\r\n text_shape: position.text_shape,\r\n color: position.color,\r\n character_colors: position.character_colors,\r\n };\r\n } else {\r\n currentGroup.push(position);\r\n }\r\n }\r\n });\r\n\r\n if (currentGroup) {\r\n textGroups.push({ positions: currentGroup, properties: currentProps });\r\n }\r\n\r\n // Draw side header\r\n ctx.save();\r\n const headerFontSize = 200 * scaleFactor;\r\n ctx.font = `bold ${headerFontSize}px Times New Roman`;\r\n ctx.fillStyle = \"#000000\";\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n const headerResult = fillTextWrapped(\r\n ctx,\r\n side.print_side.toUpperCase(),\r\n padding,\r\n currentY,\r\n sideWidth,\r\n headerFontSize\r\n );\r\n currentY += headerResult.height + 50 * scaleFactor;\r\n ctx.restore();\r\n\r\n // Compute side-level uniform properties across all TEXT positions\r\n const allTextPositions: Array<Position & { type: \"TEXT\" }> = [];\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"TEXT\") allTextPositions.push(position as any);\r\n });\r\n\r\n const sideFonts = new Set(allTextPositions.map((p) => (p as any).font));\r\n const sideShapes = new Set(\r\n allTextPositions.map((p) => (p as any).text_shape)\r\n );\r\n const sideFlorals = new Set(\r\n allTextPositions.map((p) => (p as any).floral_pattern ?? \"None\")\r\n );\r\n const colorKeyOf = (p: any) =>\r\n p.character_colors && p.character_colors.length > 0\r\n ? p.character_colors.join(\",\")\r\n : p.color ?? \"None\";\r\n const sideColors = new Set(allTextPositions.map((p) => colorKeyOf(p)));\r\n\r\n const sideUniform = {\r\n font: sideFonts.size === 1,\r\n shape: sideShapes.size === 1,\r\n floral: sideFlorals.size === 1,\r\n color: sideColors.size === 1,\r\n };\r\n\r\n // Render side-level labels once for uniform properties\r\n currentY += renderSideUniformLabels(\r\n ctx,\r\n {\r\n font: sideUniform.font ? [...sideFonts][0] : null,\r\n shape: sideUniform.shape ? [...sideShapes][0] : null,\r\n floral: sideUniform.floral ? [...sideFlorals][0] : null,\r\n color: sideUniform.color ? [...sideColors][0] : null,\r\n },\r\n padding,\r\n currentY,\r\n sideWidth,\r\n scaleFactor\r\n );\r\n\r\n // Render text groups first\r\n let sideTextCounter = 1;\r\n textGroups.forEach((group, groupIndex) => {\r\n group.positions.forEach((position, index) => {\r\n if (index === 0 && groupIndex !== 0) currentY += 50 * scaleFactor;\r\n const drawnHeight = renderText(\r\n ctx,\r\n position,\r\n padding,\r\n currentY,\r\n sideWidth,\r\n group.properties,\r\n group.positions.length,\r\n index,\r\n sideTextCounter,\r\n {\r\n font: !sideUniform.font,\r\n shape: !sideUniform.shape,\r\n floral: !sideUniform.floral,\r\n color: !sideUniform.color,\r\n },\r\n scaleFactor\r\n );\r\n sideTextCounter += 1;\r\n // add padding only if something was actually drawn\r\n if (drawnHeight > 0) {\r\n currentY += drawnHeight + 40 * scaleFactor;\r\n }\r\n });\r\n });\r\n\r\n // Render ICON titles/values (no images here)\r\n currentY += 30 * scaleFactor; // minimal spacing before icon labels\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"ICON\") {\r\n currentY += renderIconLabels(\r\n ctx,\r\n position as any,\r\n padding,\r\n currentY,\r\n sideWidth,\r\n scaleFactor\r\n );\r\n currentY += 10 * scaleFactor;\r\n }\r\n });\r\n\r\n return Math.max(currentY - startY, sectionHeight);\r\n };\r\n\r\n const renderSideUniformLabels = (\r\n ctx: CanvasRenderingContext2D,\r\n values: {\r\n font: string | null;\r\n shape: string | null;\r\n floral: string | null;\r\n color: string | null;\r\n },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n const labelFontFamily = \"Arial\";\r\n const fontSize = 180 * scaleFactor;\r\n const lineGap = 20 * scaleFactor;\r\n ctx.save();\r\n ctx.font = `${fontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let cursorY = y;\r\n let rendered = 0;\r\n if (values.font) {\r\n const fontText = `Font: ${values.font}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n fontText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.shape && values.shape !== \"None\") {\r\n const shapeText = `Kiểu chữ: ${values.shape}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n shapeText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.color && values.color !== \"None\") {\r\n const colorText = `Màu chỉ: ${values.color}`;\r\n // Reserve space for swatches (estimate: max 5 swatches × 200px each = 1000px)\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const result = fillTextWrapped(\r\n ctx,\r\n colorText,\r\n x,\r\n cursorY,\r\n textMaxWidth,\r\n fontSize + lineGap\r\n );\r\n // Draw swatches inline for side-level color, preserving aspect ratio; 75% of previous size\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(fontSize * 2.025);\r\n let swatchX = x + Math.ceil(result.lastLineWidth) + 100 * scaleFactor;\r\n const swatchY = result.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n const colorTokens = values.color.includes(\",\")\r\n ? values.color.split(\",\").map((s) => s.trim())\r\n : [values.color];\r\n colorTokens.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor;\r\n }\r\n });\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.floral && values.floral !== \"None\") {\r\n const floralText = `Mẫu hoa: ${values.floral}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n floralText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (rendered > 0) cursorY += 50 * scaleFactor; // extra gap before first text line\r\n\r\n ctx.restore();\r\n return cursorY - y;\r\n };\r\n\r\n const renderText = (\r\n ctx: CanvasRenderingContext2D,\r\n position: Position & { type: \"TEXT\" },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n properties: any,\r\n totalTexts: number,\r\n textIndex: number,\r\n displayIndex: number,\r\n showLabels: {\r\n font: boolean;\r\n shape: boolean;\r\n floral: boolean;\r\n color: boolean;\r\n },\r\n scaleFactor: number = 1\r\n ): number => {\r\n ctx.save();\r\n\r\n // Info labels\r\n // Unified font sizing for labels and content (side title uses its own larger size)\r\n const infoLineGap = 30 * scaleFactor;\r\n const labelFontFamily = \"Arial\";\r\n // Use a unified content font size for both labels and text content\r\n const fontSize = 180 * scaleFactor;\r\n const infoFontSize = fontSize;\r\n ctx.font = `${infoFontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let currentYCursor = y;\r\n let drawnHeight = 0; // accumulate only when something is actually drawn\r\n\r\n // Text value with unified font size\r\n let displayText = position.text;\r\n if (position.change_character_to_heart && displayText.includes(\"<3\")) {\r\n displayText = displayText.replace(/<3/g, \"❤\");\r\n }\r\n\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n\r\n // Label for text line\r\n const textLabel = `Text ${displayIndex}: `;\r\n ctx.font = `${fontSize}px ${labelFontFamily}`;\r\n const labelWidth = ctx.measureText(textLabel).width;\r\n ctx.fillStyle = \"#444444\";\r\n ctx.fillText(textLabel, x, currentYCursor);\r\n\r\n // Calculate available width for text content\r\n const textMaxWidth = maxWidth - labelWidth;\r\n\r\n // Handle character_colors (alternating colors)\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n // Switch to content font\r\n ctx.font = `${fontSize}px ${position.font}`;\r\n const textHeight = fillTextWrappedMultiColor(\r\n ctx,\r\n displayText,\r\n position.character_colors,\r\n x + labelWidth,\r\n currentYCursor,\r\n textMaxWidth,\r\n fontSize\r\n );\r\n currentYCursor += textHeight;\r\n drawnHeight += textHeight;\r\n } else {\r\n // No color specified\r\n // Draw text in content font, black (non-bold)\r\n ctx.font = `${fontSize}px ${position.font}`;\r\n ctx.fillStyle = COLOR_MAP[position.color ?? \"None\"] || \"#000000\";\r\n const textResult = fillTextWrapped(\r\n ctx,\r\n displayText,\r\n x + labelWidth,\r\n currentYCursor,\r\n textMaxWidth,\r\n fontSize\r\n );\r\n currentYCursor += textResult.height;\r\n drawnHeight += textResult.height;\r\n }\r\n\r\n // After text, print Kiểu chữ (when not uniform), then Font and Color as needed\r\n currentYCursor += infoLineGap;\r\n ctx.font = `${infoFontSize}px ${labelFontFamily}`;\r\n ctx.fillStyle = \"#444444\";\r\n if (showLabels.shape && position.text_shape) {\r\n const shapeLabelAfter = `Kiểu chữ: ${position.text_shape}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n shapeLabelAfter,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n if (showLabels.font && position.font) {\r\n const fontLabel = `Font: ${position.font}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n fontLabel,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n if (showLabels.color) {\r\n let colorLabelValue = \"None\";\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n colorLabelValue = position.character_colors.join(\", \");\r\n } else if (position.color) {\r\n colorLabelValue = position.color;\r\n }\r\n if (colorLabelValue !== \"None\") {\r\n const colorLabel = `Màu chỉ: ${colorLabelValue}`;\r\n // Reserve space for swatches\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const result = fillTextWrapped(\r\n ctx,\r\n colorLabel,\r\n x,\r\n currentYCursor,\r\n textMaxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n\r\n // Draw color swatch images inline with Color label for TEXT, preserve aspect ratio; 75% of previous size\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(infoFontSize * 2.025);\r\n let swatchX = x + Math.ceil(result.lastLineWidth) + 100 * scaleFactor; // spacing after text\r\n const swatchY =\r\n result.lastLineY + Math.floor(infoFontSize / 2 - swatchH / 2);\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n position.character_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor;\r\n }\r\n });\r\n } else if (position.color) {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${position.color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n }\r\n }\r\n\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n }\r\n\r\n // Show floral label after color block when not uniform at side level\r\n if (showLabels.floral && position.floral_pattern) {\r\n const floralText = `Mẫu hoa: ${position.floral_pattern}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n floralText,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n\r\n // (Floral per-position label is printed above the text when needed; avoid duplicate after text)\r\n\r\n ctx.restore();\r\n return drawnHeight;\r\n };\r\n\r\n const renderIconLabels = (\r\n ctx: CanvasRenderingContext2D,\r\n position: Position & { type: \"ICON\" },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n const labelFontFamily = \"Arial\";\r\n const fontSize = 180 * scaleFactor;\r\n const lineGap = 30 * scaleFactor;\r\n ctx.save();\r\n ctx.font = `${fontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let cursorY = y;\r\n const iconText = `Icon: ${position.icon}`;\r\n const iconResult = fillTextWrapped(\r\n ctx,\r\n iconText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n // draw icon image inline with text, preserve aspect ratio; match line height\r\n const iconUrl = `${ICON_BASE_URL}/${position.icon}.png`;\r\n {\r\n const img = imageRefs.current.get(iconUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const swatchH = fontSize;\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n // Put icon on last line of wrapped text\r\n const iconX =\r\n x + Math.ceil(iconResult.lastLineWidth) + 100 * scaleFactor;\r\n const iconY =\r\n iconResult.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n ctx.drawImage(img, iconX, iconY, swatchW, swatchH);\r\n }\r\n }\r\n cursorY += iconResult.height;\r\n\r\n // Draw color line only when there are layer colors\r\n if (position.layer_colors && position.layer_colors.length > 0) {\r\n const colorLabelValue = position.layer_colors.join(\", \");\r\n const colorText = `Màu chỉ: ${colorLabelValue}`;\r\n // Reserve space for swatches\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const colorResult = fillTextWrapped(\r\n ctx,\r\n colorText,\r\n x,\r\n cursorY,\r\n textMaxWidth,\r\n fontSize + lineGap\r\n );\r\n\r\n // Draw color swatch images (only for icon)\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(fontSize * 2.025); // 75% of previous size\r\n let swatchX =\r\n x + Math.ceil(colorResult.lastLineWidth) + 100 * scaleFactor; // spacing after text\r\n const swatchY =\r\n colorResult.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n position.layer_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor; // spacing between swatches\r\n }\r\n });\r\n cursorY += colorResult.height;\r\n }\r\n\r\n ctx.restore();\r\n return cursorY - y;\r\n };\r\n\r\n const loadFont = (fontName: string): Promise<void> => {\r\n return new Promise((resolve, reject) => {\r\n // Try to load from CDN\r\n const fontUrl = `${FONT_BASE_URL}/${fontName}.woff2`;\r\n const fontFace = new FontFace(fontName, `url(${fontUrl})`);\r\n\r\n fontFace\r\n .load()\r\n .then((loadedFont) => {\r\n document.fonts.add(loadedFont);\r\n resolve();\r\n })\r\n .catch(() => {\r\n // Font loading failed, will use fallback\r\n console.warn(`Could not load font ${fontName} from CDN`);\r\n resolve(); // Still resolve to not block rendering\r\n });\r\n });\r\n };\r\n\r\n return (\r\n <div className={`render-embroidery ${className}`} style={style}>\r\n <canvas ref={canvasRef} className=\"render-embroidery-canvas\" />\r\n </div>\r\n );\r\n};\r\n\r\nexport default EmbroideryQCImage;\r\n"],"names":["useState","useRef","useEffect","_jsx"],"mappings":";;;;;AAIA;AACA,MAAM,SAAS,GAA2B;AACxC,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,WAAW,EAAE,SAAS;AACtB,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,kBAAkB,EAAE,SAAS;AAC7B,IAAA,SAAS,EAAE,SAAS;AACpB,IAAA,sBAAsB,EAAE,SAAS;AACjC,IAAA,eAAe,EAAE,SAAS;AAC1B,IAAA,gBAAgB,EAAE,SAAS;AAC3B,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,oBAAoB,EAAE,SAAS;AAC/B,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,iBAAiB,EAAE,SAAS;AAC5B,IAAA,QAAQ,EAAE,SAAS;AACnB,IAAA,kBAAkB,EAAE,SAAS;AAC7B,IAAA,WAAW,EAAE,SAAS;AACtB,IAAA,uBAAuB,EAAE,SAAS;AAClC,IAAA,gBAAgB,EAAE,SAAS;AAC3B,IAAA,mBAAmB,EAAE,SAAS;AAC9B,IAAA,YAAY,EAAE,SAAS;AACvB,IAAA,qBAAqB,EAAE,SAAS;AAChC,IAAA,cAAc,EAAE,SAAS;AACzB,IAAA,aAAa,EAAE,SAA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,CAAA,CAAA,CAAG,CAAC;YAE1D;AACG,iBAAA,IAAI;AACJ,iBAAA,IAAI,CAAC,CAAC,UAAU,KAAI;AACnB,gBAAA,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC;AAC9B,gBAAA,OAAO,EAAE;AACX,YAAA,CAAC;iBACA,KAAK,CAAC,MAAK;;AAEV,gBAAA,OAAO,CAAC,IAAI,CAAC,uBAAuB,QAAQ,CAAA,SAAA,CAAW,CAAC;gBACxD,OAAO,EAAE,CAAC;AACZ,YAAA,CAAC,CAAC;AACN,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC;IAED,QACEC,wBAAK,SAAS,EAAE,qBAAqB,SAAS,CAAA,CAAE,EAAE,KAAK,EAAE,KAAK,YAC5DA,cAAA,CAAA,QAAA,EAAA,EAAQ,GAAG,EAAE,SAAS,EAAE,SAAS,EAAC,0BAA0B,EAAA,CAAG,EAAA,CAC3D;AAEV;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/components/EmbroideryQCImage.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React, { useState, useEffect, useRef } from \"react\";\r\nimport { EmbroideryQCImageProps, Position } from \"../types\";\r\nimport \"./EmbroideryQCImage.css\";\r\n\r\n// Color mapping\r\nconst COLOR_MAP: Record<string, string> = {\r\n \"Army (1394)\": \"#4B5320\",\r\n Army: \"#4B5320\",\r\n \"Black (8)\": \"#000000\",\r\n Black: \"#000000\",\r\n \"Bubblegum (1309)\": \"#FFC1CC\",\r\n Bubblegum: \"#FFC1CC\",\r\n \"Carolina Blue (1274)\": \"#7BAFD4\",\r\n \"Carolina Blue\": \"#7BAFD4\",\r\n \"Celadon (1098)\": \"#ACE1AF\",\r\n Celadon: \"#ACE1AF\",\r\n \"Coffee Bean (1145)\": \"#6F4E37\",\r\n \"Coffee Bean\": \"#6F4E37\",\r\n \"Daffodil (1180)\": \"#FFFF31\",\r\n Daffodil: \"#FFFF31\",\r\n \"Dark Gray (1131)\": \"#A9A9A9\",\r\n \"Dark Gray\": \"#A9A9A9\",\r\n \"Doe Skin Beige (1344)\": \"#F5E6D3\",\r\n \"Doe Skin Beige\": \"#F5E6D3\",\r\n \"Dusty Blue (1373)\": \"#6699CC\",\r\n \"Dusty Blue\": \"#6699CC\",\r\n \"Forest Green (1397)\": \"#228B22\",\r\n \"Forest Green\": \"#228B22\",\r\n \"Gold (1425)\": \"#FFD700\",\r\n Gold: \"#FFD700\",\r\n \"Gray (1118)\": \"#808080\",\r\n Gray: \"#808080\",\r\n \"Ivory (1072)\": \"#FFFFF0\",\r\n Ivory: \"#FFFFF0\",\r\n \"Lavender (1032)\": \"#E6E6FA\",\r\n Lavender: \"#E6E6FA\",\r\n \"Light Denim (1133)\": \"#B0C4DE\",\r\n \"Light Denim\": \"#B0C4DE\",\r\n \"Light Salmon (1018)\": \"#FFA07A\",\r\n \"Light Salmon\": \"#FFA07A\",\r\n \"Maroon (1374)\": \"#800000\",\r\n Maroon: \"#800000\",\r\n \"Navy Blue (1044)\": \"#000080\",\r\n \"Navy Blue\": \"#000080\",\r\n \"Olive Green (1157)\": \"#556B2F\",\r\n \"Olive Green\": \"#556B2F\",\r\n \"Orange (1278)\": \"#FFA500\",\r\n Orange: \"#FFA500\",\r\n \"Peach Blush (1053)\": \"#FFCCCB\",\r\n \"Peach Blush\": \"#FFCCCB\",\r\n \"Pink (1148)\": \"#FFC0CB\",\r\n Pink: \"#FFC0CB\",\r\n \"Purple (1412)\": \"#800080\",\r\n Purple: \"#800080\",\r\n \"Red (1037)\": \"#FF0000\",\r\n Red: \"#FF0000\",\r\n \"Silver Sage (1396)\": \"#A8A8A8\",\r\n \"Silver Sage\": \"#A8A8A8\",\r\n \"Summer Sky (1432)\": \"#87CEEB\",\r\n \"Summer Sky\": \"#87CEEB\",\r\n \"Terra Cotta (1477)\": \"#E2725B\",\r\n \"Terra Cotta\": \"#E2725B\",\r\n \"Sand (1055)\": \"#F4A460\",\r\n Sand: \"#F4A460\",\r\n \"White (9)\": \"#FFFFFF\",\r\n White: \"#FFFFFF\",\r\n};\r\n\r\nconst FONT_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/fonts\";\r\nconst ICON_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/icons\";\r\nconst FLORAL_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/florals\";\r\nconst THREAD_COLOR_BASE_URL =\r\n \"https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/thread-colors\";\r\n\r\nconst EmbroideryQCImage: React.FC<EmbroideryQCImageProps> = ({\r\n config,\r\n className = \"\",\r\n style = {},\r\n}) => {\r\n const [canvasSize] = useState({ width: 4200, height: 4800 });\r\n const [loadedFonts, setLoadedFonts] = useState<Set<string>>(new Set());\r\n const [imagesLoaded, setImagesLoaded] = useState(0);\r\n const canvasRef = useRef<HTMLCanvasElement>(null);\r\n const imageRefs = useRef<Map<string, HTMLImageElement>>(new Map());\r\n\r\n // Load fonts\r\n useEffect(() => {\r\n const loadFonts = async () => {\r\n if (!config.sides || config.sides.length === 0) return;\r\n\r\n const fontsToLoad = new Set<string>();\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"TEXT\" && position.font) {\r\n fontsToLoad.add(position.font);\r\n }\r\n });\r\n });\r\n\r\n for (const fontName of fontsToLoad) {\r\n if (loadedFonts.has(fontName)) continue;\r\n\r\n try {\r\n await loadFont(fontName);\r\n setLoadedFonts((prev) => new Set(prev).add(fontName));\r\n } catch (error) {\r\n console.warn(`Could not load font ${fontName}:`, error);\r\n }\r\n }\r\n };\r\n\r\n loadFonts();\r\n }, [config.sides, loadedFonts]);\r\n\r\n // Load images\r\n useEffect(() => {\r\n const loadImages = async () => {\r\n if (!config.sides || config.sides.length === 0) return;\r\n\r\n // Load mockup image (not background). It will be drawn at bottom-right.\r\n if (config.image_url) {\r\n // Try with CORS first. If it fails (no CORS headers), retry without CORS\r\n const loadMockup = (useCors: boolean) => {\r\n const img = new Image();\r\n if (useCors) img.crossOrigin = \"anonymous\";\r\n img.onload = () => {\r\n imageRefs.current.set(\"mockup\", img);\r\n setImagesLoaded((prev) => prev + 1);\r\n };\r\n img.onerror = () => {\r\n if (useCors) {\r\n // Retry without CORS; canvas may become tainted on export\r\n loadMockup(false);\r\n }\r\n };\r\n img.src = config.image_url as string;\r\n };\r\n loadMockup(true);\r\n }\r\n\r\n // Load icons\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"ICON\") {\r\n const iconUrl = `${ICON_BASE_URL}/${position.icon}.png`;\r\n if (!imageRefs.current.has(iconUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = iconUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(iconUrl, img);\r\n }\r\n }\r\n\r\n if (position.type === \"TEXT\" && position.floral_pattern) {\r\n const floralUrl = `${FLORAL_BASE_URL}/${position.floral_pattern}.png`;\r\n if (!imageRefs.current.has(floralUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = floralUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(floralUrl, img);\r\n }\r\n }\r\n\r\n // Load thread color images for TEXT positions\r\n if (position.type === \"TEXT\") {\r\n // Load color image if position has color\r\n if (position.color) {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${position.color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n }\r\n\r\n // Load character color images\r\n if (\r\n position.character_colors &&\r\n position.character_colors.length > 0\r\n ) {\r\n position.character_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n });\r\n }\r\n }\r\n\r\n // Load thread color images for ICON positions\r\n if (position.type === \"ICON\" && position.layer_colors) {\r\n position.layer_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n if (!imageRefs.current.has(threadColorUrl)) {\r\n const img = new Image();\r\n img.crossOrigin = \"anonymous\";\r\n img.src = threadColorUrl;\r\n img.onload = () => setImagesLoaded((prev) => prev + 1);\r\n imageRefs.current.set(threadColorUrl, img);\r\n }\r\n });\r\n }\r\n });\r\n });\r\n };\r\n\r\n loadImages();\r\n }, [config]);\r\n\r\n // Render canvas\r\n useEffect(() => {\r\n const renderCanvas = () => {\r\n if (!canvasRef.current || !config.sides || config.sides.length === 0) {\r\n return;\r\n }\r\n\r\n const canvas = canvasRef.current;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) return;\r\n\r\n canvas.width = canvasSize.width;\r\n canvas.height = canvasSize.height;\r\n\r\n // Clear with white background\r\n ctx.fillStyle = \"#FFFFFF\";\r\n ctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\r\n // Collect floral images (for later drawing)\r\n const floralAssets: HTMLImageElement[] = [];\r\n const seenFlorals = new Set<string>();\r\n if (config.sides) {\r\n config.sides.forEach((side) => {\r\n side.postitions.forEach((position) => {\r\n if (position.type === \"TEXT\" && position.floral_pattern) {\r\n const floralUrl = `${FLORAL_BASE_URL}/${position.floral_pattern}.png`;\r\n if (!seenFlorals.has(floralUrl)) {\r\n const img = imageRefs.current.get(floralUrl);\r\n if (img && img.complete && img.naturalWidth > 0) {\r\n floralAssets.push(img);\r\n seenFlorals.add(floralUrl);\r\n }\r\n }\r\n }\r\n });\r\n });\r\n }\r\n\r\n // Helper function to draw mockup and florals\r\n const drawMockupAndFlorals = () => {\r\n const mockupImg = imageRefs.current.get(\"mockup\");\r\n const margin = 40; // small padding\r\n let mockupBox: { x: number; y: number; w: number; h: number } | null =\r\n null;\r\n if (mockupImg && mockupImg.complete && mockupImg.naturalWidth > 0) {\r\n const maxTargetWidth = Math.min(1800, canvas.width * 0.375);\r\n const maxTargetHeight = canvas.height * 0.375;\r\n const scale = Math.min(\r\n maxTargetWidth / mockupImg.naturalWidth,\r\n maxTargetHeight / mockupImg.naturalHeight\r\n );\r\n const targetWidth = Math.max(\r\n 1,\r\n Math.floor(mockupImg.naturalWidth * scale)\r\n );\r\n const targetHeight = Math.max(\r\n 1,\r\n Math.floor(mockupImg.naturalHeight * scale)\r\n );\r\n const targetX = canvas.width - margin - targetWidth;\r\n const targetY = canvas.height - margin - targetHeight;\r\n mockupBox = {\r\n x: targetX,\r\n y: targetY,\r\n w: targetWidth,\r\n h: targetHeight,\r\n };\r\n ctx.drawImage(mockupImg, targetX, targetY, targetWidth, targetHeight);\r\n }\r\n\r\n // Draw florals to the left of mockup\r\n if (mockupBox && floralAssets.length > 0) {\r\n const spacing = 300;\r\n const targetHeight = mockupBox.h;\r\n const floralFixedH = Math.min(900, targetHeight);\r\n let currentX = mockupBox.x - spacing;\r\n for (let i = floralAssets.length - 1; i >= 0; i--) {\r\n const img = floralAssets[i];\r\n const ratio = img.naturalWidth / Math.max(1, img.naturalHeight);\r\n const h = floralFixedH;\r\n const w = Math.max(1, Math.floor(h * ratio));\r\n currentX -= w;\r\n const y = mockupBox.y + (targetHeight - h);\r\n ctx.drawImage(img, currentX, y, w, h);\r\n currentX -= spacing;\r\n }\r\n }\r\n };\r\n\r\n // New approach: Draw images first (bottom layer), then text on top\r\n // This allows text to overlay images when needed\r\n\r\n // Pass 1: Measure actual height with original size (use offscreen canvas for measurement)\r\n const measureCanvas = document.createElement(\"canvas\");\r\n measureCanvas.width = canvas.width;\r\n measureCanvas.height = canvas.height;\r\n const measureCtx = measureCanvas.getContext(\"2d\");\r\n if (!measureCtx) return;\r\n\r\n // Set up measurement context\r\n measureCtx.font = ctx.font;\r\n measureCtx.textAlign = ctx.textAlign;\r\n measureCtx.textBaseline = ctx.textBaseline;\r\n\r\n let measureY = 40;\r\n const measureSpacing = 100;\r\n config.sides.forEach((side) => {\r\n const sideHeight = renderSide(\r\n measureCtx,\r\n side,\r\n measureY,\r\n canvas.width,\r\n 1\r\n );\r\n measureY += sideHeight + measureSpacing;\r\n });\r\n const totalMeasuredHeight = measureY; // Total height used\r\n\r\n // Calculate scale factor - only scale down when necessary\r\n // Keep original font sizes (no scale up) - font size is the maximum\r\n const topPadding = 40;\r\n // No bottom padding - content can go to bottom, mockup will overlay\r\n const targetContentHeight = canvas.height - topPadding;\r\n\r\n // Only scale down if content exceeds canvas height\r\n // Never scale up - preserve original font sizes\r\n let scaleFactor = 1;\r\n if (totalMeasuredHeight > targetContentHeight) {\r\n // Scale down to fit exactly\r\n scaleFactor = targetContentHeight / totalMeasuredHeight;\r\n scaleFactor = Math.max(0.5, scaleFactor); // Minimum scale to prevent tiny fonts\r\n }\r\n // If content fits, keep scaleFactor = 1 (original font sizes)\r\n\r\n // Draw mockup and florals first (bottom layer)\r\n drawMockupAndFlorals();\r\n\r\n // Draw content on top (top layer) - text will overlay images if needed\r\n let currentY = topPadding * scaleFactor;\r\n config.sides.forEach((side) => {\r\n const sideHeight = renderSide(\r\n ctx,\r\n side,\r\n currentY,\r\n canvas.width,\r\n scaleFactor\r\n );\r\n currentY += sideHeight + measureSpacing * scaleFactor;\r\n });\r\n };\r\n\r\n // Delay rendering to ensure fonts and images are loaded\r\n const timer = setTimeout(renderCanvas, 100);\r\n return () => clearTimeout(timer);\r\n }, [config, canvasSize, loadedFonts, imagesLoaded]);\r\n\r\n // Helper function to wrap and draw text with word wrapping\r\n // Returns: { height: number, lastLineWidth: number, lastLineY: number }\r\n const fillTextWrapped = (\r\n ctx: CanvasRenderingContext2D,\r\n text: string,\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n lineHeight: number\r\n ): { height: number; lastLineWidth: number; lastLineY: number } => {\r\n const words = text.split(\" \");\r\n const lines: string[] = [];\r\n let currentLine = words[0];\r\n\r\n for (let i = 1; i < words.length; i++) {\r\n const word = words[i];\r\n const testLine = currentLine + \" \" + word;\r\n const metrics = ctx.measureText(testLine);\r\n if (metrics.width > maxWidth && currentLine.length > 0) {\r\n lines.push(currentLine);\r\n currentLine = word;\r\n } else {\r\n currentLine = testLine;\r\n }\r\n }\r\n lines.push(currentLine);\r\n\r\n let currentY = y;\r\n lines.forEach((line) => {\r\n ctx.fillText(line, x, currentY);\r\n currentY += lineHeight;\r\n });\r\n\r\n const lastLineWidth = ctx.measureText(lines[lines.length - 1]).width;\r\n const lastLineY = y + (lines.length - 1) * lineHeight;\r\n\r\n return {\r\n height: lines.length * lineHeight,\r\n lastLineWidth,\r\n lastLineY,\r\n };\r\n };\r\n\r\n // Helper to wrap and draw multi-color text (for character_colors)\r\n const fillTextWrappedMultiColor = (\r\n ctx: CanvasRenderingContext2D,\r\n text: string,\r\n colors: string[],\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n lineHeight: number\r\n ): number => {\r\n const words = text.split(\" \");\r\n const lines: string[] = [];\r\n const lineStartIndices: number[] = [0];\r\n let currentLine = words[0];\r\n let currentCharIndex = words[0].length;\r\n\r\n for (let i = 1; i < words.length; i++) {\r\n const word = words[i];\r\n const testLine = currentLine + \" \" + word;\r\n const metrics = ctx.measureText(testLine);\r\n if (metrics.width > maxWidth && currentLine.length > 0) {\r\n lines.push(currentLine);\r\n lineStartIndices.push(currentCharIndex + 1); // +1 for space\r\n currentLine = word;\r\n currentCharIndex += word.length + 1;\r\n } else {\r\n currentLine = testLine;\r\n currentCharIndex += word.length + 1;\r\n }\r\n }\r\n lines.push(currentLine);\r\n\r\n let currentY = y;\r\n lines.forEach((line, lineIdx) => {\r\n let currentX = x;\r\n const startCharIdx = lineIdx > 0 ? lineStartIndices[lineIdx] : 0;\r\n for (let i = 0; i < line.length; i++) {\r\n const char = line[i];\r\n const globalCharIdx = startCharIdx + i;\r\n const colorIndex = globalCharIdx % colors.length;\r\n const color = colors[colorIndex];\r\n ctx.fillStyle = COLOR_MAP[color] || \"#000000\";\r\n ctx.fillText(char, currentX, currentY);\r\n currentX += ctx.measureText(char).width;\r\n }\r\n currentY += lineHeight;\r\n });\r\n\r\n return lines.length * lineHeight;\r\n };\r\n\r\n const renderSide = (\r\n ctx: CanvasRenderingContext2D,\r\n side: any,\r\n startY: number,\r\n width: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n let currentY = startY;\r\n const padding = 40 * scaleFactor;\r\n const sideWidth = width - 2 * padding;\r\n const sectionHeight = 200 * scaleFactor;\r\n\r\n // No background section anymore - just white background\r\n\r\n // Group positions by common properties for optimization\r\n const textGroups: Array<{\r\n positions: Array<Position & { type: \"TEXT\" }>;\r\n properties: any;\r\n }> = [];\r\n let currentGroup: Array<Position & { type: \"TEXT\" }> | null = null;\r\n let currentProps: any = null;\r\n\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"TEXT\") {\r\n if (\r\n !currentGroup ||\r\n currentProps.font !== position.font ||\r\n currentProps.text_shape !== position.text_shape ||\r\n currentProps.color !== position.color ||\r\n currentProps.character_colors?.join(\",\") !==\r\n position.character_colors?.join(\",\")\r\n ) {\r\n // Start new group\r\n if (currentGroup) {\r\n textGroups.push({\r\n positions: currentGroup,\r\n properties: currentProps,\r\n });\r\n }\r\n currentGroup = [position];\r\n currentProps = {\r\n font: position.font,\r\n text_shape: position.text_shape,\r\n color: position.color,\r\n character_colors: position.character_colors,\r\n };\r\n } else {\r\n currentGroup.push(position);\r\n }\r\n }\r\n });\r\n\r\n if (currentGroup) {\r\n textGroups.push({ positions: currentGroup, properties: currentProps });\r\n }\r\n\r\n // Draw side header\r\n ctx.save();\r\n const headerFontSize = 200 * scaleFactor;\r\n ctx.font = `bold ${headerFontSize}px Times New Roman`;\r\n ctx.fillStyle = \"#000000\";\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n const headerResult = fillTextWrapped(\r\n ctx,\r\n side.print_side.toUpperCase(),\r\n padding,\r\n currentY,\r\n sideWidth,\r\n headerFontSize\r\n );\r\n currentY += headerResult.height + 50 * scaleFactor;\r\n ctx.restore();\r\n\r\n // Compute side-level uniform properties across all TEXT positions\r\n const allTextPositions: Array<Position & { type: \"TEXT\" }> = [];\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"TEXT\") allTextPositions.push(position as any);\r\n });\r\n\r\n const sideFonts = new Set(allTextPositions.map((p) => (p as any).font));\r\n const sideShapes = new Set(\r\n allTextPositions.map((p) => (p as any).text_shape)\r\n );\r\n const sideFlorals = new Set(\r\n allTextPositions.map((p) => (p as any).floral_pattern ?? \"None\")\r\n );\r\n const colorKeyOf = (p: any) =>\r\n p.character_colors && p.character_colors.length > 0\r\n ? p.character_colors.join(\",\")\r\n : p.color ?? \"None\";\r\n const sideColors = new Set(allTextPositions.map((p) => colorKeyOf(p)));\r\n\r\n const sideUniform = {\r\n font: sideFonts.size === 1,\r\n shape: sideShapes.size === 1,\r\n floral: sideFlorals.size === 1,\r\n color: sideColors.size === 1,\r\n };\r\n\r\n // Render side-level labels once for uniform properties\r\n currentY += renderSideUniformLabels(\r\n ctx,\r\n {\r\n font: sideUniform.font ? [...sideFonts][0] : null,\r\n shape: sideUniform.shape ? [...sideShapes][0] : null,\r\n floral: sideUniform.floral ? [...sideFlorals][0] : null,\r\n color: sideUniform.color ? [...sideColors][0] : null,\r\n },\r\n padding,\r\n currentY,\r\n sideWidth,\r\n scaleFactor\r\n );\r\n\r\n // Render text groups first\r\n let sideTextCounter = 1;\r\n textGroups.forEach((group, groupIndex) => {\r\n group.positions.forEach((position, index) => {\r\n if (index === 0 && groupIndex !== 0) currentY += 50 * scaleFactor;\r\n const drawnHeight = renderText(\r\n ctx,\r\n position,\r\n padding,\r\n currentY,\r\n sideWidth,\r\n sideTextCounter,\r\n {\r\n font: !sideUniform.font,\r\n shape: !sideUniform.shape,\r\n floral: !sideUniform.floral,\r\n color: !sideUniform.color,\r\n },\r\n scaleFactor\r\n );\r\n sideTextCounter += 1;\r\n // add padding only if something was actually drawn\r\n if (drawnHeight > 0) {\r\n currentY += drawnHeight + 40 * scaleFactor;\r\n }\r\n });\r\n });\r\n\r\n // Render ICON titles/values (no images here)\r\n currentY += 30 * scaleFactor; // minimal spacing before icon labels\r\n side.postitions.forEach((position: Position) => {\r\n if (position.type === \"ICON\") {\r\n currentY += renderIconLabels(\r\n ctx,\r\n position as any,\r\n padding,\r\n currentY,\r\n sideWidth,\r\n scaleFactor\r\n );\r\n currentY += 10 * scaleFactor;\r\n }\r\n });\r\n\r\n return Math.max(currentY - startY, sectionHeight);\r\n };\r\n\r\n const renderSideUniformLabels = (\r\n ctx: CanvasRenderingContext2D,\r\n values: {\r\n font: string | null;\r\n shape: string | null;\r\n floral: string | null;\r\n color: string | null;\r\n },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n const labelFontFamily = \"Arial\";\r\n const fontSize = 180 * scaleFactor;\r\n const lineGap = 20 * scaleFactor;\r\n ctx.save();\r\n ctx.font = `${fontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let cursorY = y;\r\n let rendered = 0;\r\n if (values.font) {\r\n const fontText = `Font: ${values.font}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n fontText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.shape && values.shape !== \"None\") {\r\n const shapeText = `Kiểu chữ: ${values.shape}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n shapeText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.color && values.color !== \"None\") {\r\n const colorText = `Màu chỉ: ${values.color}`;\r\n // Reserve space for swatches (estimate: max 5 swatches × 200px each = 1000px)\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const result = fillTextWrapped(\r\n ctx,\r\n colorText,\r\n x,\r\n cursorY,\r\n textMaxWidth,\r\n fontSize + lineGap\r\n );\r\n // Draw swatches inline for side-level color, preserving aspect ratio; 75% of previous size\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(fontSize * 2.025);\r\n let swatchX = x + Math.ceil(result.lastLineWidth) + 100 * scaleFactor;\r\n const swatchY = result.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n const colorTokens = values.color.includes(\",\")\r\n ? values.color.split(\",\").map((s) => s.trim())\r\n : [values.color];\r\n colorTokens.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor;\r\n }\r\n });\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (values.floral && values.floral !== \"None\") {\r\n const floralText = `Mẫu hoa: ${values.floral}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n floralText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n cursorY += result.height;\r\n rendered++;\r\n }\r\n if (rendered > 0) cursorY += 50 * scaleFactor; // extra gap before first text line\r\n\r\n ctx.restore();\r\n return cursorY - y;\r\n };\r\n\r\n const renderText = (\r\n ctx: CanvasRenderingContext2D,\r\n position: Position & { type: \"TEXT\" },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n displayIndex: number,\r\n showLabels: {\r\n font: boolean;\r\n shape: boolean;\r\n floral: boolean;\r\n color: boolean;\r\n },\r\n scaleFactor: number = 1\r\n ): number => {\r\n ctx.save();\r\n\r\n // Info labels\r\n // Unified font sizing for labels and content (side title uses its own larger size)\r\n const infoLineGap = 30 * scaleFactor;\r\n const labelFontFamily = \"Arial\";\r\n // Use a unified content font size for both labels and text content\r\n const fontSize = 180 * scaleFactor;\r\n const infoFontSize = fontSize;\r\n ctx.font = `${infoFontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let currentYCursor = y;\r\n let drawnHeight = 0; // accumulate only when something is actually drawn\r\n\r\n // Text value with unified font size\r\n let displayText = position.text;\r\n if (position.change_character_to_heart && displayText.includes(\"<3\")) {\r\n displayText = displayText.replace(/<3/g, \"❤\");\r\n }\r\n\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n\r\n // Label for text line\r\n const textLabel = `Text ${displayIndex}: `;\r\n ctx.font = `bold ${fontSize}px ${labelFontFamily}`;\r\n const labelWidth = ctx.measureText(textLabel).width;\r\n ctx.fillStyle = \"#444444\";\r\n ctx.fillText(textLabel, x, currentYCursor);\r\n\r\n // Calculate available width for text content\r\n const textMaxWidth = maxWidth - labelWidth;\r\n\r\n // Handle character_colors (alternating colors)\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n // Switch to content font\r\n ctx.font = `${fontSize}px ${position.font}`;\r\n const textHeight = fillTextWrappedMultiColor(\r\n ctx,\r\n displayText,\r\n position.character_colors,\r\n x + labelWidth,\r\n currentYCursor,\r\n textMaxWidth,\r\n fontSize\r\n );\r\n currentYCursor += textHeight;\r\n drawnHeight += textHeight;\r\n } else {\r\n // No color specified\r\n // Draw text in content font, black (non-bold)\r\n ctx.font = `${fontSize}px ${position.font}`;\r\n ctx.fillStyle = COLOR_MAP[position.color ?? \"None\"] || \"#000000\";\r\n const textResult = fillTextWrapped(\r\n ctx,\r\n displayText,\r\n x + labelWidth,\r\n currentYCursor,\r\n textMaxWidth,\r\n fontSize\r\n );\r\n currentYCursor += textResult.height;\r\n drawnHeight += textResult.height;\r\n }\r\n\r\n // After text, print Kiểu chữ (when not uniform), then Font and Color as needed\r\n currentYCursor += infoLineGap;\r\n ctx.font = `${infoFontSize}px ${labelFontFamily}`;\r\n ctx.fillStyle = \"#444444\";\r\n if (showLabels.shape && position.text_shape) {\r\n const shapeLabelAfter = `Kiểu chữ: ${position.text_shape}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n shapeLabelAfter,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n if (showLabels.font && position.font) {\r\n const fontLabel = `Font: ${position.font}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n fontLabel,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n if (showLabels.color) {\r\n let colorLabelValue = \"None\";\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n colorLabelValue = position.character_colors.join(\", \");\r\n } else if (position.color) {\r\n colorLabelValue = position.color;\r\n }\r\n if (colorLabelValue !== \"None\") {\r\n const colorLabel = `Màu chỉ: ${colorLabelValue}`;\r\n // Reserve space for swatches\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const result = fillTextWrapped(\r\n ctx,\r\n colorLabel,\r\n x,\r\n currentYCursor,\r\n textMaxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n\r\n // Draw color swatch images inline with Color label for TEXT, preserve aspect ratio; 75% of previous size\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(infoFontSize * 2.025);\r\n let swatchX = x + Math.ceil(result.lastLineWidth) + 100 * scaleFactor; // spacing after text\r\n const swatchY =\r\n result.lastLineY + Math.floor(infoFontSize / 2 - swatchH / 2);\r\n if (position.character_colors && position.character_colors.length > 0) {\r\n position.character_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor;\r\n }\r\n });\r\n } else if (position.color) {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${position.color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n }\r\n }\r\n\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n }\r\n\r\n // Show floral label after color block when not uniform at side level\r\n if (showLabels.floral && position.floral_pattern) {\r\n const floralText = `Mẫu hoa: ${position.floral_pattern}`;\r\n const result = fillTextWrapped(\r\n ctx,\r\n floralText,\r\n x,\r\n currentYCursor,\r\n maxWidth,\r\n infoFontSize + infoLineGap\r\n );\r\n currentYCursor += result.height;\r\n drawnHeight += result.height;\r\n }\r\n\r\n // (Floral per-position label is printed above the text when needed; avoid duplicate after text)\r\n\r\n ctx.restore();\r\n return drawnHeight;\r\n };\r\n\r\n const renderIconLabels = (\r\n ctx: CanvasRenderingContext2D,\r\n position: Position & { type: \"ICON\" },\r\n x: number,\r\n y: number,\r\n maxWidth: number,\r\n scaleFactor: number = 1\r\n ): number => {\r\n const labelFontFamily = \"Arial\";\r\n const fontSize = 180 * scaleFactor;\r\n const lineGap = 30 * scaleFactor;\r\n ctx.save();\r\n ctx.font = `${fontSize}px ${labelFontFamily}`;\r\n ctx.textAlign = \"left\";\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"#444444\";\r\n\r\n let cursorY = y;\r\n const iconText = `Icon: ${position.icon}`;\r\n const iconResult = fillTextWrapped(\r\n ctx,\r\n iconText,\r\n x,\r\n cursorY,\r\n maxWidth,\r\n fontSize + lineGap\r\n );\r\n // draw icon image inline with text, preserve aspect ratio; match line height\r\n const iconUrl = `${ICON_BASE_URL}/${position.icon}.png`;\r\n {\r\n const img = imageRefs.current.get(iconUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const swatchH = fontSize;\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n // Put icon on last line of wrapped text\r\n const iconX =\r\n x + Math.ceil(iconResult.lastLineWidth) + 100 * scaleFactor;\r\n const iconY =\r\n iconResult.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n ctx.drawImage(img, iconX, iconY, swatchW, swatchH);\r\n }\r\n }\r\n cursorY += iconResult.height;\r\n\r\n // Draw color line only when there are layer colors\r\n if (position.layer_colors && position.layer_colors.length > 0) {\r\n const colorLabelValue = position.layer_colors.join(\", \");\r\n const colorText = `Màu chỉ: ${colorLabelValue}`;\r\n // Reserve space for swatches\r\n const swatchReserved = 1000 * scaleFactor;\r\n const textMaxWidth = Math.max(\r\n 400 * scaleFactor,\r\n maxWidth - swatchReserved\r\n );\r\n const colorResult = fillTextWrapped(\r\n ctx,\r\n colorText,\r\n x,\r\n cursorY,\r\n textMaxWidth,\r\n fontSize + lineGap\r\n );\r\n\r\n // Draw color swatch images (only for icon)\r\n // Position swatches after the last line of wrapped text\r\n const swatchH = Math.floor(fontSize * 2.025); // 75% of previous size\r\n let swatchX =\r\n x + Math.ceil(colorResult.lastLineWidth) + 100 * scaleFactor; // spacing after text\r\n const swatchY =\r\n colorResult.lastLineY + Math.floor(fontSize / 2 - swatchH / 2);\r\n position.layer_colors.forEach((color) => {\r\n const threadColorUrl = `${THREAD_COLOR_BASE_URL}/${color}.png`;\r\n const img = imageRefs.current.get(threadColorUrl);\r\n if (img && img.complete && img.naturalHeight > 0) {\r\n const ratio = img.naturalWidth / img.naturalHeight;\r\n const swatchW = Math.max(1, Math.floor(swatchH * ratio));\r\n ctx.drawImage(img, swatchX, swatchY, swatchW, swatchH);\r\n swatchX += swatchW + 25 * scaleFactor; // spacing between swatches\r\n }\r\n });\r\n cursorY += colorResult.height;\r\n }\r\n\r\n ctx.restore();\r\n return cursorY - y;\r\n };\r\n\r\n const loadFont = (fontName: string): Promise<void> => {\r\n return new Promise((resolve, reject) => {\r\n // Try to load from CDN\r\n const fontUrl = `${FONT_BASE_URL}/${fontName}.woff2`;\r\n const fontFace = new FontFace(fontName, `url(${fontUrl})`);\r\n\r\n fontFace\r\n .load()\r\n .then((loadedFont) => {\r\n document.fonts.add(loadedFont);\r\n resolve();\r\n })\r\n .catch(() => {\r\n // Font loading failed, will use fallback\r\n console.warn(`Could not load font ${fontName} from CDN`);\r\n resolve(); // Still resolve to not block rendering\r\n });\r\n });\r\n };\r\n\r\n return (\r\n <div className={`render-embroidery${className ? ` ${className}` : \"\"}`} style={style}>\r\n <canvas ref={canvasRef} className=\"render-embroidery-canvas\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@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "embroidery-qc-image",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "React component for rendering embroidery QC images",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -53,4 +53,4 @@
|
|
|
53
53
|
"vite": "^5.0.8"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {}
|
|
56
|
-
}
|
|
56
|
+
}
|
package/dist/index.css
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
.render-embroidery {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
position: relative;
|
|
4
|
-
width: 100%;
|
|
5
|
-
max-width: 100%;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.render-embroidery-canvas {
|
|
9
|
-
display: block;
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: auto;
|
|
12
|
-
image-rendering: high-quality;
|
|
13
|
-
background: transparent;
|
|
14
|
-
}
|
package/dist/index.esm.css
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
.render-embroidery {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
position: relative;
|
|
4
|
-
width: 100%;
|
|
5
|
-
max-width: 100%;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.render-embroidery-canvas {
|
|
9
|
-
display: block;
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: auto;
|
|
12
|
-
image-rendering: high-quality;
|
|
13
|
-
background: transparent;
|
|
14
|
-
}
|