abstract-image 7.0.1 → 7.2.3
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/lib/exporters/__tests__/exception/react-svg-direction-exception.test.js +14 -16
- package/lib/exporters/__tests__/exception/react-svg-direction-exception.test.js.map +1 -1
- package/lib/exporters/__tests__/exception/svg-direction-exception.test.js +1 -1
- package/lib/exporters/__tests__/exception/svg-direction-exception.test.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-png.d.ts.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-png.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-png.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-url.d.ts.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-url.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-url.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary.d.ts.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-ellipse.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-ellipse.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-empty-text.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-empty-text.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-group.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-group.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-line.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-line.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polygon.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polygon.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polyline.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polyline.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-rectangle.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-rectangle.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-subimage.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-subimage.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-bold.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-bold.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-growth-directions.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-growth-directions.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-italic.js +2 -2
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-italic.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-sub.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-sub.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text.js.map +1 -1
- package/lib/exporters/react-svg-export-image.d.ts.map +1 -1
- package/lib/exporters/react-svg-export-image.js +24 -56
- package/lib/exporters/react-svg-export-image.js.map +1 -1
- package/lib/exporters/svg-export-image.js +3 -9
- package/lib/exporters/svg-export-image.js.map +1 -1
- package/lib/model/component.d.ts.map +1 -1
- package/lib/model/component.js +14 -18
- package/lib/model/component.js.map +1 -1
- package/package.json +2 -2
- package/src/exporters/__tests__/exception/react-svg-direction-exception.test.tsx +55 -56
- package/src/exporters/__tests__/exception/svg-direction-exception.test.tsx +1 -3
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-png.tsx +2 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-url.tsx +2 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary.tsx +2 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-ellipse.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-empty-text.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-group.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-line.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polygon.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polyline.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-rectangle.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-subimage.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-bold.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-growth-directions.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-italic.tsx +2 -2
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-sub.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text.tsx +1 -1
- package/src/exporters/react-svg-export-image.tsx +80 -80
- package/src/exporters/svg-export-image.ts +3 -21
- package/src/model/component.ts +14 -18
|
@@ -31,5 +31,5 @@ export const test: ExportTestDef = {
|
|
|
31
31
|
name: "react svg text sub",
|
|
32
32
|
abstractImage: svg,
|
|
33
33
|
expectedSerializedJsx:
|
|
34
|
-
'{"type":"svg","key":null,"ref":null,"props":{"id":"ai_root","width":"400px","height":"400px","viewBox":"0 0 400 400","children":[{"
|
|
34
|
+
'{"type":"svg","key":null,"ref":null,"props":{"id":"ai_root","width":"400px","height":"400px","viewBox":"0 0 400 400","children":[{"key":"0","ref":null,"props":{"component":{"type":"text","position":{"x":10,"y":10},"text":"Hello <sub>World</sub>","fontFamily":"Arial","fontSize":12,"textColor":{"a":255,"r":0,"g":0,"b":0},"fontWeight":"bold","clockwiseRotationDegrees":0,"textAlignment":"center","horizontalGrowthDirection":"right","verticalGrowthDirection":"down","strokeThickness":2,"strokeColor":{"a":255,"r":255,"g":0,"b":0},"italic":false}},"_owner":null,"_store":{}}]},"_owner":null,"_store":{}}',
|
|
35
35
|
};
|
|
@@ -31,5 +31,5 @@ export const test: ExportTestDef = {
|
|
|
31
31
|
name: "react svg text",
|
|
32
32
|
abstractImage: svg,
|
|
33
33
|
expectedSerializedJsx:
|
|
34
|
-
'{"type":"svg","key":null,"ref":null,"props":{"id":"ai_root","width":"400px","height":"400px","viewBox":"0 0 400 400","children":[{"
|
|
34
|
+
'{"type":"svg","key":null,"ref":null,"props":{"id":"ai_root","width":"400px","height":"400px","viewBox":"0 0 400 400","children":[{"key":"0","ref":null,"props":{"component":{"type":"text","position":{"x":10,"y":10},"text":"Hello World","fontFamily":"Arial","fontSize":12,"textColor":{"a":255,"r":0,"g":0,"b":0},"fontWeight":"normal","clockwiseRotationDegrees":0,"textAlignment":"center","horizontalGrowthDirection":"right","verticalGrowthDirection":"down","strokeThickness":2,"strokeColor":{"a":255,"r":255,"g":0,"b":0},"italic":false}},"_owner":null,"_store":{}}]},"_owner":null,"_store":{}}',
|
|
35
35
|
};
|
|
@@ -28,7 +28,9 @@ export function createReactSvg(
|
|
|
28
28
|
onMouseMove={_callback(cb.onMouseMove, id)}
|
|
29
29
|
onContextMenu={_callback(cb.onContextMenu, id)}
|
|
30
30
|
>
|
|
31
|
-
{image.components.
|
|
31
|
+
{image.components.map((c, i) => (
|
|
32
|
+
<Component key={i} component={c} />
|
|
33
|
+
))}
|
|
32
34
|
</svg>
|
|
33
35
|
);
|
|
34
36
|
}
|
|
@@ -66,32 +68,33 @@ function getIdAttr(target: Element | undefined, rootId: string): string | undefi
|
|
|
66
68
|
return parts[1];
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
function
|
|
71
|
+
function Component({ component }: { readonly component: AbstractImage.Component }): JSX.Element {
|
|
70
72
|
switch (component.type) {
|
|
71
73
|
case "group":
|
|
72
|
-
return
|
|
73
|
-
<g
|
|
74
|
-
{component.children.flatMap((c, i) =>
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
return (
|
|
75
|
+
<g name={component.name}>
|
|
76
|
+
{component.children.flatMap((c, i) => (
|
|
77
|
+
<Component key={i} component={c} />
|
|
78
|
+
))}
|
|
79
|
+
</g>
|
|
80
|
+
);
|
|
77
81
|
case "binaryimage":
|
|
78
82
|
const url = getImageUrl(component.format, component.data);
|
|
79
|
-
return
|
|
83
|
+
return (
|
|
80
84
|
<image
|
|
81
|
-
key={key}
|
|
82
85
|
x={component.topLeft.x}
|
|
83
86
|
y={component.topLeft.y}
|
|
84
87
|
width={component.bottomRight.x - component.topLeft.x}
|
|
85
88
|
height={component.bottomRight.y - component.topLeft.y}
|
|
86
89
|
id={makeIdAttr(component.id)}
|
|
87
90
|
href={url}
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
|
|
90
94
|
case "line":
|
|
91
|
-
return
|
|
95
|
+
return (
|
|
92
96
|
<line
|
|
93
97
|
id={makeIdAttr(component.id)}
|
|
94
|
-
key={key}
|
|
95
98
|
x1={component.start.x}
|
|
96
99
|
y1={component.start.y}
|
|
97
100
|
x2={component.end.x}
|
|
@@ -99,73 +102,61 @@ function _visit(key: string, component: AbstractImage.Component): Array<React.Re
|
|
|
99
102
|
stroke={colorToRgb(component.strokeColor)}
|
|
100
103
|
strokeWidth={component.strokeThickness}
|
|
101
104
|
strokeOpacity={colorToOpacity(component.strokeColor)}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
/>
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
case "text": {
|
|
105
109
|
if (!component.text) {
|
|
106
|
-
return
|
|
110
|
+
return <></>;
|
|
107
111
|
}
|
|
108
|
-
const
|
|
112
|
+
const dy = getBaselineAdjustment(component.verticalGrowthDirection);
|
|
113
|
+
const transform = `rotate(${component.clockwiseRotationDegrees} ${component.position.x} ${component.position.y})`;
|
|
114
|
+
const lines: Array<string> = component.text !== null ? component.text.split("\n") : [];
|
|
115
|
+
const tSpans = lines.map((t) => (
|
|
116
|
+
<TSpan
|
|
117
|
+
key={t}
|
|
118
|
+
text={t}
|
|
119
|
+
x={component.position.x}
|
|
120
|
+
y={component.position.y + (lines.indexOf(t) + dy) * component.fontSize}
|
|
121
|
+
fontSize={component.fontSize}
|
|
122
|
+
lineHeight={component.fontSize}
|
|
123
|
+
/>
|
|
124
|
+
));
|
|
109
125
|
|
|
110
|
-
const
|
|
111
|
-
textAnchor: getTextAnchor(component.horizontalGrowthDirection),
|
|
112
|
-
fontSize: component.fontSize.toString() + "px",
|
|
113
|
-
fontWeight: getTextFontWeight(component.fontWeight),
|
|
114
|
-
fontFamily: component.fontFamily,
|
|
115
|
-
stroke: colorToRgb(component.strokeColor),
|
|
116
|
-
strokeWidth: component.strokeThickness,
|
|
117
|
-
};
|
|
118
|
-
const style = {
|
|
126
|
+
const baseStyle = {
|
|
119
127
|
textAnchor: getTextAnchor(component.horizontalGrowthDirection),
|
|
120
128
|
fontSize: component.fontSize.toString() + "px",
|
|
121
129
|
fontWeight: getTextFontWeight(component.fontWeight),
|
|
122
130
|
fontFamily: component.fontFamily,
|
|
123
|
-
fill: colorToRgb(component.textColor),
|
|
124
131
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
component.position.x,
|
|
141
|
-
component.position.y + (lines.indexOf(t) + dy) * lineHeight,
|
|
142
|
-
component.fontSize,
|
|
143
|
-
lineHeight
|
|
144
|
-
)
|
|
145
|
-
);
|
|
146
|
-
let cs: Array<React.ReactElement<{}>> = [];
|
|
147
|
-
if (component.strokeThickness > 0 && component.strokeColor) {
|
|
148
|
-
cs.push(
|
|
149
|
-
<text key={key + "shadow"} style={shadowStyle} transform={transform}>
|
|
132
|
+
return (
|
|
133
|
+
<>
|
|
134
|
+
{component.strokeThickness > 0 && component.strokeColor && (
|
|
135
|
+
<text
|
|
136
|
+
style={{
|
|
137
|
+
...baseStyle,
|
|
138
|
+
stroke: colorToRgb(component.strokeColor),
|
|
139
|
+
strokeWidth: component.strokeThickness,
|
|
140
|
+
}}
|
|
141
|
+
transform={transform}
|
|
142
|
+
>
|
|
143
|
+
{tSpans}
|
|
144
|
+
</text>
|
|
145
|
+
)}
|
|
146
|
+
<text style={{ ...baseStyle, fill: colorToRgb(component.textColor) }} transform={transform}>
|
|
150
147
|
{tSpans}
|
|
151
148
|
</text>
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
cs.push(
|
|
155
|
-
<text key={key} style={style} transform={transform}>
|
|
156
|
-
{tSpans}
|
|
157
|
-
</text>
|
|
149
|
+
</>
|
|
158
150
|
);
|
|
159
|
-
|
|
151
|
+
}
|
|
160
152
|
case "ellipse":
|
|
161
153
|
const rx = Math.abs(component.bottomRight.x - component.topLeft.x) * 0.5;
|
|
162
154
|
const ry = Math.abs(component.bottomRight.y - component.topLeft.y) * 0.5;
|
|
163
155
|
const cx = (component.bottomRight.x + component.topLeft.x) * 0.5;
|
|
164
156
|
const cy = (component.bottomRight.y + component.topLeft.y) * 0.5;
|
|
165
|
-
return
|
|
157
|
+
return (
|
|
166
158
|
<ellipse
|
|
167
159
|
id={makeIdAttr(component.id)}
|
|
168
|
-
key={key}
|
|
169
160
|
cx={cx}
|
|
170
161
|
cy={cy}
|
|
171
162
|
rx={rx}
|
|
@@ -175,40 +166,37 @@ function _visit(key: string, component: AbstractImage.Component): Array<React.Re
|
|
|
175
166
|
strokeOpacity={colorToOpacity(component.strokeColor)}
|
|
176
167
|
fillOpacity={colorToOpacity(component.fillColor)}
|
|
177
168
|
fill={colorToRgb(component.fillColor)}
|
|
178
|
-
|
|
179
|
-
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
180
171
|
case "polyline":
|
|
181
172
|
let linePoints = component.points.map((p) => p.x.toString() + "," + p.y.toString()).join(" ");
|
|
182
|
-
return
|
|
173
|
+
return (
|
|
183
174
|
<polyline
|
|
184
175
|
id={makeIdAttr(component.id)}
|
|
185
|
-
key={key}
|
|
186
176
|
points={linePoints}
|
|
187
177
|
stroke={colorToRgb(component.strokeColor)}
|
|
188
178
|
strokeWidth={component.strokeThickness}
|
|
189
179
|
strokeOpacity={colorToOpacity(component.strokeColor)}
|
|
190
180
|
fill="none"
|
|
191
|
-
|
|
192
|
-
|
|
181
|
+
/>
|
|
182
|
+
);
|
|
193
183
|
case "polygon":
|
|
194
184
|
let points = component.points.map((p) => p.x.toString() + "," + p.y.toString()).join(" ");
|
|
195
|
-
return
|
|
185
|
+
return (
|
|
196
186
|
<polygon
|
|
197
187
|
id={makeIdAttr(component.id)}
|
|
198
|
-
key={key}
|
|
199
188
|
points={points}
|
|
200
189
|
stroke={colorToRgb(component.strokeColor)}
|
|
201
190
|
strokeWidth={component.strokeThickness}
|
|
202
191
|
strokeOpacity={colorToOpacity(component.strokeColor)}
|
|
203
192
|
fillOpacity={colorToOpacity(component.fillColor)}
|
|
204
193
|
fill={colorToRgb(component.fillColor)}
|
|
205
|
-
|
|
206
|
-
|
|
194
|
+
/>
|
|
195
|
+
);
|
|
207
196
|
case "rectangle":
|
|
208
|
-
return
|
|
197
|
+
return (
|
|
209
198
|
<rect
|
|
210
199
|
id={makeIdAttr(component.id)}
|
|
211
|
-
key={key}
|
|
212
200
|
x={component.topLeft.x}
|
|
213
201
|
y={component.topLeft.y}
|
|
214
202
|
width={Math.abs(component.bottomRight.x - component.topLeft.x)}
|
|
@@ -218,10 +206,10 @@ function _visit(key: string, component: AbstractImage.Component): Array<React.Re
|
|
|
218
206
|
strokeOpacity={colorToOpacity(component.strokeColor)}
|
|
219
207
|
fillOpacity={colorToOpacity(component.fillColor)}
|
|
220
208
|
fill={colorToRgb(component.fillColor)}
|
|
221
|
-
|
|
222
|
-
|
|
209
|
+
/>
|
|
210
|
+
);
|
|
223
211
|
default:
|
|
224
|
-
return
|
|
212
|
+
return <></>;
|
|
225
213
|
}
|
|
226
214
|
}
|
|
227
215
|
|
|
@@ -252,7 +240,19 @@ function getImageUrl(format: AbstractImage.BinaryFormat, data: AbstractImage.Ima
|
|
|
252
240
|
}
|
|
253
241
|
}
|
|
254
242
|
|
|
255
|
-
function
|
|
243
|
+
function TSpan({
|
|
244
|
+
text,
|
|
245
|
+
x,
|
|
246
|
+
y,
|
|
247
|
+
fontSize,
|
|
248
|
+
lineHeight,
|
|
249
|
+
}: {
|
|
250
|
+
readonly text: string;
|
|
251
|
+
readonly x: number;
|
|
252
|
+
readonly y: number;
|
|
253
|
+
readonly fontSize: number;
|
|
254
|
+
readonly lineHeight: number;
|
|
255
|
+
}): JSX.Element {
|
|
256
256
|
const split = text.split("<sub>").flatMap((t) => t.split("</sub>"));
|
|
257
257
|
let inside = false;
|
|
258
258
|
const tags: Array<JSX.Element> = [];
|
|
@@ -270,7 +270,7 @@ function renderLine(text: string, x: number, y: number, fontSize: number, lineHe
|
|
|
270
270
|
inside = !inside;
|
|
271
271
|
}
|
|
272
272
|
return (
|
|
273
|
-
<tspan
|
|
273
|
+
<tspan x={x} y={y} height={lineHeight.toString() + "px"}>
|
|
274
274
|
{tags}
|
|
275
275
|
</tspan>
|
|
276
276
|
);
|
|
@@ -299,7 +299,7 @@ function getTextAnchor(d: AbstractImage.GrowthDirection): "end" | "middle" | "st
|
|
|
299
299
|
if (d === "right") {
|
|
300
300
|
return "start";
|
|
301
301
|
}
|
|
302
|
-
throw "Unknown text
|
|
302
|
+
throw "Unknown text anchor " + d;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
function colorToRgb(color: AbstractImage.Color): string {
|
|
@@ -124,27 +124,9 @@ function abstractComponentToSVG(component: AbstractImage.Component): string {
|
|
|
124
124
|
const cs: Array<string> = [];
|
|
125
125
|
|
|
126
126
|
if (component.strokeThickness > 0 && component.strokeColor !== null) {
|
|
127
|
-
cs.push(
|
|
128
|
-
createElement(
|
|
129
|
-
"text",
|
|
130
|
-
{
|
|
131
|
-
style: objectToAttributeValue(shadowStyle),
|
|
132
|
-
transform: transform,
|
|
133
|
-
},
|
|
134
|
-
tSpans
|
|
135
|
-
)
|
|
136
|
-
);
|
|
127
|
+
cs.push(createElement("text", { style: objectToAttributeValue(shadowStyle), transform: transform }, tSpans));
|
|
137
128
|
}
|
|
138
|
-
cs.push(
|
|
139
|
-
createElement(
|
|
140
|
-
"text",
|
|
141
|
-
{
|
|
142
|
-
style: objectToAttributeValue(style),
|
|
143
|
-
transform: transform,
|
|
144
|
-
},
|
|
145
|
-
tSpans
|
|
146
|
-
)
|
|
147
|
-
);
|
|
129
|
+
cs.push(createElement("text", { style: objectToAttributeValue(style), transform: transform }, tSpans));
|
|
148
130
|
return cs.join();
|
|
149
131
|
case "ellipse":
|
|
150
132
|
const rx = Math.abs(component.bottomRight.x - component.topLeft.x) * 0.5;
|
|
@@ -280,7 +262,7 @@ function getTextAnchor(d: AbstractImage.GrowthDirection): string {
|
|
|
280
262
|
if (d === "right") {
|
|
281
263
|
return "start";
|
|
282
264
|
}
|
|
283
|
-
throw "Unknown text
|
|
265
|
+
throw "Unknown text anchor " + d;
|
|
284
266
|
}
|
|
285
267
|
|
|
286
268
|
function colorToRgb(color: AbstractImage.Color): string {
|
package/src/model/component.ts
CHANGED
|
@@ -244,19 +244,19 @@ export function createText(
|
|
|
244
244
|
): Text {
|
|
245
245
|
return {
|
|
246
246
|
type: "text",
|
|
247
|
-
position
|
|
248
|
-
text
|
|
249
|
-
fontFamily
|
|
250
|
-
fontSize
|
|
251
|
-
textColor
|
|
252
|
-
fontWeight
|
|
253
|
-
clockwiseRotationDegrees
|
|
254
|
-
textAlignment
|
|
255
|
-
horizontalGrowthDirection
|
|
256
|
-
verticalGrowthDirection
|
|
257
|
-
strokeThickness
|
|
258
|
-
strokeColor
|
|
259
|
-
italic
|
|
247
|
+
position,
|
|
248
|
+
text,
|
|
249
|
+
fontFamily,
|
|
250
|
+
fontSize,
|
|
251
|
+
textColor,
|
|
252
|
+
fontWeight,
|
|
253
|
+
clockwiseRotationDegrees,
|
|
254
|
+
textAlignment,
|
|
255
|
+
horizontalGrowthDirection,
|
|
256
|
+
verticalGrowthDirection,
|
|
257
|
+
strokeThickness,
|
|
258
|
+
strokeColor,
|
|
259
|
+
italic,
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -267,11 +267,7 @@ export interface SubImage {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
export function createSubImage(topLeft: Point.Point, image: Component): SubImage {
|
|
270
|
-
return {
|
|
271
|
-
type: "subimage",
|
|
272
|
-
topLeft: topLeft,
|
|
273
|
-
image: image,
|
|
274
|
-
};
|
|
270
|
+
return { type: "subimage", topLeft, image };
|
|
275
271
|
}
|
|
276
272
|
|
|
277
273
|
export function embedAbstractImage(topLeft: Point.Point, name: string, image: AbstractImage.AbstractImage): Component {
|