soccer-jersey-fork 1.0.80 → 1.0.82
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.
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
import { Svg } from "@svgdotjs/svg.js";
|
|
7
7
|
import { ShirtStyleDirection } from "../types";
|
|
8
8
|
export declare const drawStriped: (page: Svg, primaryColor: string, secondaryColor: string, direction: ShirtStyleDirection, thickness?: "thin" | "thick" | "normal") => import("@svgdotjs/svg.js").Pattern;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const drawBigCheckered: (page: Svg, primaryColor: string, secondaryColor: string, direction?: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
10
|
+
export declare const drawCheckered: (page: Svg, primaryColor: string, secondaryColor: string, size: "sm" | "lg", direction?: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
10
11
|
export declare const drawDiamonds: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
|
|
11
12
|
export declare const drawTwoColors: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
|
12
13
|
export declare const drawSingleBand: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
|
package/lib/patterns/patterns.js
CHANGED
|
@@ -90,12 +90,34 @@ const drawStripedNormal = (page, primaryColor, secondaryColor, direction) => {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
export const
|
|
93
|
+
export const drawBigCheckered = (page, primaryColor, secondaryColor, direction) => {
|
|
94
94
|
const draw = () => {
|
|
95
|
-
return page.pattern(
|
|
96
|
-
add.rect(
|
|
97
|
-
add.rect(
|
|
98
|
-
add.rect(
|
|
95
|
+
return page.pattern(100, 100, function (add) {
|
|
96
|
+
add.rect(100, 100).fill(primaryColor);
|
|
97
|
+
add.rect(50, 50).fill(secondaryColor);
|
|
98
|
+
add.rect(50, 50).fill(secondaryColor).move(50, 50);
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
switch (direction) {
|
|
102
|
+
case "diagonalLeft": {
|
|
103
|
+
return draw().rotate(45);
|
|
104
|
+
}
|
|
105
|
+
default: {
|
|
106
|
+
return draw();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
export const drawCheckered = (page, primaryColor, secondaryColor, size, direction) => {
|
|
111
|
+
const tileSize = size === "sm" ? 20 : 100;
|
|
112
|
+
const patternSize = tileSize / 2;
|
|
113
|
+
const draw = () => {
|
|
114
|
+
return page.pattern(tileSize, tileSize, (add) => {
|
|
115
|
+
add.rect(tileSize, tileSize).fill(primaryColor);
|
|
116
|
+
add.rect(patternSize, patternSize).fill(secondaryColor);
|
|
117
|
+
add
|
|
118
|
+
.rect(patternSize, patternSize)
|
|
119
|
+
.fill(secondaryColor)
|
|
120
|
+
.move(patternSize, patternSize);
|
|
99
121
|
});
|
|
100
122
|
};
|
|
101
123
|
switch (direction) {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -43,5 +43,5 @@ export interface DrawSoccerJerseyProps {
|
|
|
43
43
|
withShorts?: boolean;
|
|
44
44
|
}
|
|
45
45
|
export type ShirtStyleDirection = "diagonalRight" | "diagonalLeft" | "horizontal" | "vertical";
|
|
46
|
-
export type ShirtStyle = "plain" | "twoColors" | "striped" | "stripedThin" | "stripedThick" | "waves" | "checkered" | "diamonds" | "singleBandThin" | "singleBand" | "dashed" | "cross";
|
|
46
|
+
export type ShirtStyle = "plain" | "twoColors" | "striped" | "stripedThin" | "stripedThick" | "waves" | "checkered" | "checkeredBig" | "diamonds" | "singleBandThin" | "singleBand" | "dashed" | "cross";
|
|
47
47
|
export type SleeveStyle = ShirtStyle;
|
|
@@ -38,93 +38,6 @@ export default function drawSoccerJersey({ shirtColor = "plain", sleeveColor = s
|
|
|
38
38
|
const page = SVG();
|
|
39
39
|
shirtStyleColor = shirtStyleColor || "#eee";
|
|
40
40
|
let shirtFill = getPatternFill(page, shirtColor, shirtStyle, shirtStyleColor, shirtStyleDirection);
|
|
41
|
-
// switch (shirtStyle) {
|
|
42
|
-
// case "twoColors":
|
|
43
|
-
// shirtFill = drawTwoColors(
|
|
44
|
-
// page,
|
|
45
|
-
// optimizedShirtColor,
|
|
46
|
-
// shirtStyleColor,
|
|
47
|
-
// shirtStyleDirection ? shirtStyleDirection : "vertical",
|
|
48
|
-
// );
|
|
49
|
-
// break;
|
|
50
|
-
// case "stripedThin":
|
|
51
|
-
// shirtFill = drawStriped(
|
|
52
|
-
// page,
|
|
53
|
-
// optimizedShirtColor,
|
|
54
|
-
// shirtStyleColor,
|
|
55
|
-
// shirtStyleDirection || "vertical",
|
|
56
|
-
// "thin",
|
|
57
|
-
// );
|
|
58
|
-
// break;
|
|
59
|
-
// case "stripedThick":
|
|
60
|
-
// shirtFill = drawStriped(
|
|
61
|
-
// page,
|
|
62
|
-
// optimizedShirtColor,
|
|
63
|
-
// shirtStyleColor,
|
|
64
|
-
// shirtStyleDirection || "vertical",
|
|
65
|
-
// "thick",
|
|
66
|
-
// );
|
|
67
|
-
// break;
|
|
68
|
-
// case "striped":
|
|
69
|
-
// shirtFill = drawStriped(
|
|
70
|
-
// page,
|
|
71
|
-
// optimizedShirtColor,
|
|
72
|
-
// shirtStyleColor,
|
|
73
|
-
// shirtStyleDirection || "vertical",
|
|
74
|
-
// "normal",
|
|
75
|
-
// );
|
|
76
|
-
// break;
|
|
77
|
-
// case "dashed":
|
|
78
|
-
// shirtFill = drawDashes(
|
|
79
|
-
// page,
|
|
80
|
-
// optimizedShirtColor,
|
|
81
|
-
// shirtStyleColor,
|
|
82
|
-
// shirtStyleDirection ? shirtStyleDirection : "vertical",
|
|
83
|
-
// );
|
|
84
|
-
// break;
|
|
85
|
-
// case "checkered":
|
|
86
|
-
// shirtFill = drawCheckered(
|
|
87
|
-
// page,
|
|
88
|
-
// optimizedShirtColor,
|
|
89
|
-
// shirtStyleColor,
|
|
90
|
-
// shirtStyleDirection,
|
|
91
|
-
// );
|
|
92
|
-
// break;
|
|
93
|
-
// case "diamonds":
|
|
94
|
-
// shirtFill = drawDiamonds(page, optimizedShirtColor, shirtStyleColor);
|
|
95
|
-
// break;
|
|
96
|
-
// case "singleBand":
|
|
97
|
-
// shirtFill = drawSingleBand(
|
|
98
|
-
// page,
|
|
99
|
-
// optimizedShirtColor,
|
|
100
|
-
// shirtStyleColor,
|
|
101
|
-
// shirtStyleDirection ? shirtStyleDirection : "horizontal",
|
|
102
|
-
// );
|
|
103
|
-
// break;
|
|
104
|
-
// case "singleBandThin":
|
|
105
|
-
// shirtFill = drawSingleBandThin(
|
|
106
|
-
// page,
|
|
107
|
-
// optimizedShirtColor,
|
|
108
|
-
// shirtStyleColor,
|
|
109
|
-
// shirtStyleDirection,
|
|
110
|
-
// );
|
|
111
|
-
// break;
|
|
112
|
-
// case "waves":
|
|
113
|
-
// shirtFill = drawWaves(
|
|
114
|
-
// page,
|
|
115
|
-
// optimizedShirtColor,
|
|
116
|
-
// shirtStyleColor,
|
|
117
|
-
// shirtStyleDirection == "vertical" || shirtStyleDirection == "horizontal"
|
|
118
|
-
// ? shirtStyleDirection
|
|
119
|
-
// : "vertical",
|
|
120
|
-
// );
|
|
121
|
-
// break;
|
|
122
|
-
// case "cross":
|
|
123
|
-
// shirtFill = drawCrossLines(page, optimizedShirtColor, shirtStyleColor);
|
|
124
|
-
// break;
|
|
125
|
-
// default:
|
|
126
|
-
// shirtFill = optimizedShirtColor as unknown as Element;
|
|
127
|
-
// }
|
|
128
41
|
// neck
|
|
129
42
|
page
|
|
130
43
|
.path(isBack ? pathNeckBack : pathNeck)
|
|
@@ -146,7 +59,7 @@ export default function drawSoccerJersey({ shirtColor = "plain", sleeveColor = s
|
|
|
146
59
|
/**
|
|
147
60
|
* The points start from the left then spread out to the leftest
|
|
148
61
|
*/
|
|
149
|
-
.path("m36 0.5 l -5 5 15 5 l 3 -5 2 0 3 5 15 -5 -5 -5 c -
|
|
62
|
+
.path("m36 0.5 l -5 5 15 5 l 3 -5 2 0 3 5 15 -5 -5 -5 c -4 5 -26 5 -28.5 0")
|
|
150
63
|
.fill(collarColor || "#eee")
|
|
151
64
|
.stroke({
|
|
152
65
|
color: collarColor,
|
|
@@ -300,8 +213,11 @@ function getPatternFill(page, optimizedShirtColor, style, shirtStyleColor, shirt
|
|
|
300
213
|
case "dashed":
|
|
301
214
|
shirtFill = drawDashes(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection);
|
|
302
215
|
break;
|
|
216
|
+
case "checkeredBig":
|
|
217
|
+
shirtFill = drawCheckered(page, optimizedShirtColor, shirtStyleColor, "lg", shirtStyleDirection);
|
|
218
|
+
break;
|
|
303
219
|
case "checkered":
|
|
304
|
-
shirtFill = drawCheckered(page, optimizedShirtColor, shirtStyleColor, shirtStyleDirection);
|
|
220
|
+
shirtFill = drawCheckered(page, optimizedShirtColor, shirtStyleColor, "sm", shirtStyleDirection);
|
|
305
221
|
break;
|
|
306
222
|
case "diamonds":
|
|
307
223
|
shirtFill = drawDiamonds(page, optimizedShirtColor, shirtStyleColor);
|