soccer-jersey-fork 1.0.69 → 1.0.70
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.
|
@@ -7,15 +7,15 @@ import { Svg } from "@svgdotjs/svg.js";
|
|
|
7
7
|
import { ShirtStyleDirection } from "../types";
|
|
8
8
|
export declare const drawStripedThick: (page: Svg, primaryColor: string, secondaryColor: string | undefined, direction: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
9
9
|
export declare const drawStripedThin: (page: Svg, primaryColor: string, secondaryColor: string | undefined, direction: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
10
|
-
export declare const drawStripedNormal: (page: Svg, primaryColor: string, secondaryColor: string
|
|
11
|
-
export declare const drawCheckered: (page: Svg, primaryColor: string, secondaryColor
|
|
12
|
-
export declare const drawDiamonds: (page: Svg, primaryColor: string, secondaryColor
|
|
13
|
-
export declare const drawTwoColors: (page: Svg, primaryColor: string, secondaryColor: string
|
|
14
|
-
export declare const drawSingleBand: (page: Svg, primaryColor: string, secondaryColor: string
|
|
15
|
-
export declare const drawSingleBandThin: (page: Svg, primaryColor: string, secondaryColor
|
|
16
|
-
export declare const drawWaves: (page: Svg, primaryColor: string, secondaryColor: string
|
|
17
|
-
export declare const drawDashes: (page: Svg, primaryColor: string, secondaryColor: string
|
|
10
|
+
export declare const drawStripedNormal: (page: Svg, primaryColor: string, secondaryColor: string, direction: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
11
|
+
export declare const drawCheckered: (page: Svg, primaryColor: string, secondaryColor: string, direction?: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
12
|
+
export declare const drawDiamonds: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
|
|
13
|
+
export declare const drawTwoColors: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
14
|
+
export declare const drawSingleBand: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
15
|
+
export declare const drawSingleBandThin: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle?: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
16
|
+
export declare const drawWaves: (page: Svg, primaryColor: string, secondaryColor: string, waveStyle: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
17
|
+
export declare const drawDashes: (page: Svg, primaryColor: string, secondaryColor: string, dashDirection: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
18
18
|
export declare const addShortSideColor: (page: Svg, color: string) => void;
|
|
19
19
|
export declare function addShoulderSideColor(page: Svg, color: string): void;
|
|
20
20
|
export declare function addShirtSideColor(page: Svg, color: string): void;
|
|
21
|
-
export declare const drawCrossLines: (page: Svg, primaryColor: string, secondaryColor
|
|
21
|
+
export declare const drawCrossLines: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
|
package/lib/patterns/patterns.js
CHANGED
|
@@ -55,7 +55,7 @@ export const drawStripedThin = (page, primaryColor, secondaryColor = "#eee", dir
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
export const drawStripedNormal = (page, primaryColor, secondaryColor
|
|
58
|
+
export const drawStripedNormal = (page, primaryColor, secondaryColor, direction) => {
|
|
59
59
|
const drawVertical = () => {
|
|
60
60
|
return page.pattern(10, 4, function (add) {
|
|
61
61
|
add.rect(10, 4).fill(primaryColor);
|
|
@@ -83,7 +83,7 @@ export const drawStripedNormal = (page, primaryColor, secondaryColor = "#eee", d
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
export const drawCheckered = (page, primaryColor, secondaryColor
|
|
86
|
+
export const drawCheckered = (page, primaryColor, secondaryColor, direction) => {
|
|
87
87
|
const draw = () => {
|
|
88
88
|
return page.pattern(20, 20, function (add) {
|
|
89
89
|
add.rect(20, 20).fill(primaryColor);
|
|
@@ -100,11 +100,13 @@ export const drawCheckered = (page, primaryColor, secondaryColor = "#eee", direc
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
export const drawDiamonds = (page, primaryColor, secondaryColor
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
export const drawDiamonds = (page, primaryColor, secondaryColor) => {
|
|
104
|
+
return page.pattern(5, 5, function (add) {
|
|
105
|
+
add.rect(5, 5).fill(primaryColor);
|
|
106
|
+
add.rect(3, 3).fill(secondaryColor).center(2, 2).rotate(45);
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
export const drawTwoColors = (page, primaryColor, secondaryColor, bandStyle) => {
|
|
108
110
|
switch (bandStyle) {
|
|
109
111
|
case "diagonalRight":
|
|
110
112
|
return page.pattern(100, 100, function (add) {
|
|
@@ -133,7 +135,7 @@ export const drawTwoColors = (page, primaryColor, secondaryColor = "#eee", bandS
|
|
|
133
135
|
});
|
|
134
136
|
}
|
|
135
137
|
};
|
|
136
|
-
export const drawSingleBand = (page, primaryColor, secondaryColor
|
|
138
|
+
export const drawSingleBand = (page, primaryColor, secondaryColor, bandStyle) => {
|
|
137
139
|
switch (bandStyle) {
|
|
138
140
|
case "diagonalRight":
|
|
139
141
|
return page.pattern(100, 100, function (add) {
|
|
@@ -162,7 +164,7 @@ export const drawSingleBand = (page, primaryColor, secondaryColor = "#eee", band
|
|
|
162
164
|
});
|
|
163
165
|
}
|
|
164
166
|
};
|
|
165
|
-
export const drawSingleBandThin = (page, primaryColor, secondaryColor
|
|
167
|
+
export const drawSingleBandThin = (page, primaryColor, secondaryColor, bandStyle) => {
|
|
166
168
|
const drawVertical = (x) => {
|
|
167
169
|
return page.pattern(90, 100, function (add) {
|
|
168
170
|
add.rect(90, 100).fill(primaryColor);
|
|
@@ -181,7 +183,7 @@ export const drawSingleBandThin = (page, primaryColor, secondaryColor = "#eee",
|
|
|
181
183
|
return drawVertical(60);
|
|
182
184
|
}
|
|
183
185
|
};
|
|
184
|
-
export const drawWaves = (page, primaryColor, secondaryColor
|
|
186
|
+
export const drawWaves = (page, primaryColor, secondaryColor, waveStyle) => {
|
|
185
187
|
switch (waveStyle) {
|
|
186
188
|
case "horizontal":
|
|
187
189
|
return page.pattern(20, 12, function (add) {
|
|
@@ -197,7 +199,9 @@ export const drawWaves = (page, primaryColor, secondaryColor = "#eee", waveStyle
|
|
|
197
199
|
});
|
|
198
200
|
}
|
|
199
201
|
};
|
|
200
|
-
export const drawDashes = (page, primaryColor,
|
|
202
|
+
export const drawDashes = (page, primaryColor,
|
|
203
|
+
// Cannot do secondaryColor = "#eee" because empty string will not get to the default "#eee" in the parameter.
|
|
204
|
+
secondaryColor, dashDirection) => {
|
|
201
205
|
switch (dashDirection) {
|
|
202
206
|
case "diagonalLeft":
|
|
203
207
|
return page.pattern(10, 10, function (add) {
|
|
@@ -255,7 +259,7 @@ export function addShirtSideColor(page, color) {
|
|
|
255
259
|
.fill("none")
|
|
256
260
|
.stroke({ width: 2, color, linecap: "round" });
|
|
257
261
|
}
|
|
258
|
-
export const drawCrossLines = (page, primaryColor, secondaryColor
|
|
262
|
+
export const drawCrossLines = (page, primaryColor, secondaryColor) => {
|
|
259
263
|
return page.pattern(90, 100, function (add) {
|
|
260
264
|
add.rect(90, 100).fill(primaryColor);
|
|
261
265
|
add.rect(10, 100).fill(secondaryColor).move(45, 0);
|
|
@@ -39,45 +39,46 @@ export default function drawSoccerJersey({ shirtColor = "plain", sleeveColor, sh
|
|
|
39
39
|
const pathNeckBack = "m63 .064C 60.12,5.3 53.35,6.6 49.86 6.6 44.86 7 40.4 4 36 .064c-1.7.6-.78 2.8-1.8 4.1-3 5.1-6 10-9 15h50c-3.8-6.4-7.6-13-11-19z";
|
|
40
40
|
// eslint-disable-next-line new-cap
|
|
41
41
|
const page = SVG();
|
|
42
|
-
let shirtFill;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
42
|
+
let shirtFill = optimizedShirtColor;
|
|
43
|
+
if (shirtStyleColor) {
|
|
44
|
+
switch (shirtStyle) {
|
|
45
|
+
case "twoColors":
|
|
46
|
+
shirtFill = drawTwoColors(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection ? shirtStyleDirection : "vertical");
|
|
47
|
+
break;
|
|
48
|
+
case "stripedThin":
|
|
49
|
+
shirtFill = drawStripedThin(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection || "vertical");
|
|
50
|
+
break;
|
|
51
|
+
case "stripedThick":
|
|
52
|
+
shirtFill = drawStripedThick(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection || "vertical");
|
|
53
|
+
break;
|
|
54
|
+
case "striped":
|
|
55
|
+
shirtFill = drawStripedNormal(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection || "vertical");
|
|
56
|
+
break;
|
|
57
|
+
case "dashed":
|
|
58
|
+
shirtFill = drawDashes(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection ? shirtStyleDirection : "vertical");
|
|
59
|
+
break;
|
|
60
|
+
case "checkered":
|
|
61
|
+
shirtFill = drawCheckered(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection);
|
|
62
|
+
break;
|
|
63
|
+
case "diamonds":
|
|
64
|
+
shirtFill = drawDiamonds(page, optimizedShirtColor, shirtStyleColor);
|
|
65
|
+
break;
|
|
66
|
+
case "singleBand":
|
|
67
|
+
shirtFill = drawSingleBand(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection ? shirtStyleDirection : "horizontal");
|
|
68
|
+
break;
|
|
69
|
+
case "singleBandThin":
|
|
70
|
+
shirtFill = drawSingleBandThin(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection);
|
|
71
|
+
break;
|
|
72
|
+
case "waves":
|
|
73
|
+
shirtFill = drawWaves(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection == "vertical" ||
|
|
74
|
+
shirtStyleDirection == "horizontal"
|
|
75
|
+
? shirtStyleDirection
|
|
76
|
+
: "vertical");
|
|
77
|
+
break;
|
|
78
|
+
case "cross":
|
|
79
|
+
shirtFill = drawCrossLines(page, optimizedShirtColor, shirtStyleColor);
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
81
82
|
}
|
|
82
83
|
// neck
|
|
83
84
|
page
|