soccer-jersey-fork 1.0.93 → 1.0.95
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/patterns/patterns.js
CHANGED
|
@@ -170,39 +170,41 @@ export const drawSleeveContrastingTwoColors = (page, primaryColor, secondaryColo
|
|
|
170
170
|
});
|
|
171
171
|
};
|
|
172
172
|
export const drawSingleBand = (page, primaryColor, secondaryColor, bandStyle) => {
|
|
173
|
+
function drawVertical(moveX) {
|
|
174
|
+
return page.pattern(90, 90, function (add) {
|
|
175
|
+
add.rect(90, 100).fill(primaryColor);
|
|
176
|
+
add.rect(20, 100).fill(secondaryColor).move(moveX, 0);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
173
179
|
switch (bandStyle) {
|
|
174
180
|
case "diagonalRight":
|
|
175
181
|
return page.pattern(100, 100, function (add) {
|
|
176
182
|
add.rect(100, 100).fill(primaryColor);
|
|
177
|
-
add.rect(120, 20).fill(secondaryColor).move(
|
|
183
|
+
add.rect(120, 20).fill(secondaryColor).move(-5, 40).rotate(120);
|
|
178
184
|
});
|
|
179
185
|
case "diagonalLeft":
|
|
180
186
|
return page.pattern(100, 100, function (add) {
|
|
181
187
|
add.rect(100, 100).fill(primaryColor);
|
|
182
|
-
add.rect(120, 20).fill(secondaryColor).move(
|
|
188
|
+
add.rect(120, 20).fill(secondaryColor).move(-5, 40).rotate(60);
|
|
183
189
|
});
|
|
184
190
|
case "horizontal":
|
|
185
191
|
return page.pattern(100, 90, function (add) {
|
|
186
192
|
add.rect(100, 90).fill(primaryColor);
|
|
187
193
|
add.rect(100, 30).fill(secondaryColor).move(0, 30);
|
|
188
194
|
});
|
|
189
|
-
case "
|
|
190
|
-
return
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
});
|
|
195
|
+
case "offsetRightVertical":
|
|
196
|
+
return drawVertical(50);
|
|
197
|
+
case "offsetLeftVertical":
|
|
198
|
+
return drawVertical(30);
|
|
194
199
|
default:
|
|
195
|
-
return
|
|
196
|
-
add.rect(90, 100).fill(primaryColor);
|
|
197
|
-
add.rect(20, 100).fill(secondaryColor).move(50, 0);
|
|
198
|
-
});
|
|
200
|
+
return drawVertical(40);
|
|
199
201
|
}
|
|
200
202
|
};
|
|
201
203
|
export const drawSingleBandThin = (page, primaryColor, secondaryColor, bandStyle) => {
|
|
202
|
-
const drawVertical = (
|
|
204
|
+
const drawVertical = (moveX) => {
|
|
203
205
|
return page.pattern(90, 100, function (add) {
|
|
204
206
|
add.rect(90, 100).fill(primaryColor);
|
|
205
|
-
add.rect(10, 100).fill(secondaryColor).move(
|
|
207
|
+
add.rect(10, 100).fill(secondaryColor).move(moveX, 0);
|
|
206
208
|
});
|
|
207
209
|
};
|
|
208
210
|
switch (bandStyle) {
|
|
@@ -217,6 +219,10 @@ export const drawSingleBandThin = (page, primaryColor, secondaryColor, bandStyle
|
|
|
217
219
|
add.rect(100, 90).fill(primaryColor);
|
|
218
220
|
add.rect(100, 10).fill(secondaryColor).move(0, 35);
|
|
219
221
|
});
|
|
222
|
+
case "offsetRightVertical":
|
|
223
|
+
return drawVertical(55);
|
|
224
|
+
case "offsetLeftVertical":
|
|
225
|
+
return drawVertical(35);
|
|
220
226
|
case "vertical":
|
|
221
227
|
return drawVertical(45);
|
|
222
228
|
default:
|
package/lib/types/index.d.ts
CHANGED
|
@@ -43,6 +43,6 @@ export interface DrawSoccerJerseyProps {
|
|
|
43
43
|
withBadge?: boolean;
|
|
44
44
|
withShorts?: boolean;
|
|
45
45
|
}
|
|
46
|
-
export type StyleDirection = "diagonalRight" | "diagonalLeft" | "horizontal" | "vertical";
|
|
46
|
+
export type StyleDirection = "diagonalRight" | "diagonalLeft" | "horizontal" | "vertical" | "offsetLeftVertical" | "offsetRightVertical";
|
|
47
47
|
export type ShirtStyle = "plain" | "twoColors" | "contrastingTwoColors" | "striped" | "stripedThin" | "stripedThick" | "waves" | "checkered" | "checkeredBig" | "diamonds" | "singleBandThin" | "singleBand" | "dashed" | "cross";
|
|
48
48
|
export type SleeveStyle = ShirtStyle;
|
|
@@ -152,6 +152,11 @@ export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shi
|
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
+
if (images && images.length > 0) {
|
|
156
|
+
for (const { src, width = 20, height = 20, x = 45, y = 45 } of images) {
|
|
157
|
+
page.image(src).size(width, height).move(x, y);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
155
160
|
/**
|
|
156
161
|
* Texts and images should be placed at last so they won't get covered by shirt and shorts
|
|
157
162
|
*/
|
|
@@ -192,11 +197,6 @@ export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shi
|
|
|
192
197
|
drawText(page);
|
|
193
198
|
}
|
|
194
199
|
}
|
|
195
|
-
if (images && images.length > 0) {
|
|
196
|
-
for (const { src, width = 20, height = 20, x = 45, y = 45 } of images) {
|
|
197
|
-
page.image(src).size(width, height).move(x, y);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
200
|
page.width(shirtWidth);
|
|
201
201
|
// +10 is some extra room with the shorts height, so the total should be 150
|
|
202
202
|
page.viewbox(`0 0 102 ${100 + (withShorts ? shortsHeight + 10 : 0)}`);
|