@visactor/vrender-kits 1.0.25 → 1.0.26-alpha.0
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/dist/index.es.js +576 -631
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -72,41 +72,42 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
72
72
|
|
|
73
73
|
function t(t, e, s) {
|
|
74
74
|
if (t && t.length) {
|
|
75
|
-
const [n,
|
|
76
|
-
|
|
77
|
-
h = Math.cos(
|
|
78
|
-
r = Math.sin(
|
|
79
|
-
|
|
80
|
-
const [
|
|
81
|
-
|
|
82
|
-
}
|
|
75
|
+
const [n, a] = e,
|
|
76
|
+
o = Math.PI / 180 * s,
|
|
77
|
+
h = Math.cos(o),
|
|
78
|
+
r = Math.sin(o);
|
|
79
|
+
t.forEach(t => {
|
|
80
|
+
const [e, s] = t;
|
|
81
|
+
t[0] = (e - n) * h - (s - a) * r + n, t[1] = (e - n) * r + (s - a) * h + a;
|
|
82
|
+
});
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
function e(t
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
85
|
+
function e(t) {
|
|
86
|
+
const e = t[0],
|
|
87
|
+
s = t[1];
|
|
88
|
+
return Math.sqrt(Math.pow(e[0] - s[0], 2) + Math.pow(e[1] - s[1], 2));
|
|
89
|
+
}
|
|
90
|
+
function s(e, s) {
|
|
91
|
+
const n = s.hachureAngle + 90;
|
|
92
|
+
let a = s.hachureGap;
|
|
93
|
+
a < 0 && (a = 4 * s.strokeWidth), a = Math.max(a, .1);
|
|
94
|
+
const o = [0, 0];
|
|
95
|
+
if (n) for (const s of e) t(s, o, n);
|
|
96
|
+
const h = function (t, e) {
|
|
97
|
+
const s = [];
|
|
98
|
+
for (const e of t) {
|
|
99
|
+
const t = [...e];
|
|
100
|
+
t[0].join(",") !== t[t.length - 1].join(",") && t.push([t[0][0], t[0][1]]), t.length > 2 && s.push(t);
|
|
100
101
|
}
|
|
102
|
+
const n = [];
|
|
103
|
+
e = Math.max(e, .1);
|
|
101
104
|
const a = [];
|
|
102
|
-
s =
|
|
103
|
-
const h = [];
|
|
104
|
-
for (const t of o) for (let e = 0; e < t.length - 1; e++) {
|
|
105
|
+
for (const t of s) for (let e = 0; e < t.length - 1; e++) {
|
|
105
106
|
const s = t[e],
|
|
106
107
|
n = t[e + 1];
|
|
107
108
|
if (s[1] !== n[1]) {
|
|
108
109
|
const t = Math.min(s[1], n[1]);
|
|
109
|
-
|
|
110
|
+
a.push({
|
|
110
111
|
ymin: t,
|
|
111
112
|
ymax: Math.max(s[1], n[1]),
|
|
112
113
|
x: t === s[1] ? s[0] : n[0],
|
|
@@ -114,52 +115,43 @@ function s(s, n, o) {
|
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
if (
|
|
118
|
-
let
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (h.length) {
|
|
118
|
+
if (a.sort((t, e) => t.ymin < e.ymin ? -1 : t.ymin > e.ymin ? 1 : t.x < e.x ? -1 : t.x > e.x ? 1 : t.ymax === e.ymax ? 0 : (t.ymax - e.ymax) / Math.abs(t.ymax - e.ymax)), !a.length) return n;
|
|
119
|
+
let o = [],
|
|
120
|
+
h = a[0].ymin;
|
|
121
|
+
for (; o.length || a.length;) {
|
|
122
|
+
if (a.length) {
|
|
123
123
|
let t = -1;
|
|
124
|
-
for (let e = 0; e <
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
s:
|
|
124
|
+
for (let e = 0; e < a.length && !(a[e].ymin > h); e++) t = e;
|
|
125
|
+
a.splice(0, t + 1).forEach(t => {
|
|
126
|
+
o.push({
|
|
127
|
+
s: h,
|
|
128
128
|
edge: t
|
|
129
129
|
});
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
if (
|
|
132
|
+
if (o = o.filter(t => !(t.edge.ymax <= h)), o.sort((t, e) => t.edge.x === e.edge.x ? 0 : (t.edge.x - e.edge.x) / Math.abs(t.edge.x - e.edge.x)), o.length > 1) for (let t = 0; t < o.length; t += 2) {
|
|
133
133
|
const e = t + 1;
|
|
134
|
-
if (e >=
|
|
135
|
-
const s =
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
if (e >= o.length) break;
|
|
135
|
+
const s = o[t].edge,
|
|
136
|
+
a = o[e].edge;
|
|
137
|
+
n.push([[Math.round(s.x), h], [Math.round(a.x), h]]);
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
t.edge.x = t.edge.x +
|
|
141
|
-
})
|
|
139
|
+
h += e, o.forEach(t => {
|
|
140
|
+
t.edge.x = t.edge.x + e * t.edge.islope;
|
|
141
|
+
});
|
|
142
142
|
}
|
|
143
|
-
return
|
|
144
|
-
}(
|
|
145
|
-
if (
|
|
146
|
-
for (const
|
|
143
|
+
return n;
|
|
144
|
+
}(e, a);
|
|
145
|
+
if (n) {
|
|
146
|
+
for (const s of e) t(s, o, -n);
|
|
147
147
|
!function (e, s, n) {
|
|
148
|
-
const
|
|
149
|
-
e.forEach(t =>
|
|
150
|
-
}(
|
|
148
|
+
const a = [];
|
|
149
|
+
e.forEach(t => a.push(...t)), t(a, s, n);
|
|
150
|
+
}(h, o, -n);
|
|
151
151
|
}
|
|
152
|
-
return
|
|
152
|
+
return h;
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
var n;
|
|
156
|
-
const o = e.hachureAngle + 90;
|
|
157
|
-
let a = e.hachureGap;
|
|
158
|
-
a < 0 && (a = 4 * e.strokeWidth), a = Math.round(Math.max(a, .1));
|
|
159
|
-
let h = 1;
|
|
160
|
-
return e.roughness >= 1 && ((null === (n = e.randomizer) || void 0 === n ? void 0 : n.next()) || Math.random()) > .7 && (h = a), s(t, a, o, h || 1);
|
|
161
|
-
}
|
|
162
|
-
class o {
|
|
154
|
+
class n {
|
|
163
155
|
constructor(t) {
|
|
164
156
|
this.helper = t;
|
|
165
157
|
}
|
|
@@ -167,10 +159,10 @@ class o {
|
|
|
167
159
|
return this._fillPolygons(t, e);
|
|
168
160
|
}
|
|
169
161
|
_fillPolygons(t, e) {
|
|
170
|
-
const
|
|
162
|
+
const n = s(t, e);
|
|
171
163
|
return {
|
|
172
164
|
type: "fillSketch",
|
|
173
|
-
ops: this.renderLines(
|
|
165
|
+
ops: this.renderLines(n, e)
|
|
174
166
|
};
|
|
175
167
|
}
|
|
176
168
|
renderLines(t, e) {
|
|
@@ -179,148 +171,143 @@ class o {
|
|
|
179
171
|
return s;
|
|
180
172
|
}
|
|
181
173
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
fillPolygons(t, e) {
|
|
189
|
-
let s = e.hachureGap;
|
|
190
|
-
s < 0 && (s = 4 * e.strokeWidth), s = Math.max(s, .1);
|
|
191
|
-
const o = n(t, Object.assign({}, e, {
|
|
192
|
-
hachureGap: s
|
|
174
|
+
class a extends n {
|
|
175
|
+
fillPolygons(t, n) {
|
|
176
|
+
let a = n.hachureGap;
|
|
177
|
+
a < 0 && (a = 4 * n.strokeWidth), a = Math.max(a, .1);
|
|
178
|
+
const o = s(t, Object.assign({}, n, {
|
|
179
|
+
hachureGap: a
|
|
193
180
|
})),
|
|
194
|
-
h = Math.PI / 180 *
|
|
181
|
+
h = Math.PI / 180 * n.hachureAngle,
|
|
195
182
|
r = [],
|
|
196
|
-
i = .5 *
|
|
197
|
-
c = .5 *
|
|
198
|
-
for (const [t,
|
|
183
|
+
i = .5 * a * Math.cos(h),
|
|
184
|
+
c = .5 * a * Math.sin(h);
|
|
185
|
+
for (const [t, s] of o) e([t, s]) && r.push([[t[0] - i, t[1] + c], [...s]], [[t[0] + i, t[1] - c], [...s]]);
|
|
199
186
|
return {
|
|
200
187
|
type: "fillSketch",
|
|
201
|
-
ops: this.renderLines(r,
|
|
188
|
+
ops: this.renderLines(r, n)
|
|
202
189
|
};
|
|
203
190
|
}
|
|
204
191
|
}
|
|
205
|
-
class
|
|
192
|
+
class o extends n {
|
|
206
193
|
fillPolygons(t, e) {
|
|
207
194
|
const s = this._fillPolygons(t, e),
|
|
208
195
|
n = Object.assign({}, e, {
|
|
209
196
|
hachureAngle: e.hachureAngle + 90
|
|
210
197
|
}),
|
|
211
|
-
|
|
212
|
-
return s.ops = s.ops.concat(
|
|
198
|
+
a = this._fillPolygons(t, n);
|
|
199
|
+
return s.ops = s.ops.concat(a.ops), s;
|
|
213
200
|
}
|
|
214
201
|
}
|
|
215
|
-
class
|
|
202
|
+
class h {
|
|
216
203
|
constructor(t) {
|
|
217
204
|
this.helper = t;
|
|
218
205
|
}
|
|
219
206
|
fillPolygons(t, e) {
|
|
220
|
-
const
|
|
207
|
+
const n = s(t, e = Object.assign({}, e, {
|
|
221
208
|
hachureAngle: 0
|
|
222
209
|
}));
|
|
223
|
-
return this.dotsOnLines(
|
|
210
|
+
return this.dotsOnLines(n, e);
|
|
224
211
|
}
|
|
225
|
-
dotsOnLines(t,
|
|
226
|
-
const
|
|
227
|
-
let
|
|
228
|
-
|
|
229
|
-
let o =
|
|
230
|
-
o < 0 && (o =
|
|
231
|
-
const h =
|
|
212
|
+
dotsOnLines(t, s) {
|
|
213
|
+
const n = [];
|
|
214
|
+
let a = s.hachureGap;
|
|
215
|
+
a < 0 && (a = 4 * s.strokeWidth), a = Math.max(a, .1);
|
|
216
|
+
let o = s.fillWeight;
|
|
217
|
+
o < 0 && (o = s.strokeWidth / 2);
|
|
218
|
+
const h = a / 4;
|
|
232
219
|
for (const r of t) {
|
|
233
|
-
const t =
|
|
234
|
-
i = t /
|
|
220
|
+
const t = e(r),
|
|
221
|
+
i = t / a,
|
|
235
222
|
c = Math.ceil(i) - 1,
|
|
236
|
-
l = t - c *
|
|
237
|
-
u = (r[0][0] + r[1][0]) / 2 -
|
|
223
|
+
l = t - c * a,
|
|
224
|
+
u = (r[0][0] + r[1][0]) / 2 - a / 4,
|
|
238
225
|
p = Math.min(r[0][1], r[1][1]);
|
|
239
226
|
for (let t = 0; t < c; t++) {
|
|
240
|
-
const
|
|
227
|
+
const e = p + l + t * a,
|
|
241
228
|
r = u - h + 2 * Math.random() * h,
|
|
242
|
-
i =
|
|
243
|
-
c = this.helper.ellipse(r, i, o, o,
|
|
244
|
-
|
|
229
|
+
i = e - h + 2 * Math.random() * h,
|
|
230
|
+
c = this.helper.ellipse(r, i, o, o, s);
|
|
231
|
+
n.push(...c.ops);
|
|
245
232
|
}
|
|
246
233
|
}
|
|
247
234
|
return {
|
|
248
235
|
type: "fillSketch",
|
|
249
|
-
ops:
|
|
236
|
+
ops: n
|
|
250
237
|
};
|
|
251
238
|
}
|
|
252
239
|
}
|
|
253
|
-
class
|
|
240
|
+
class r {
|
|
254
241
|
constructor(t) {
|
|
255
242
|
this.helper = t;
|
|
256
243
|
}
|
|
257
244
|
fillPolygons(t, e) {
|
|
258
|
-
const
|
|
245
|
+
const n = s(t, e);
|
|
259
246
|
return {
|
|
260
247
|
type: "fillSketch",
|
|
261
|
-
ops: this.dashedLine(
|
|
248
|
+
ops: this.dashedLine(n, e)
|
|
262
249
|
};
|
|
263
250
|
}
|
|
264
|
-
dashedLine(t,
|
|
265
|
-
const
|
|
266
|
-
|
|
251
|
+
dashedLine(t, s) {
|
|
252
|
+
const n = s.dashOffset < 0 ? s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap : s.dashOffset,
|
|
253
|
+
a = s.dashGap < 0 ? s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap : s.dashGap,
|
|
267
254
|
o = [];
|
|
268
255
|
return t.forEach(t => {
|
|
269
|
-
const h =
|
|
270
|
-
r = Math.floor(h / (
|
|
271
|
-
i = (h +
|
|
256
|
+
const h = e(t),
|
|
257
|
+
r = Math.floor(h / (n + a)),
|
|
258
|
+
i = (h + a - r * (n + a)) / 2;
|
|
272
259
|
let c = t[0],
|
|
273
260
|
l = t[1];
|
|
274
261
|
c[0] > l[0] && (c = t[1], l = t[0]);
|
|
275
262
|
const u = Math.atan((l[1] - c[1]) / (l[0] - c[0]));
|
|
276
263
|
for (let t = 0; t < r; t++) {
|
|
277
|
-
const
|
|
278
|
-
h =
|
|
279
|
-
r = [c[0] +
|
|
264
|
+
const e = t * (n + a),
|
|
265
|
+
h = e + n,
|
|
266
|
+
r = [c[0] + e * Math.cos(u) + i * Math.cos(u), c[1] + e * Math.sin(u) + i * Math.sin(u)],
|
|
280
267
|
l = [c[0] + h * Math.cos(u) + i * Math.cos(u), c[1] + h * Math.sin(u) + i * Math.sin(u)];
|
|
281
|
-
o.push(...this.helper.doubleLineOps(r[0], r[1], l[0], l[1],
|
|
268
|
+
o.push(...this.helper.doubleLineOps(r[0], r[1], l[0], l[1], s));
|
|
282
269
|
}
|
|
283
270
|
}), o;
|
|
284
271
|
}
|
|
285
272
|
}
|
|
286
|
-
class
|
|
273
|
+
class i {
|
|
287
274
|
constructor(t) {
|
|
288
275
|
this.helper = t;
|
|
289
276
|
}
|
|
290
277
|
fillPolygons(t, e) {
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
hachureGap:
|
|
278
|
+
const n = e.hachureGap < 0 ? 4 * e.strokeWidth : e.hachureGap,
|
|
279
|
+
a = e.zigzagOffset < 0 ? n : e.zigzagOffset,
|
|
280
|
+
o = s(t, e = Object.assign({}, e, {
|
|
281
|
+
hachureGap: n + a
|
|
295
282
|
}));
|
|
296
283
|
return {
|
|
297
284
|
type: "fillSketch",
|
|
298
|
-
ops: this.zigzagLines(
|
|
285
|
+
ops: this.zigzagLines(o, a, e)
|
|
299
286
|
};
|
|
300
287
|
}
|
|
301
|
-
zigzagLines(t,
|
|
302
|
-
const
|
|
288
|
+
zigzagLines(t, s, n) {
|
|
289
|
+
const a = [];
|
|
303
290
|
return t.forEach(t => {
|
|
304
|
-
const o =
|
|
305
|
-
h = Math.round(o / (2 *
|
|
291
|
+
const o = e(t),
|
|
292
|
+
h = Math.round(o / (2 * s));
|
|
306
293
|
let r = t[0],
|
|
307
294
|
i = t[1];
|
|
308
295
|
r[0] > i[0] && (r = t[1], i = t[0]);
|
|
309
296
|
const c = Math.atan((i[1] - r[1]) / (i[0] - r[0]));
|
|
310
297
|
for (let t = 0; t < h; t++) {
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
h = Math.sqrt(2 * Math.pow(
|
|
314
|
-
i = [r[0] +
|
|
315
|
-
l = [r[0] +
|
|
298
|
+
const e = 2 * t * s,
|
|
299
|
+
o = 2 * (t + 1) * s,
|
|
300
|
+
h = Math.sqrt(2 * Math.pow(s, 2)),
|
|
301
|
+
i = [r[0] + e * Math.cos(c), r[1] + e * Math.sin(c)],
|
|
302
|
+
l = [r[0] + o * Math.cos(c), r[1] + o * Math.sin(c)],
|
|
316
303
|
u = [i[0] + h * Math.cos(c + Math.PI / 4), i[1] + h * Math.sin(c + Math.PI / 4)];
|
|
317
|
-
|
|
304
|
+
a.push(...this.helper.doubleLineOps(i[0], i[1], u[0], u[1], n), ...this.helper.doubleLineOps(u[0], u[1], l[0], l[1], n));
|
|
318
305
|
}
|
|
319
|
-
}),
|
|
306
|
+
}), a;
|
|
320
307
|
}
|
|
321
308
|
}
|
|
322
|
-
const
|
|
323
|
-
class
|
|
309
|
+
const c = {};
|
|
310
|
+
class l {
|
|
324
311
|
constructor(t) {
|
|
325
312
|
this.seed = t;
|
|
326
313
|
}
|
|
@@ -328,116 +315,113 @@ class p {
|
|
|
328
315
|
return this.seed ? (2 ** 31 - 1 & (this.seed = Math.imul(48271, this.seed))) / 2 ** 31 : Math.random();
|
|
329
316
|
}
|
|
330
317
|
}
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
z: 0
|
|
355
|
-
};
|
|
356
|
-
function k(t, e) {
|
|
318
|
+
const u = {
|
|
319
|
+
A: 7,
|
|
320
|
+
a: 7,
|
|
321
|
+
C: 6,
|
|
322
|
+
c: 6,
|
|
323
|
+
H: 1,
|
|
324
|
+
h: 1,
|
|
325
|
+
L: 2,
|
|
326
|
+
l: 2,
|
|
327
|
+
M: 2,
|
|
328
|
+
m: 2,
|
|
329
|
+
Q: 4,
|
|
330
|
+
q: 4,
|
|
331
|
+
S: 4,
|
|
332
|
+
s: 4,
|
|
333
|
+
T: 2,
|
|
334
|
+
t: 2,
|
|
335
|
+
V: 1,
|
|
336
|
+
v: 1,
|
|
337
|
+
Z: 0,
|
|
338
|
+
z: 0
|
|
339
|
+
};
|
|
340
|
+
function p(t, e) {
|
|
357
341
|
return t.type === e;
|
|
358
342
|
}
|
|
359
|
-
function
|
|
343
|
+
function f(t) {
|
|
360
344
|
const e = [],
|
|
361
345
|
s = function (t) {
|
|
362
346
|
const e = new Array();
|
|
363
347
|
for (; "" !== t;) if (t.match(/^([ \t\r\n,]+)/)) t = t.substr(RegExp.$1.length);else if (t.match(/^([aAcChHlLmMqQsStTvVzZ])/)) e[e.length] = {
|
|
364
|
-
type:
|
|
348
|
+
type: 0,
|
|
365
349
|
text: RegExp.$1
|
|
366
350
|
}, t = t.substr(RegExp.$1.length);else {
|
|
367
351
|
if (!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return [];
|
|
368
352
|
e[e.length] = {
|
|
369
|
-
type:
|
|
353
|
+
type: 1,
|
|
370
354
|
text: `${parseFloat(RegExp.$1)}`
|
|
371
355
|
}, t = t.substr(RegExp.$1.length);
|
|
372
356
|
}
|
|
373
357
|
return e[e.length] = {
|
|
374
|
-
type:
|
|
358
|
+
type: 2,
|
|
375
359
|
text: ""
|
|
376
360
|
}, e;
|
|
377
361
|
}(t);
|
|
378
362
|
let n = "BOD",
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
for (; !
|
|
363
|
+
a = 0,
|
|
364
|
+
o = s[a];
|
|
365
|
+
for (; !p(o, 2);) {
|
|
382
366
|
let h = 0;
|
|
383
367
|
const r = [];
|
|
384
368
|
if ("BOD" === n) {
|
|
385
|
-
if ("M" !==
|
|
386
|
-
|
|
387
|
-
} else
|
|
388
|
-
if (!(
|
|
389
|
-
for (let t =
|
|
369
|
+
if ("M" !== o.text && "m" !== o.text) return f("M0,0" + t);
|
|
370
|
+
a++, h = u[o.text], n = o.text;
|
|
371
|
+
} else p(o, 1) ? h = u[n] : (a++, h = u[o.text], n = o.text);
|
|
372
|
+
if (!(a + h < s.length)) throw new Error("Path data ended short");
|
|
373
|
+
for (let t = a; t < a + h; t++) {
|
|
390
374
|
const e = s[t];
|
|
391
|
-
if (!
|
|
375
|
+
if (!p(e, 1)) throw new Error("Param not a number: " + n + "," + e.text);
|
|
392
376
|
r[r.length] = +e.text;
|
|
393
377
|
}
|
|
394
|
-
if ("number" != typeof
|
|
378
|
+
if ("number" != typeof u[n]) throw new Error("Bad segment: " + n);
|
|
395
379
|
{
|
|
396
380
|
const t = {
|
|
397
381
|
key: n,
|
|
398
382
|
data: r
|
|
399
383
|
};
|
|
400
|
-
e.push(t),
|
|
384
|
+
e.push(t), a += h, o = s[a], "M" === n && (n = "L"), "m" === n && (n = "l");
|
|
401
385
|
}
|
|
402
386
|
}
|
|
403
387
|
return e;
|
|
404
388
|
}
|
|
405
|
-
function
|
|
389
|
+
function d(t) {
|
|
406
390
|
let e = 0,
|
|
407
391
|
s = 0,
|
|
408
392
|
n = 0,
|
|
409
|
-
|
|
410
|
-
const
|
|
393
|
+
a = 0;
|
|
394
|
+
const o = [];
|
|
411
395
|
for (const {
|
|
412
396
|
key: h,
|
|
413
397
|
data: r
|
|
414
398
|
} of t) switch (h) {
|
|
415
399
|
case "M":
|
|
416
|
-
|
|
400
|
+
o.push({
|
|
417
401
|
key: "M",
|
|
418
402
|
data: [...r]
|
|
419
|
-
}), [e, s] = r, [n,
|
|
403
|
+
}), [e, s] = r, [n, a] = r;
|
|
420
404
|
break;
|
|
421
405
|
case "m":
|
|
422
|
-
e += r[0], s += r[1],
|
|
406
|
+
e += r[0], s += r[1], o.push({
|
|
423
407
|
key: "M",
|
|
424
408
|
data: [e, s]
|
|
425
|
-
}), n = e,
|
|
409
|
+
}), n = e, a = s;
|
|
426
410
|
break;
|
|
427
411
|
case "L":
|
|
428
|
-
|
|
412
|
+
o.push({
|
|
429
413
|
key: "L",
|
|
430
414
|
data: [...r]
|
|
431
415
|
}), [e, s] = r;
|
|
432
416
|
break;
|
|
433
417
|
case "l":
|
|
434
|
-
e += r[0], s += r[1],
|
|
418
|
+
e += r[0], s += r[1], o.push({
|
|
435
419
|
key: "L",
|
|
436
420
|
data: [e, s]
|
|
437
421
|
});
|
|
438
422
|
break;
|
|
439
423
|
case "C":
|
|
440
|
-
|
|
424
|
+
o.push({
|
|
441
425
|
key: "C",
|
|
442
426
|
data: [...r]
|
|
443
427
|
}), e = r[4], s = r[5];
|
|
@@ -445,14 +429,14 @@ function y(t) {
|
|
|
445
429
|
case "c":
|
|
446
430
|
{
|
|
447
431
|
const t = r.map((t, n) => n % 2 ? t + s : t + e);
|
|
448
|
-
|
|
432
|
+
o.push({
|
|
449
433
|
key: "C",
|
|
450
434
|
data: t
|
|
451
435
|
}), e = t[4], s = t[5];
|
|
452
436
|
break;
|
|
453
437
|
}
|
|
454
438
|
case "Q":
|
|
455
|
-
|
|
439
|
+
o.push({
|
|
456
440
|
key: "Q",
|
|
457
441
|
data: [...r]
|
|
458
442
|
}), e = r[2], s = r[3];
|
|
@@ -460,50 +444,50 @@ function y(t) {
|
|
|
460
444
|
case "q":
|
|
461
445
|
{
|
|
462
446
|
const t = r.map((t, n) => n % 2 ? t + s : t + e);
|
|
463
|
-
|
|
447
|
+
o.push({
|
|
464
448
|
key: "Q",
|
|
465
449
|
data: t
|
|
466
450
|
}), e = t[2], s = t[3];
|
|
467
451
|
break;
|
|
468
452
|
}
|
|
469
453
|
case "A":
|
|
470
|
-
|
|
454
|
+
o.push({
|
|
471
455
|
key: "A",
|
|
472
456
|
data: [...r]
|
|
473
457
|
}), e = r[5], s = r[6];
|
|
474
458
|
break;
|
|
475
459
|
case "a":
|
|
476
|
-
e += r[5], s += r[6],
|
|
460
|
+
e += r[5], s += r[6], o.push({
|
|
477
461
|
key: "A",
|
|
478
462
|
data: [r[0], r[1], r[2], r[3], r[4], e, s]
|
|
479
463
|
});
|
|
480
464
|
break;
|
|
481
465
|
case "H":
|
|
482
|
-
|
|
466
|
+
o.push({
|
|
483
467
|
key: "H",
|
|
484
468
|
data: [...r]
|
|
485
469
|
}), e = r[0];
|
|
486
470
|
break;
|
|
487
471
|
case "h":
|
|
488
|
-
e += r[0],
|
|
472
|
+
e += r[0], o.push({
|
|
489
473
|
key: "H",
|
|
490
474
|
data: [e]
|
|
491
475
|
});
|
|
492
476
|
break;
|
|
493
477
|
case "V":
|
|
494
|
-
|
|
478
|
+
o.push({
|
|
495
479
|
key: "V",
|
|
496
480
|
data: [...r]
|
|
497
481
|
}), s = r[0];
|
|
498
482
|
break;
|
|
499
483
|
case "v":
|
|
500
|
-
s += r[0],
|
|
484
|
+
s += r[0], o.push({
|
|
501
485
|
key: "V",
|
|
502
486
|
data: [s]
|
|
503
487
|
});
|
|
504
488
|
break;
|
|
505
489
|
case "S":
|
|
506
|
-
|
|
490
|
+
o.push({
|
|
507
491
|
key: "S",
|
|
508
492
|
data: [...r]
|
|
509
493
|
}), e = r[2], s = r[3];
|
|
@@ -511,39 +495,39 @@ function y(t) {
|
|
|
511
495
|
case "s":
|
|
512
496
|
{
|
|
513
497
|
const t = r.map((t, n) => n % 2 ? t + s : t + e);
|
|
514
|
-
|
|
498
|
+
o.push({
|
|
515
499
|
key: "S",
|
|
516
500
|
data: t
|
|
517
501
|
}), e = t[2], s = t[3];
|
|
518
502
|
break;
|
|
519
503
|
}
|
|
520
504
|
case "T":
|
|
521
|
-
|
|
505
|
+
o.push({
|
|
522
506
|
key: "T",
|
|
523
507
|
data: [...r]
|
|
524
508
|
}), e = r[0], s = r[1];
|
|
525
509
|
break;
|
|
526
510
|
case "t":
|
|
527
|
-
e += r[0], s += r[1],
|
|
511
|
+
e += r[0], s += r[1], o.push({
|
|
528
512
|
key: "T",
|
|
529
513
|
data: [e, s]
|
|
530
514
|
});
|
|
531
515
|
break;
|
|
532
516
|
case "Z":
|
|
533
517
|
case "z":
|
|
534
|
-
|
|
518
|
+
o.push({
|
|
535
519
|
key: "Z",
|
|
536
520
|
data: []
|
|
537
|
-
}), e = n, s =
|
|
521
|
+
}), e = n, s = a;
|
|
538
522
|
}
|
|
539
|
-
return
|
|
523
|
+
return o;
|
|
540
524
|
}
|
|
541
|
-
function
|
|
525
|
+
function g(t) {
|
|
542
526
|
const e = [];
|
|
543
527
|
let s = "",
|
|
544
528
|
n = 0,
|
|
545
|
-
o = 0,
|
|
546
529
|
a = 0,
|
|
530
|
+
o = 0,
|
|
547
531
|
h = 0,
|
|
548
532
|
r = 0,
|
|
549
533
|
i = 0;
|
|
@@ -556,90 +540,90 @@ function m$2(t) {
|
|
|
556
540
|
e.push({
|
|
557
541
|
key: "M",
|
|
558
542
|
data: [...l]
|
|
559
|
-
}), [n,
|
|
543
|
+
}), [n, a] = l, [o, h] = l;
|
|
560
544
|
break;
|
|
561
545
|
case "C":
|
|
562
546
|
e.push({
|
|
563
547
|
key: "C",
|
|
564
548
|
data: [...l]
|
|
565
|
-
}), n = l[4],
|
|
549
|
+
}), n = l[4], a = l[5], r = l[2], i = l[3];
|
|
566
550
|
break;
|
|
567
551
|
case "L":
|
|
568
552
|
e.push({
|
|
569
553
|
key: "L",
|
|
570
554
|
data: [...l]
|
|
571
|
-
}), [n,
|
|
555
|
+
}), [n, a] = l;
|
|
572
556
|
break;
|
|
573
557
|
case "H":
|
|
574
558
|
n = l[0], e.push({
|
|
575
559
|
key: "L",
|
|
576
|
-
data: [n,
|
|
560
|
+
data: [n, a]
|
|
577
561
|
});
|
|
578
562
|
break;
|
|
579
563
|
case "V":
|
|
580
|
-
|
|
564
|
+
a = l[0], e.push({
|
|
581
565
|
key: "L",
|
|
582
|
-
data: [n,
|
|
566
|
+
data: [n, a]
|
|
583
567
|
});
|
|
584
568
|
break;
|
|
585
569
|
case "S":
|
|
586
570
|
{
|
|
587
571
|
let t = 0,
|
|
588
|
-
|
|
589
|
-
"C" === s || "S" === s ? (t = n + (n - r),
|
|
572
|
+
o = 0;
|
|
573
|
+
"C" === s || "S" === s ? (t = n + (n - r), o = a + (a - i)) : (t = n, o = a), e.push({
|
|
590
574
|
key: "C",
|
|
591
|
-
data: [t,
|
|
592
|
-
}), r = l[0], i = l[1], n = l[2],
|
|
575
|
+
data: [t, o, ...l]
|
|
576
|
+
}), r = l[0], i = l[1], n = l[2], a = l[3];
|
|
593
577
|
break;
|
|
594
578
|
}
|
|
595
579
|
case "T":
|
|
596
580
|
{
|
|
597
|
-
const [t,
|
|
581
|
+
const [t, o] = l;
|
|
598
582
|
let h = 0,
|
|
599
583
|
c = 0;
|
|
600
|
-
"Q" === s || "T" === s ? (h = n + (n - r), c =
|
|
584
|
+
"Q" === s || "T" === s ? (h = n + (n - r), c = a + (a - i)) : (h = n, c = a);
|
|
601
585
|
const u = n + 2 * (h - n) / 3,
|
|
602
|
-
p =
|
|
586
|
+
p = a + 2 * (c - a) / 3,
|
|
603
587
|
f = t + 2 * (h - t) / 3,
|
|
604
|
-
d =
|
|
588
|
+
d = o + 2 * (c - o) / 3;
|
|
605
589
|
e.push({
|
|
606
590
|
key: "C",
|
|
607
|
-
data: [u, p, f, d, t,
|
|
608
|
-
}), r = h, i = c, n = t,
|
|
591
|
+
data: [u, p, f, d, t, o]
|
|
592
|
+
}), r = h, i = c, n = t, a = o;
|
|
609
593
|
break;
|
|
610
594
|
}
|
|
611
595
|
case "Q":
|
|
612
596
|
{
|
|
613
|
-
const [t, s,
|
|
597
|
+
const [t, s, o, h] = l,
|
|
614
598
|
c = n + 2 * (t - n) / 3,
|
|
615
|
-
u =
|
|
616
|
-
p =
|
|
599
|
+
u = a + 2 * (s - a) / 3,
|
|
600
|
+
p = o + 2 * (t - o) / 3,
|
|
617
601
|
f = h + 2 * (s - h) / 3;
|
|
618
602
|
e.push({
|
|
619
603
|
key: "C",
|
|
620
|
-
data: [c, u, p, f,
|
|
621
|
-
}), r = t, i = s, n =
|
|
604
|
+
data: [c, u, p, f, o, h]
|
|
605
|
+
}), r = t, i = s, n = o, a = h;
|
|
622
606
|
break;
|
|
623
607
|
}
|
|
624
608
|
case "A":
|
|
625
609
|
{
|
|
626
610
|
const t = Math.abs(l[0]),
|
|
627
611
|
s = Math.abs(l[1]),
|
|
628
|
-
|
|
612
|
+
o = l[2],
|
|
629
613
|
h = l[3],
|
|
630
614
|
r = l[4],
|
|
631
615
|
i = l[5],
|
|
632
616
|
c = l[6];
|
|
633
617
|
if (0 === t || 0 === s) e.push({
|
|
634
618
|
key: "C",
|
|
635
|
-
data: [n,
|
|
636
|
-
}), n = i,
|
|
637
|
-
|
|
619
|
+
data: [n, a, i, c, i, c]
|
|
620
|
+
}), n = i, a = c;else if (n !== i || a !== c) {
|
|
621
|
+
k(n, a, i, c, t, s, o, h, r).forEach(function (t) {
|
|
638
622
|
e.push({
|
|
639
623
|
key: "C",
|
|
640
624
|
data: t
|
|
641
625
|
});
|
|
642
|
-
}), n = i,
|
|
626
|
+
}), n = i, a = c;
|
|
643
627
|
}
|
|
644
628
|
break;
|
|
645
629
|
}
|
|
@@ -647,180 +631,171 @@ function m$2(t) {
|
|
|
647
631
|
e.push({
|
|
648
632
|
key: "Z",
|
|
649
633
|
data: []
|
|
650
|
-
}), n =
|
|
634
|
+
}), n = o, a = h;
|
|
651
635
|
}
|
|
652
636
|
s = c;
|
|
653
637
|
}
|
|
654
638
|
return e;
|
|
655
639
|
}
|
|
656
|
-
function
|
|
640
|
+
function M(t, e, s) {
|
|
657
641
|
return [t * Math.cos(s) - e * Math.sin(s), t * Math.sin(s) + e * Math.cos(s)];
|
|
658
642
|
}
|
|
659
|
-
function
|
|
643
|
+
function k(t, e, s, n, a, o, h, r, i, c) {
|
|
660
644
|
const l = (u = h, Math.PI * u / 180);
|
|
661
645
|
var u;
|
|
662
646
|
let p = [],
|
|
663
647
|
f = 0,
|
|
664
648
|
d = 0,
|
|
665
649
|
g = 0,
|
|
666
|
-
|
|
667
|
-
if (c) [f, d, g,
|
|
668
|
-
[t, e] =
|
|
650
|
+
b = 0;
|
|
651
|
+
if (c) [f, d, g, b] = c;else {
|
|
652
|
+
[t, e] = M(t, e, -l), [s, n] = M(s, n, -l);
|
|
669
653
|
const h = (t - s) / 2,
|
|
670
654
|
c = (e - n) / 2;
|
|
671
|
-
let u = h * h / (
|
|
672
|
-
u > 1 && (u = Math.sqrt(u),
|
|
673
|
-
const p =
|
|
674
|
-
k =
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
g =
|
|
655
|
+
let u = h * h / (a * a) + c * c / (o * o);
|
|
656
|
+
u > 1 && (u = Math.sqrt(u), a *= u, o *= u);
|
|
657
|
+
const p = a * a,
|
|
658
|
+
k = o * o,
|
|
659
|
+
y = p * k - p * c * c - k * h * h,
|
|
660
|
+
m = p * c * c + k * h * h,
|
|
661
|
+
w = (r === i ? -1 : 1) * Math.sqrt(Math.abs(y / m));
|
|
662
|
+
g = w * a * c / o + (t + s) / 2, b = w * -o * h / a + (e + n) / 2, f = Math.asin(parseFloat(((e - b) / o).toFixed(9))), d = Math.asin(parseFloat(((n - b) / o).toFixed(9))), t < g && (f = Math.PI - f), s < g && (d = Math.PI - d), f < 0 && (f = 2 * Math.PI + f), d < 0 && (d = 2 * Math.PI + d), i && f > d && (f -= 2 * Math.PI), !i && d > f && (d -= 2 * Math.PI);
|
|
679
663
|
}
|
|
680
|
-
let
|
|
681
|
-
if (Math.abs(
|
|
664
|
+
let y = d - f;
|
|
665
|
+
if (Math.abs(y) > 120 * Math.PI / 180) {
|
|
682
666
|
const t = d,
|
|
683
667
|
e = s,
|
|
684
668
|
r = n;
|
|
685
|
-
d = i && d > f ? f + 120 * Math.PI / 180 * 1 : f + 120 * Math.PI / 180 * -1, p =
|
|
669
|
+
d = i && d > f ? f + 120 * Math.PI / 180 * 1 : f + 120 * Math.PI / 180 * -1, p = k(s = g + a * Math.cos(d), n = b + o * Math.sin(d), e, r, a, o, h, 0, i, [d, t, g, b]);
|
|
686
670
|
}
|
|
687
|
-
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
671
|
+
y = d - f;
|
|
672
|
+
const m = Math.cos(f),
|
|
673
|
+
w = Math.sin(f),
|
|
674
|
+
x = Math.cos(d),
|
|
691
675
|
P = Math.sin(d),
|
|
692
|
-
v = Math.tan(
|
|
693
|
-
S = 4 / 3 * o * v,
|
|
676
|
+
v = Math.tan(y / 4),
|
|
694
677
|
O = 4 / 3 * a * v,
|
|
678
|
+
S = 4 / 3 * o * v,
|
|
695
679
|
L = [t, e],
|
|
696
|
-
T = [t +
|
|
697
|
-
D = [s +
|
|
680
|
+
T = [t + O * w, e - S * m],
|
|
681
|
+
D = [s + O * P, n - S * x],
|
|
698
682
|
A = [s, n];
|
|
699
683
|
if (T[0] = 2 * L[0] - T[0], T[1] = 2 * L[1] - T[1], c) return [T, D, A].concat(p);
|
|
700
684
|
{
|
|
701
685
|
p = [T, D, A].concat(p);
|
|
702
686
|
const t = [];
|
|
703
687
|
for (let e = 0; e < p.length; e += 3) {
|
|
704
|
-
const s =
|
|
705
|
-
n =
|
|
706
|
-
|
|
707
|
-
t.push([s[0], s[1], n[0], n[1],
|
|
688
|
+
const s = M(p[e][0], p[e][1], l),
|
|
689
|
+
n = M(p[e + 1][0], p[e + 1][1], l),
|
|
690
|
+
a = M(p[e + 2][0], p[e + 2][1], l);
|
|
691
|
+
t.push([s[0], s[1], n[0], n[1], a[0], a[1]]);
|
|
708
692
|
}
|
|
709
693
|
return t;
|
|
710
694
|
}
|
|
711
695
|
}
|
|
712
|
-
const
|
|
696
|
+
const b = {
|
|
713
697
|
randOffset: function (t, e) {
|
|
714
|
-
return
|
|
698
|
+
return A(t, e);
|
|
715
699
|
},
|
|
716
700
|
randOffsetWithRange: function (t, e, s) {
|
|
717
|
-
return
|
|
701
|
+
return D(t, e, s);
|
|
718
702
|
},
|
|
719
|
-
ellipse: function (t, e, s, n,
|
|
720
|
-
const
|
|
721
|
-
return
|
|
703
|
+
ellipse: function (t, e, s, n, a) {
|
|
704
|
+
const o = P(s, n, a);
|
|
705
|
+
return v(t, e, a, o).opset;
|
|
722
706
|
},
|
|
723
|
-
doubleLineOps: function (t, e, s, n,
|
|
724
|
-
return
|
|
707
|
+
doubleLineOps: function (t, e, s, n, a) {
|
|
708
|
+
return I(t, e, s, n, a, !0);
|
|
725
709
|
}
|
|
726
710
|
};
|
|
727
|
-
function
|
|
711
|
+
function y(t, e, s, n, a) {
|
|
728
712
|
return {
|
|
729
713
|
type: "path",
|
|
730
|
-
ops:
|
|
714
|
+
ops: I(t, e, s, n, a)
|
|
731
715
|
};
|
|
732
716
|
}
|
|
733
|
-
function
|
|
717
|
+
function m$2(t, e, s) {
|
|
734
718
|
const n = (t || []).length;
|
|
735
719
|
if (n > 2) {
|
|
736
|
-
const
|
|
737
|
-
for (let e = 0; e < n - 1; e++)
|
|
738
|
-
return e &&
|
|
720
|
+
const a = [];
|
|
721
|
+
for (let e = 0; e < n - 1; e++) a.push(...I(t[e][0], t[e][1], t[e + 1][0], t[e + 1][1], s));
|
|
722
|
+
return e && a.push(...I(t[n - 1][0], t[n - 1][1], t[0][0], t[0][1], s)), {
|
|
739
723
|
type: "path",
|
|
740
|
-
ops:
|
|
724
|
+
ops: a
|
|
741
725
|
};
|
|
742
726
|
}
|
|
743
|
-
return 2 === n ?
|
|
727
|
+
return 2 === n ? y(t[0][0], t[0][1], t[1][0], t[1][1], s) : {
|
|
744
728
|
type: "path",
|
|
745
729
|
ops: []
|
|
746
730
|
};
|
|
747
731
|
}
|
|
748
|
-
function
|
|
732
|
+
function w(t, e, s, n, a) {
|
|
749
733
|
return function (t, e) {
|
|
750
|
-
return
|
|
751
|
-
}([[t, e], [t + s, e], [t + s, e + n], [t, e + n]],
|
|
752
|
-
}
|
|
753
|
-
function
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
s = e.disableMultiStroke ? [] : j(a, 1.5 * (1 + .22 * e.roughness), z(e));
|
|
763
|
-
for (const e of t) "move" !== e.op && n.push(e);
|
|
764
|
-
for (const t of s) "move" !== t.op && o.push(t);
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
return {
|
|
768
|
-
type: "path",
|
|
769
|
-
ops: n.concat(o)
|
|
770
|
-
};
|
|
734
|
+
return m$2(t, !0, e);
|
|
735
|
+
}([[t, e], [t + s, e], [t + s, e + n], [t, e + n]], a);
|
|
736
|
+
}
|
|
737
|
+
function x(t, e) {
|
|
738
|
+
let s = _(t, 1 * (1 + .2 * e.roughness), e);
|
|
739
|
+
if (!e.disableMultiStroke) {
|
|
740
|
+
const n = _(t, 1.5 * (1 + .22 * e.roughness), function (t) {
|
|
741
|
+
const e = Object.assign({}, t);
|
|
742
|
+
e.randomizer = void 0, t.seed && (e.seed = t.seed + 1);
|
|
743
|
+
return e;
|
|
744
|
+
}(e));
|
|
745
|
+
s = s.concat(n);
|
|
771
746
|
}
|
|
772
747
|
return {
|
|
773
748
|
type: "path",
|
|
774
|
-
ops:
|
|
749
|
+
ops: s
|
|
775
750
|
};
|
|
776
751
|
}
|
|
777
|
-
function
|
|
752
|
+
function P(t, e, s) {
|
|
778
753
|
const n = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(t / 2, 2) + Math.pow(e / 2, 2)) / 2)),
|
|
779
|
-
|
|
780
|
-
|
|
754
|
+
a = Math.ceil(Math.max(s.curveStepCount, s.curveStepCount / Math.sqrt(200) * n)),
|
|
755
|
+
o = 2 * Math.PI / a;
|
|
781
756
|
let h = Math.abs(t / 2),
|
|
782
757
|
r = Math.abs(e / 2);
|
|
783
758
|
const i = 1 - s.curveFitting;
|
|
784
|
-
return h +=
|
|
785
|
-
increment:
|
|
759
|
+
return h += A(h * i, s), r += A(r * i, s), {
|
|
760
|
+
increment: o,
|
|
786
761
|
rx: h,
|
|
787
762
|
ry: r
|
|
788
763
|
};
|
|
789
764
|
}
|
|
790
|
-
function
|
|
791
|
-
const [
|
|
792
|
-
let h =
|
|
765
|
+
function v(t, e, s, n) {
|
|
766
|
+
const [a, o] = z(n.increment, t, e, n.rx, n.ry, 1, n.increment * D(.1, D(.4, 1, s), s), s);
|
|
767
|
+
let h = W(a, null, s);
|
|
793
768
|
if (!s.disableMultiStroke && 0 !== s.roughness) {
|
|
794
|
-
const [
|
|
795
|
-
|
|
796
|
-
h = h.concat(
|
|
769
|
+
const [a] = z(n.increment, t, e, n.rx, n.ry, 1.5, 0, s),
|
|
770
|
+
o = W(a, null, s);
|
|
771
|
+
h = h.concat(o);
|
|
797
772
|
}
|
|
798
773
|
return {
|
|
799
|
-
estimatedPoints:
|
|
774
|
+
estimatedPoints: o,
|
|
800
775
|
opset: {
|
|
801
776
|
type: "path",
|
|
802
777
|
ops: h
|
|
803
778
|
}
|
|
804
779
|
};
|
|
805
780
|
}
|
|
806
|
-
function
|
|
781
|
+
function O(t, e, s, n, a, o, h, r, i) {
|
|
807
782
|
const c = t,
|
|
808
783
|
l = e;
|
|
809
784
|
let u = Math.abs(s / 2),
|
|
810
785
|
p = Math.abs(n / 2);
|
|
811
|
-
u +=
|
|
812
|
-
let f =
|
|
813
|
-
d =
|
|
786
|
+
u += A(.01 * u, i), p += A(.01 * p, i);
|
|
787
|
+
let f = a,
|
|
788
|
+
d = o;
|
|
814
789
|
for (; f < 0;) f += 2 * Math.PI, d += 2 * Math.PI;
|
|
815
790
|
d - f > 2 * Math.PI && (f = 0, d = 2 * Math.PI);
|
|
816
791
|
const g = 2 * Math.PI / i.curveStepCount,
|
|
817
792
|
M = Math.min(g / 2, (d - f) / 2),
|
|
818
|
-
k =
|
|
793
|
+
k = E(M, c, l, u, p, f, d, 1, i);
|
|
819
794
|
if (!i.disableMultiStroke) {
|
|
820
|
-
const t =
|
|
795
|
+
const t = E(M, c, l, u, p, f, d, 1.5, i);
|
|
821
796
|
k.push(...t);
|
|
822
797
|
}
|
|
823
|
-
return h && (r ? k.push(
|
|
798
|
+
return h && (r ? k.push(...I(c, l, c + u * Math.cos(f), l + p * Math.sin(f), i), ...I(c, l, c + u * Math.cos(d), l + p * Math.sin(d), i)) : k.push({
|
|
824
799
|
op: "lineTo",
|
|
825
800
|
data: [c, l]
|
|
826
801
|
}, {
|
|
@@ -831,48 +806,19 @@ function A(t, e, s, n, o, a, h, r, i) {
|
|
|
831
806
|
ops: k
|
|
832
807
|
};
|
|
833
808
|
}
|
|
834
|
-
function
|
|
835
|
-
const s = m$2(y(b(t))),
|
|
836
|
-
n = [];
|
|
837
|
-
let o = [0, 0],
|
|
838
|
-
a = [0, 0];
|
|
839
|
-
for (const {
|
|
840
|
-
key: t,
|
|
841
|
-
data: h
|
|
842
|
-
} of s) switch (t) {
|
|
843
|
-
case "M":
|
|
844
|
-
a = [h[0], h[1]], o = [h[0], h[1]];
|
|
845
|
-
break;
|
|
846
|
-
case "L":
|
|
847
|
-
n.push(...$(a[0], a[1], h[0], h[1], e)), a = [h[0], h[1]];
|
|
848
|
-
break;
|
|
849
|
-
case "C":
|
|
850
|
-
{
|
|
851
|
-
const [t, s, o, r, i, c] = h;
|
|
852
|
-
n.push(...Z(t, s, o, r, i, c, a, e)), a = [i, c];
|
|
853
|
-
break;
|
|
854
|
-
}
|
|
855
|
-
case "Z":
|
|
856
|
-
n.push(...$(a[0], a[1], o[0], o[1], e)), a = [o[0], o[1]];
|
|
857
|
-
}
|
|
858
|
-
return {
|
|
859
|
-
type: "path",
|
|
860
|
-
ops: n
|
|
861
|
-
};
|
|
862
|
-
}
|
|
863
|
-
function I(t, e) {
|
|
809
|
+
function S(t, e) {
|
|
864
810
|
const s = [];
|
|
865
811
|
for (const n of t) if (n.length) {
|
|
866
812
|
const t = e.maxRandomnessOffset || 0,
|
|
867
|
-
|
|
868
|
-
if (
|
|
813
|
+
a = n.length;
|
|
814
|
+
if (a > 2) {
|
|
869
815
|
s.push({
|
|
870
816
|
op: "move",
|
|
871
|
-
data: [n[0][0] +
|
|
817
|
+
data: [n[0][0] + A(t, e), n[0][1] + A(t, e)]
|
|
872
818
|
});
|
|
873
|
-
for (let
|
|
819
|
+
for (let o = 1; o < a; o++) s.push({
|
|
874
820
|
op: "lineTo",
|
|
875
|
-
data: [n[
|
|
821
|
+
data: [n[o][0] + A(t, e), n[o][1] + A(t, e)]
|
|
876
822
|
});
|
|
877
823
|
}
|
|
878
824
|
}
|
|
@@ -881,76 +827,73 @@ function I(t, e) {
|
|
|
881
827
|
ops: s
|
|
882
828
|
};
|
|
883
829
|
}
|
|
884
|
-
function
|
|
830
|
+
function L(t, e) {
|
|
885
831
|
return function (t, e) {
|
|
886
832
|
let s = t.fillStyle || "hachure";
|
|
887
|
-
if (!
|
|
833
|
+
if (!c[s]) switch (s) {
|
|
888
834
|
case "zigzag":
|
|
889
|
-
|
|
835
|
+
c[s] || (c[s] = new a(e));
|
|
890
836
|
break;
|
|
891
837
|
case "cross-hatch":
|
|
892
|
-
|
|
838
|
+
c[s] || (c[s] = new o(e));
|
|
893
839
|
break;
|
|
894
840
|
case "dots":
|
|
895
|
-
|
|
841
|
+
c[s] || (c[s] = new h(e));
|
|
896
842
|
break;
|
|
897
843
|
case "dashed":
|
|
898
|
-
|
|
844
|
+
c[s] || (c[s] = new r(e));
|
|
899
845
|
break;
|
|
900
846
|
case "zigzag-line":
|
|
901
|
-
|
|
847
|
+
c[s] || (c[s] = new i(e));
|
|
902
848
|
break;
|
|
849
|
+
case "hachure":
|
|
903
850
|
default:
|
|
904
|
-
s = "hachure",
|
|
851
|
+
s = "hachure", c[s] || (c[s] = new n(e));
|
|
905
852
|
}
|
|
906
|
-
return
|
|
907
|
-
}(e,
|
|
908
|
-
}
|
|
909
|
-
function z(t) {
|
|
910
|
-
const e = Object.assign({}, t);
|
|
911
|
-
return e.randomizer = void 0, t.seed && (e.seed = t.seed + 1), e;
|
|
853
|
+
return c[s];
|
|
854
|
+
}(e, b).fillPolygons(t, e);
|
|
912
855
|
}
|
|
913
|
-
function
|
|
914
|
-
return t.randomizer || (t.randomizer = new
|
|
856
|
+
function T(t) {
|
|
857
|
+
return t.randomizer || (t.randomizer = new l(t.seed || 0)), t.randomizer.next();
|
|
915
858
|
}
|
|
916
|
-
function
|
|
859
|
+
function D(t, e, s) {
|
|
917
860
|
let n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
918
|
-
return s.roughness * n * (
|
|
861
|
+
return s.roughness * n * (T(s) * (e - t) + t);
|
|
919
862
|
}
|
|
920
|
-
function
|
|
863
|
+
function A(t, e) {
|
|
921
864
|
let s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
922
|
-
return
|
|
865
|
+
return D(-t, t, e, s);
|
|
923
866
|
}
|
|
924
|
-
function
|
|
925
|
-
let
|
|
926
|
-
const h =
|
|
927
|
-
r =
|
|
867
|
+
function I(t, e, s, n, a) {
|
|
868
|
+
let o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;
|
|
869
|
+
const h = o ? a.disableMultiStrokeFill : a.disableMultiStroke,
|
|
870
|
+
r = C(t, e, s, n, a, !0, !1);
|
|
928
871
|
if (h) return r;
|
|
929
|
-
const i =
|
|
872
|
+
const i = C(t, e, s, n, a, !0, !0);
|
|
930
873
|
return r.concat(i);
|
|
931
874
|
}
|
|
932
|
-
function
|
|
875
|
+
function C(t, e, s, n, a, o, h) {
|
|
933
876
|
const r = Math.pow(t - s, 2) + Math.pow(e - n, 2),
|
|
934
877
|
i = Math.sqrt(r);
|
|
935
878
|
let c = 1;
|
|
936
879
|
c = i < 200 ? 1 : i > 500 ? .4 : -.0016668 * i + 1.233334;
|
|
937
|
-
let l =
|
|
880
|
+
let l = a.maxRandomnessOffset || 0;
|
|
938
881
|
l * l * 100 > r && (l = i / 10);
|
|
939
882
|
const u = l / 2,
|
|
940
|
-
p = .2 + .2 *
|
|
941
|
-
let f =
|
|
942
|
-
d =
|
|
943
|
-
f =
|
|
883
|
+
p = .2 + .2 * T(a);
|
|
884
|
+
let f = a.bowing * a.maxRandomnessOffset * (n - e) / 200,
|
|
885
|
+
d = a.bowing * a.maxRandomnessOffset * (t - s) / 200;
|
|
886
|
+
f = A(f, a, c), d = A(d, a, c);
|
|
944
887
|
const g = [],
|
|
945
|
-
M = () =>
|
|
946
|
-
k = () =>
|
|
947
|
-
b =
|
|
948
|
-
return
|
|
888
|
+
M = () => A(u, a, c),
|
|
889
|
+
k = () => A(l, a, c),
|
|
890
|
+
b = a.preserveVertices;
|
|
891
|
+
return o && (h ? g.push({
|
|
949
892
|
op: "move",
|
|
950
893
|
data: [t + (b ? 0 : M()), e + (b ? 0 : M())]
|
|
951
894
|
}) : g.push({
|
|
952
895
|
op: "move",
|
|
953
|
-
data: [t + (b ? 0 :
|
|
896
|
+
data: [t + (b ? 0 : A(l, a, c)), e + (b ? 0 : A(l, a, c))]
|
|
954
897
|
})), h ? g.push({
|
|
955
898
|
op: "bcurveTo",
|
|
956
899
|
data: [f + t + (s - t) * p + M(), d + e + (n - e) * p + M(), f + t + 2 * (s - t) * p + M(), d + e + 2 * (n - e) * p + M(), s + (b ? 0 : M()), n + (b ? 0 : M())]
|
|
@@ -959,76 +902,75 @@ function R(t, e, s, n, o, a, h) {
|
|
|
959
902
|
data: [f + t + (s - t) * p + k(), d + e + (n - e) * p + k(), f + t + 2 * (s - t) * p + k(), d + e + 2 * (n - e) * p + k(), s + (b ? 0 : k()), n + (b ? 0 : k())]
|
|
960
903
|
}), g;
|
|
961
904
|
}
|
|
962
|
-
function
|
|
963
|
-
if (!t.length) return [];
|
|
905
|
+
function _(t, e, s) {
|
|
964
906
|
const n = [];
|
|
965
|
-
n.push([t[0][0] +
|
|
966
|
-
for (let
|
|
967
|
-
return
|
|
907
|
+
n.push([t[0][0] + A(e, s), t[0][1] + A(e, s)]), n.push([t[0][0] + A(e, s), t[0][1] + A(e, s)]);
|
|
908
|
+
for (let a = 1; a < t.length; a++) n.push([t[a][0] + A(e, s), t[a][1] + A(e, s)]), a === t.length - 1 && n.push([t[a][0] + A(e, s), t[a][1] + A(e, s)]);
|
|
909
|
+
return W(n, null, s);
|
|
968
910
|
}
|
|
969
|
-
function
|
|
911
|
+
function W(t, e, s) {
|
|
970
912
|
const n = t.length,
|
|
971
|
-
|
|
913
|
+
a = [];
|
|
972
914
|
if (n > 3) {
|
|
973
|
-
const
|
|
915
|
+
const o = [],
|
|
974
916
|
h = 1 - s.curveTightness;
|
|
975
|
-
|
|
917
|
+
a.push({
|
|
976
918
|
op: "move",
|
|
977
919
|
data: [t[1][0], t[1][1]]
|
|
978
920
|
});
|
|
979
921
|
for (let e = 1; e + 2 < n; e++) {
|
|
980
922
|
const s = t[e];
|
|
981
|
-
|
|
923
|
+
o[0] = [s[0], s[1]], o[1] = [s[0] + (h * t[e + 1][0] - h * t[e - 1][0]) / 6, s[1] + (h * t[e + 1][1] - h * t[e - 1][1]) / 6], o[2] = [t[e + 1][0] + (h * t[e][0] - h * t[e + 2][0]) / 6, t[e + 1][1] + (h * t[e][1] - h * t[e + 2][1]) / 6], o[3] = [t[e + 1][0], t[e + 1][1]], a.push({
|
|
982
924
|
op: "bcurveTo",
|
|
983
|
-
data: [
|
|
925
|
+
data: [o[1][0], o[1][1], o[2][0], o[2][1], o[3][0], o[3][1]]
|
|
984
926
|
});
|
|
985
927
|
}
|
|
986
928
|
if (e && 2 === e.length) {
|
|
987
929
|
const t = s.maxRandomnessOffset;
|
|
988
|
-
|
|
930
|
+
a.push({
|
|
989
931
|
op: "lineTo",
|
|
990
|
-
data: [e[0] +
|
|
932
|
+
data: [e[0] + A(t, s), e[1] + A(t, s)]
|
|
991
933
|
});
|
|
992
934
|
}
|
|
993
|
-
} else 3 === n ? (
|
|
935
|
+
} else 3 === n ? (a.push({
|
|
994
936
|
op: "move",
|
|
995
937
|
data: [t[1][0], t[1][1]]
|
|
996
|
-
}),
|
|
938
|
+
}), a.push({
|
|
997
939
|
op: "bcurveTo",
|
|
998
940
|
data: [t[1][0], t[1][1], t[2][0], t[2][1], t[2][0], t[2][1]]
|
|
999
|
-
})) : 2 === n &&
|
|
1000
|
-
return
|
|
941
|
+
})) : 2 === n && a.push(...I(t[0][0], t[0][1], t[1][0], t[1][1], s));
|
|
942
|
+
return a;
|
|
1001
943
|
}
|
|
1002
|
-
function
|
|
944
|
+
function z(t, e, s, n, a, o, h, r) {
|
|
1003
945
|
const i = [],
|
|
1004
946
|
c = [];
|
|
1005
947
|
if (0 === r.roughness) {
|
|
1006
|
-
t /= 4, c.push([e + n * Math.cos(-t), s +
|
|
1007
|
-
for (let
|
|
1008
|
-
const t = [e + n * Math.cos(
|
|
948
|
+
t /= 4, c.push([e + n * Math.cos(-t), s + a * Math.sin(-t)]);
|
|
949
|
+
for (let o = 0; o <= 2 * Math.PI; o += t) {
|
|
950
|
+
const t = [e + n * Math.cos(o), s + a * Math.sin(o)];
|
|
1009
951
|
i.push(t), c.push(t);
|
|
1010
952
|
}
|
|
1011
|
-
c.push([e + n * Math.cos(0), s +
|
|
953
|
+
c.push([e + n * Math.cos(0), s + a * Math.sin(0)]), c.push([e + n * Math.cos(t), s + a * Math.sin(t)]);
|
|
1012
954
|
} else {
|
|
1013
|
-
const l =
|
|
1014
|
-
c.push([
|
|
955
|
+
const l = A(.5, r) - Math.PI / 2;
|
|
956
|
+
c.push([A(o, r) + e + .9 * n * Math.cos(l - t), A(o, r) + s + .9 * a * Math.sin(l - t)]);
|
|
1015
957
|
const u = 2 * Math.PI + l - .01;
|
|
1016
958
|
for (let h = l; h < u; h += t) {
|
|
1017
|
-
const t = [
|
|
959
|
+
const t = [A(o, r) + e + n * Math.cos(h), A(o, r) + s + a * Math.sin(h)];
|
|
1018
960
|
i.push(t), c.push(t);
|
|
1019
961
|
}
|
|
1020
|
-
c.push([
|
|
962
|
+
c.push([A(o, r) + e + n * Math.cos(l + 2 * Math.PI + .5 * h), A(o, r) + s + a * Math.sin(l + 2 * Math.PI + .5 * h)]), c.push([A(o, r) + e + .98 * n * Math.cos(l + h), A(o, r) + s + .98 * a * Math.sin(l + h)]), c.push([A(o, r) + e + .9 * n * Math.cos(l + .5 * h), A(o, r) + s + .9 * a * Math.sin(l + .5 * h)]);
|
|
1021
963
|
}
|
|
1022
964
|
return [c, i];
|
|
1023
965
|
}
|
|
1024
|
-
function
|
|
1025
|
-
const c =
|
|
966
|
+
function E(t, e, s, n, a, o, h, r, i) {
|
|
967
|
+
const c = o + A(.1, i),
|
|
1026
968
|
l = [];
|
|
1027
|
-
l.push([
|
|
1028
|
-
for (let
|
|
1029
|
-
return l.push([e + n * Math.cos(h), s +
|
|
969
|
+
l.push([A(r, i) + e + .9 * n * Math.cos(c - t), A(r, i) + s + .9 * a * Math.sin(c - t)]);
|
|
970
|
+
for (let o = c; o <= h; o += t) l.push([A(r, i) + e + n * Math.cos(o), A(r, i) + s + a * Math.sin(o)]);
|
|
971
|
+
return l.push([e + n * Math.cos(h), s + a * Math.sin(h)]), l.push([e + n * Math.cos(h), s + a * Math.sin(h)]), W(l, null, i);
|
|
1030
972
|
}
|
|
1031
|
-
function
|
|
973
|
+
function $(t, e, s, n, a, o, h, r) {
|
|
1032
974
|
const i = [],
|
|
1033
975
|
c = [r.maxRandomnessOffset || 1, (r.maxRandomnessOffset || 1) + .3];
|
|
1034
976
|
let l = [0, 0];
|
|
@@ -1039,112 +981,93 @@ function Z(t, e, s, n, o, a, h, r) {
|
|
|
1039
981
|
data: [h[0], h[1]]
|
|
1040
982
|
}) : i.push({
|
|
1041
983
|
op: "move",
|
|
1042
|
-
data: [h[0] + (p ? 0 :
|
|
1043
|
-
}), l = p ? [
|
|
984
|
+
data: [h[0] + (p ? 0 : A(c[0], r)), h[1] + (p ? 0 : A(c[0], r))]
|
|
985
|
+
}), l = p ? [a, o] : [a + A(c[f], r), o + A(c[f], r)], i.push({
|
|
1044
986
|
op: "bcurveTo",
|
|
1045
|
-
data: [t +
|
|
987
|
+
data: [t + A(c[f], r), e + A(c[f], r), s + A(c[f], r), n + A(c[f], r), l[0], l[1]]
|
|
1046
988
|
});
|
|
1047
989
|
return i;
|
|
1048
990
|
}
|
|
1049
|
-
function
|
|
991
|
+
function G(t) {
|
|
1050
992
|
return [...t];
|
|
1051
993
|
}
|
|
1052
|
-
function
|
|
1053
|
-
let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1054
|
-
const s = t.length;
|
|
1055
|
-
if (s < 3) throw new Error("A curve must have at least three points.");
|
|
1056
|
-
const n = [];
|
|
1057
|
-
if (3 === s) n.push(Q(t[0]), Q(t[1]), Q(t[2]), Q(t[2]));else {
|
|
1058
|
-
const s = [];
|
|
1059
|
-
s.push(t[0], t[0]);
|
|
1060
|
-
for (let e = 1; e < t.length; e++) s.push(t[e]), e === t.length - 1 && s.push(t[e]);
|
|
1061
|
-
const o = [],
|
|
1062
|
-
a = 1 - e;
|
|
1063
|
-
n.push(Q(s[0]));
|
|
1064
|
-
for (let t = 1; t + 2 < s.length; t++) {
|
|
1065
|
-
const e = s[t];
|
|
1066
|
-
o[0] = [e[0], e[1]], o[1] = [e[0] + (a * s[t + 1][0] - a * s[t - 1][0]) / 6, e[1] + (a * s[t + 1][1] - a * s[t - 1][1]) / 6], o[2] = [s[t + 1][0] + (a * s[t][0] - a * s[t + 2][0]) / 6, s[t + 1][1] + (a * s[t][1] - a * s[t + 2][1]) / 6], o[3] = [s[t + 1][0], s[t + 1][1]], n.push(o[1], o[2], o[3]);
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
return n;
|
|
1070
|
-
}
|
|
1071
|
-
function N(t, e) {
|
|
994
|
+
function R(t, e) {
|
|
1072
995
|
return Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2);
|
|
1073
996
|
}
|
|
1074
|
-
function
|
|
1075
|
-
const n =
|
|
1076
|
-
if (0 === n) return
|
|
1077
|
-
let
|
|
1078
|
-
return
|
|
997
|
+
function q(t, e, s) {
|
|
998
|
+
const n = R(e, s);
|
|
999
|
+
if (0 === n) return R(t, e);
|
|
1000
|
+
let a = ((t[0] - e[0]) * (s[0] - e[0]) + (t[1] - e[1]) * (s[1] - e[1])) / n;
|
|
1001
|
+
return a = Math.max(0, Math.min(1, a)), R(t, j(e, s, a));
|
|
1079
1002
|
}
|
|
1080
|
-
function
|
|
1003
|
+
function j(t, e, s) {
|
|
1081
1004
|
return [t[0] + (e[0] - t[0]) * s, t[1] + (e[1] - t[1]) * s];
|
|
1082
1005
|
}
|
|
1083
|
-
function
|
|
1084
|
-
const
|
|
1006
|
+
function F(t, e, s, n) {
|
|
1007
|
+
const a = n || [];
|
|
1085
1008
|
if (function (t, e) {
|
|
1086
1009
|
const s = t[e + 0],
|
|
1087
1010
|
n = t[e + 1],
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
let h = 3 * n[0] - 2 * s[0] -
|
|
1011
|
+
a = t[e + 2],
|
|
1012
|
+
o = t[e + 3];
|
|
1013
|
+
let h = 3 * n[0] - 2 * s[0] - o[0];
|
|
1091
1014
|
h *= h;
|
|
1092
|
-
let r = 3 * n[1] - 2 * s[1] -
|
|
1015
|
+
let r = 3 * n[1] - 2 * s[1] - o[1];
|
|
1093
1016
|
r *= r;
|
|
1094
|
-
let i = 3 *
|
|
1017
|
+
let i = 3 * a[0] - 2 * o[0] - s[0];
|
|
1095
1018
|
i *= i;
|
|
1096
|
-
let c = 3 *
|
|
1019
|
+
let c = 3 * a[1] - 2 * o[1] - s[1];
|
|
1097
1020
|
return c *= c, h < i && (h = i), r < c && (r = c), h + r;
|
|
1098
1021
|
}(t, e) < s) {
|
|
1099
1022
|
const s = t[e + 0];
|
|
1100
|
-
if (
|
|
1101
|
-
(
|
|
1102
|
-
} else
|
|
1103
|
-
|
|
1023
|
+
if (a.length) {
|
|
1024
|
+
(o = a[a.length - 1], h = s, Math.sqrt(R(o, h))) > 1 && a.push(s);
|
|
1025
|
+
} else a.push(s);
|
|
1026
|
+
a.push(t[e + 3]);
|
|
1104
1027
|
} else {
|
|
1105
1028
|
const n = .5,
|
|
1106
|
-
|
|
1029
|
+
o = t[e + 0],
|
|
1107
1030
|
h = t[e + 1],
|
|
1108
1031
|
r = t[e + 2],
|
|
1109
1032
|
i = t[e + 3],
|
|
1110
|
-
c =
|
|
1111
|
-
l =
|
|
1112
|
-
u =
|
|
1113
|
-
p =
|
|
1114
|
-
f =
|
|
1115
|
-
d =
|
|
1116
|
-
|
|
1033
|
+
c = j(o, h, n),
|
|
1034
|
+
l = j(h, r, n),
|
|
1035
|
+
u = j(r, i, n),
|
|
1036
|
+
p = j(c, l, n),
|
|
1037
|
+
f = j(l, u, n),
|
|
1038
|
+
d = j(p, f, n);
|
|
1039
|
+
F([o, c, p, d], 0, s, a), F([d, f, u, i], 0, s, a);
|
|
1117
1040
|
}
|
|
1118
|
-
var
|
|
1119
|
-
return
|
|
1041
|
+
var o, h;
|
|
1042
|
+
return a;
|
|
1120
1043
|
}
|
|
1121
|
-
function
|
|
1122
|
-
return
|
|
1044
|
+
function V(t, e) {
|
|
1045
|
+
return Z(t, 0, t.length, e);
|
|
1123
1046
|
}
|
|
1124
|
-
function
|
|
1125
|
-
const
|
|
1047
|
+
function Z(t, e, s, n, a) {
|
|
1048
|
+
const o = a || [],
|
|
1126
1049
|
h = t[e],
|
|
1127
1050
|
r = t[s - 1];
|
|
1128
1051
|
let i = 0,
|
|
1129
1052
|
c = 1;
|
|
1130
1053
|
for (let n = e + 1; n < s - 1; ++n) {
|
|
1131
|
-
const e =
|
|
1054
|
+
const e = q(t[n], h, r);
|
|
1132
1055
|
e > i && (i = e, c = n);
|
|
1133
1056
|
}
|
|
1134
|
-
return Math.sqrt(i) > n ? (
|
|
1057
|
+
return Math.sqrt(i) > n ? (Z(t, e, c + 1, n, o), Z(t, c, s, n, o)) : (o.length || o.push(h), o.push(r)), o;
|
|
1135
1058
|
}
|
|
1136
|
-
function
|
|
1059
|
+
function Q(t) {
|
|
1137
1060
|
let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .15;
|
|
1138
1061
|
let s = arguments.length > 2 ? arguments[2] : undefined;
|
|
1139
1062
|
const n = [],
|
|
1140
|
-
|
|
1141
|
-
for (let s = 0; s <
|
|
1142
|
-
|
|
1063
|
+
a = (t.length - 1) / 3;
|
|
1064
|
+
for (let s = 0; s < a; s++) {
|
|
1065
|
+
F(t, 3 * s, e, n);
|
|
1143
1066
|
}
|
|
1144
|
-
return s && s > 0 ?
|
|
1067
|
+
return s && s > 0 ? Z(n, 0, n.length, s) : n;
|
|
1145
1068
|
}
|
|
1146
|
-
const
|
|
1147
|
-
class
|
|
1069
|
+
const H = "none";
|
|
1070
|
+
class N {
|
|
1148
1071
|
constructor(t) {
|
|
1149
1072
|
this.defaultOptions = {
|
|
1150
1073
|
maxRandomnessOffset: 2,
|
|
@@ -1165,8 +1088,7 @@ class et {
|
|
|
1165
1088
|
seed: 0,
|
|
1166
1089
|
disableMultiStroke: !1,
|
|
1167
1090
|
disableMultiStrokeFill: !1,
|
|
1168
|
-
preserveVertices: !1
|
|
1169
|
-
fillShapeRoughnessGain: .8
|
|
1091
|
+
preserveVertices: !1
|
|
1170
1092
|
}, this.config = t || {}, this.config.options && (this.defaultOptions = this._o(this.config.options));
|
|
1171
1093
|
}
|
|
1172
1094
|
static newSeed() {
|
|
@@ -1182,161 +1104,187 @@ class et {
|
|
|
1182
1104
|
options: s || this.defaultOptions
|
|
1183
1105
|
};
|
|
1184
1106
|
}
|
|
1185
|
-
line(t, e, s, n,
|
|
1186
|
-
const
|
|
1187
|
-
return this._d("line", [
|
|
1107
|
+
line(t, e, s, n, a) {
|
|
1108
|
+
const o = this._o(a);
|
|
1109
|
+
return this._d("line", [y(t, e, s, n, o)], o);
|
|
1188
1110
|
}
|
|
1189
|
-
rectangle(t, e, s, n,
|
|
1190
|
-
const
|
|
1111
|
+
rectangle(t, e, s, n, a) {
|
|
1112
|
+
const o = this._o(a),
|
|
1191
1113
|
h = [],
|
|
1192
|
-
r =
|
|
1193
|
-
if (
|
|
1194
|
-
const
|
|
1195
|
-
"solid" ===
|
|
1114
|
+
r = w(t, e, s, n, o);
|
|
1115
|
+
if (o.fill) {
|
|
1116
|
+
const a = [[t, e], [t + s, e], [t + s, e + n], [t, e + n]];
|
|
1117
|
+
"solid" === o.fillStyle ? h.push(S([a], o)) : h.push(L([a], o));
|
|
1196
1118
|
}
|
|
1197
|
-
return
|
|
1119
|
+
return o.stroke !== H && h.push(r), this._d("rectangle", h, o);
|
|
1198
1120
|
}
|
|
1199
|
-
ellipse(t, e, s, n,
|
|
1200
|
-
const
|
|
1121
|
+
ellipse(t, e, s, n, a) {
|
|
1122
|
+
const o = this._o(a),
|
|
1201
1123
|
h = [],
|
|
1202
|
-
r =
|
|
1203
|
-
i =
|
|
1204
|
-
if (
|
|
1205
|
-
const s =
|
|
1124
|
+
r = P(s, n, o),
|
|
1125
|
+
i = v(t, e, o, r);
|
|
1126
|
+
if (o.fill) if ("solid" === o.fillStyle) {
|
|
1127
|
+
const s = v(t, e, o, r).opset;
|
|
1206
1128
|
s.type = "fillPath", h.push(s);
|
|
1207
|
-
} else h.push(
|
|
1208
|
-
return
|
|
1129
|
+
} else h.push(L([i.estimatedPoints], o));
|
|
1130
|
+
return o.stroke !== H && h.push(i.opset), this._d("ellipse", h, o);
|
|
1209
1131
|
}
|
|
1210
1132
|
circle(t, e, s, n) {
|
|
1211
|
-
const
|
|
1212
|
-
return
|
|
1133
|
+
const a = this.ellipse(t, e, s, s, n);
|
|
1134
|
+
return a.shape = "circle", a;
|
|
1213
1135
|
}
|
|
1214
1136
|
linearPath(t, e) {
|
|
1215
1137
|
const s = this._o(e);
|
|
1216
|
-
return this._d("linearPath", [
|
|
1138
|
+
return this._d("linearPath", [m$2(t, !1, s)], s);
|
|
1217
1139
|
}
|
|
1218
|
-
arc(t, e, s, n,
|
|
1140
|
+
arc(t, e, s, n, a, o) {
|
|
1219
1141
|
let h = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
|
|
1220
1142
|
let r = arguments.length > 7 ? arguments[7] : undefined;
|
|
1221
1143
|
const i = this._o(r),
|
|
1222
1144
|
c = [],
|
|
1223
|
-
l =
|
|
1145
|
+
l = O(t, e, s, n, a, o, h, !0, i);
|
|
1224
1146
|
if (h && i.fill) if ("solid" === i.fillStyle) {
|
|
1225
1147
|
const h = Object.assign({}, i);
|
|
1226
1148
|
h.disableMultiStroke = !0;
|
|
1227
|
-
const r =
|
|
1149
|
+
const r = O(t, e, s, n, a, o, !0, !1, h);
|
|
1228
1150
|
r.type = "fillPath", c.push(r);
|
|
1229
|
-
} else c.push(function (t, e, s, n,
|
|
1151
|
+
} else c.push(function (t, e, s, n, a, o, h) {
|
|
1230
1152
|
const r = t,
|
|
1231
1153
|
i = e;
|
|
1232
1154
|
let c = Math.abs(s / 2),
|
|
1233
1155
|
l = Math.abs(n / 2);
|
|
1234
|
-
c +=
|
|
1235
|
-
let u =
|
|
1236
|
-
p =
|
|
1156
|
+
c += A(.01 * c, h), l += A(.01 * l, h);
|
|
1157
|
+
let u = a,
|
|
1158
|
+
p = o;
|
|
1237
1159
|
for (; u < 0;) u += 2 * Math.PI, p += 2 * Math.PI;
|
|
1238
1160
|
p - u > 2 * Math.PI && (u = 0, p = 2 * Math.PI);
|
|
1239
1161
|
const f = (p - u) / h.curveStepCount,
|
|
1240
1162
|
d = [];
|
|
1241
1163
|
for (let t = u; t <= p; t += f) d.push([r + c * Math.cos(t), i + l * Math.sin(t)]);
|
|
1242
|
-
return d.push([r + c * Math.cos(p), i + l * Math.sin(p)]), d.push([r, i]),
|
|
1243
|
-
}(t, e, s, n,
|
|
1244
|
-
return i.stroke !==
|
|
1164
|
+
return d.push([r + c * Math.cos(p), i + l * Math.sin(p)]), d.push([r, i]), L([d], h);
|
|
1165
|
+
}(t, e, s, n, a, o, i));
|
|
1166
|
+
return i.stroke !== H && c.push(l), this._d("arc", c, i);
|
|
1245
1167
|
}
|
|
1246
1168
|
curve(t, e) {
|
|
1247
1169
|
const s = this._o(e),
|
|
1248
1170
|
n = [],
|
|
1249
|
-
|
|
1250
|
-
if (s.fill && s.fill !==
|
|
1251
|
-
const e =
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1171
|
+
a = x(t, s);
|
|
1172
|
+
if (s.fill && s.fill !== H && t.length >= 3) {
|
|
1173
|
+
const e = Q(function (t) {
|
|
1174
|
+
let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1175
|
+
const s = t.length;
|
|
1176
|
+
if (s < 3) throw new Error("A curve must have at least three points.");
|
|
1177
|
+
const n = [];
|
|
1178
|
+
if (3 === s) n.push(G(t[0]), G(t[1]), G(t[2]), G(t[2]));else {
|
|
1179
|
+
const s = [];
|
|
1180
|
+
s.push(t[0], t[0]);
|
|
1181
|
+
for (let e = 1; e < t.length; e++) s.push(t[e]), e === t.length - 1 && s.push(t[e]);
|
|
1182
|
+
const a = [],
|
|
1183
|
+
o = 1 - e;
|
|
1184
|
+
n.push(G(s[0]));
|
|
1185
|
+
for (let t = 1; t + 2 < s.length; t++) {
|
|
1186
|
+
const e = s[t];
|
|
1187
|
+
a[0] = [e[0], e[1]], a[1] = [e[0] + (o * s[t + 1][0] - o * s[t - 1][0]) / 6, e[1] + (o * s[t + 1][1] - o * s[t - 1][1]) / 6], a[2] = [s[t + 1][0] + (o * s[t][0] - o * s[t + 2][0]) / 6, s[t + 1][1] + (o * s[t][1] - o * s[t + 2][1]) / 6], a[3] = [s[t + 1][0], s[t + 1][1]], n.push(a[1], a[2], a[3]);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return n;
|
|
1191
|
+
}(t), 10, (1 + s.roughness) / 2);
|
|
1192
|
+
"solid" === s.fillStyle ? n.push(S([e], s)) : n.push(L([e], s));
|
|
1267
1193
|
}
|
|
1268
|
-
return s.stroke !==
|
|
1194
|
+
return s.stroke !== H && n.push(a), this._d("curve", n, s);
|
|
1269
1195
|
}
|
|
1270
1196
|
polygon(t, e) {
|
|
1271
1197
|
const s = this._o(e),
|
|
1272
1198
|
n = [],
|
|
1273
|
-
|
|
1274
|
-
return s.fill && ("solid" === s.fillStyle ? n.push(
|
|
1199
|
+
a = m$2(t, !0, s);
|
|
1200
|
+
return s.fill && ("solid" === s.fillStyle ? n.push(S([t], s)) : n.push(L([t], s))), s.stroke !== H && n.push(a), this._d("polygon", n, s);
|
|
1275
1201
|
}
|
|
1276
1202
|
path(t, e) {
|
|
1277
1203
|
const s = this._o(e),
|
|
1278
1204
|
n = [];
|
|
1279
1205
|
if (!t) return this._d("path", n, s);
|
|
1280
1206
|
t = (t || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " ");
|
|
1281
|
-
const
|
|
1282
|
-
|
|
1207
|
+
const a = s.fill && "transparent" !== s.fill && s.fill !== H,
|
|
1208
|
+
o = s.stroke !== H,
|
|
1283
1209
|
h = !!(s.simplification && s.simplification < 1),
|
|
1284
1210
|
r = function (t, e, s) {
|
|
1285
|
-
const n =
|
|
1286
|
-
|
|
1287
|
-
let
|
|
1211
|
+
const n = g(d(f(t))),
|
|
1212
|
+
a = [];
|
|
1213
|
+
let o = [],
|
|
1288
1214
|
h = [0, 0],
|
|
1289
1215
|
r = [];
|
|
1290
1216
|
const i = () => {
|
|
1291
|
-
r.length >= 4 &&
|
|
1217
|
+
r.length >= 4 && o.push(...Q(r, e)), r = [];
|
|
1292
1218
|
},
|
|
1293
1219
|
c = () => {
|
|
1294
|
-
i(),
|
|
1220
|
+
i(), o.length && (a.push(o), o = []);
|
|
1295
1221
|
};
|
|
1296
1222
|
for (const {
|
|
1297
1223
|
key: t,
|
|
1298
1224
|
data: e
|
|
1299
1225
|
} of n) switch (t) {
|
|
1300
1226
|
case "M":
|
|
1301
|
-
c(), h = [e[0], e[1]],
|
|
1227
|
+
c(), h = [e[0], e[1]], o.push(h);
|
|
1302
1228
|
break;
|
|
1303
1229
|
case "L":
|
|
1304
|
-
i(),
|
|
1230
|
+
i(), o.push([e[0], e[1]]);
|
|
1305
1231
|
break;
|
|
1306
1232
|
case "C":
|
|
1307
1233
|
if (!r.length) {
|
|
1308
|
-
const t =
|
|
1234
|
+
const t = o.length ? o[o.length - 1] : h;
|
|
1309
1235
|
r.push([t[0], t[1]]);
|
|
1310
1236
|
}
|
|
1311
1237
|
r.push([e[0], e[1]]), r.push([e[2], e[3]]), r.push([e[4], e[5]]);
|
|
1312
1238
|
break;
|
|
1313
1239
|
case "Z":
|
|
1314
|
-
i(),
|
|
1240
|
+
i(), o.push([h[0], h[1]]);
|
|
1315
1241
|
}
|
|
1316
|
-
if (c(), !s) return
|
|
1242
|
+
if (c(), !s) return a;
|
|
1317
1243
|
const l = [];
|
|
1318
|
-
for (const t of
|
|
1319
|
-
const e =
|
|
1244
|
+
for (const t of a) {
|
|
1245
|
+
const e = V(t, s);
|
|
1320
1246
|
e.length && l.push(e);
|
|
1321
1247
|
}
|
|
1322
1248
|
return l;
|
|
1323
|
-
}(t, 1, h ? 4 - 4 *
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1249
|
+
}(t, 1, h ? 4 - 4 * s.simplification : (1 + s.roughness) / 2);
|
|
1250
|
+
return a && ("solid" === s.fillStyle ? n.push(S(r, s)) : n.push(L(r, s))), o && (h ? r.forEach(t => {
|
|
1251
|
+
n.push(m$2(t, !1, s));
|
|
1252
|
+
}) : n.push(function (t, e) {
|
|
1253
|
+
const s = g(d(f(t))),
|
|
1254
|
+
n = [];
|
|
1255
|
+
let a = [0, 0],
|
|
1256
|
+
o = [0, 0];
|
|
1257
|
+
for (const {
|
|
1258
|
+
key: t,
|
|
1259
|
+
data: h
|
|
1260
|
+
} of s) switch (t) {
|
|
1261
|
+
case "M":
|
|
1262
|
+
{
|
|
1263
|
+
const t = 1 * (e.maxRandomnessOffset || 0),
|
|
1264
|
+
s = e.preserveVertices;
|
|
1265
|
+
n.push({
|
|
1266
|
+
op: "move",
|
|
1267
|
+
data: h.map(n => n + (s ? 0 : A(t, e)))
|
|
1268
|
+
}), o = [h[0], h[1]], a = [h[0], h[1]];
|
|
1269
|
+
break;
|
|
1270
|
+
}
|
|
1271
|
+
case "L":
|
|
1272
|
+
n.push(...I(o[0], o[1], h[0], h[1], e)), o = [h[0], h[1]];
|
|
1273
|
+
break;
|
|
1274
|
+
case "C":
|
|
1275
|
+
{
|
|
1276
|
+
const [t, s, a, r, i, c] = h;
|
|
1277
|
+
n.push(...$(t, s, a, r, i, c, o, e)), o = [i, c];
|
|
1278
|
+
break;
|
|
1279
|
+
}
|
|
1280
|
+
case "Z":
|
|
1281
|
+
n.push(...I(o[0], o[1], a[0], a[1], e)), o = [a[0], a[1]];
|
|
1282
|
+
}
|
|
1283
|
+
return {
|
|
1284
|
+
type: "path",
|
|
1285
|
+
ops: n
|
|
1286
|
+
};
|
|
1287
|
+
}(t, s))), this._d("path", n, s);
|
|
1340
1288
|
}
|
|
1341
1289
|
opsToPath(t, e) {
|
|
1342
1290
|
let s = "";
|
|
@@ -1367,15 +1315,15 @@ class et {
|
|
|
1367
1315
|
d: this.opsToPath(t),
|
|
1368
1316
|
stroke: s.stroke,
|
|
1369
1317
|
strokeWidth: s.strokeWidth,
|
|
1370
|
-
fill:
|
|
1318
|
+
fill: H
|
|
1371
1319
|
};
|
|
1372
1320
|
break;
|
|
1373
1321
|
case "fillPath":
|
|
1374
1322
|
e = {
|
|
1375
1323
|
d: this.opsToPath(t),
|
|
1376
|
-
stroke:
|
|
1324
|
+
stroke: H,
|
|
1377
1325
|
strokeWidth: 0,
|
|
1378
|
-
fill: s.fill ||
|
|
1326
|
+
fill: s.fill || H
|
|
1379
1327
|
};
|
|
1380
1328
|
break;
|
|
1381
1329
|
case "fillSketch":
|
|
@@ -1389,37 +1337,34 @@ class et {
|
|
|
1389
1337
|
let s = e.fillWeight;
|
|
1390
1338
|
return s < 0 && (s = e.strokeWidth / 2), {
|
|
1391
1339
|
d: this.opsToPath(t),
|
|
1392
|
-
stroke: e.fill ||
|
|
1340
|
+
stroke: e.fill || H,
|
|
1393
1341
|
strokeWidth: s,
|
|
1394
|
-
fill:
|
|
1342
|
+
fill: H
|
|
1395
1343
|
};
|
|
1396
1344
|
}
|
|
1397
|
-
_mergedShape(t) {
|
|
1398
|
-
return t.filter((t, e) => 0 === e || "move" !== t.op);
|
|
1399
|
-
}
|
|
1400
1345
|
}
|
|
1401
|
-
class
|
|
1346
|
+
class B {
|
|
1402
1347
|
constructor(t, e) {
|
|
1403
|
-
this.canvas = t, this.ctx = this.canvas.getContext("2d"), this.gen = new
|
|
1348
|
+
this.canvas = t, this.ctx = this.canvas.getContext("2d"), this.gen = new N(e);
|
|
1404
1349
|
}
|
|
1405
1350
|
draw(t) {
|
|
1406
1351
|
const e = t.sets || [],
|
|
1407
1352
|
s = t.options || this.getDefaultOptions(),
|
|
1408
1353
|
n = this.ctx,
|
|
1409
|
-
|
|
1410
|
-
for (const
|
|
1354
|
+
a = t.options.fixedDecimalPlaceDigits;
|
|
1355
|
+
for (const o of e) switch (o.type) {
|
|
1411
1356
|
case "path":
|
|
1412
|
-
n.save(), n.strokeStyle = "none" === s.stroke ? "transparent" : s.stroke, n.lineWidth = s.strokeWidth, s.strokeLineDash && n.setLineDash(s.strokeLineDash), s.strokeLineDashOffset && (n.lineDashOffset = s.strokeLineDashOffset), this._drawToContext(n,
|
|
1357
|
+
n.save(), n.strokeStyle = "none" === s.stroke ? "transparent" : s.stroke, n.lineWidth = s.strokeWidth, s.strokeLineDash && n.setLineDash(s.strokeLineDash), s.strokeLineDashOffset && (n.lineDashOffset = s.strokeLineDashOffset), this._drawToContext(n, o, a), n.restore();
|
|
1413
1358
|
break;
|
|
1414
1359
|
case "fillPath":
|
|
1415
1360
|
{
|
|
1416
1361
|
n.save(), n.fillStyle = s.fill || "";
|
|
1417
1362
|
const e = "curve" === t.shape || "polygon" === t.shape || "path" === t.shape ? "evenodd" : "nonzero";
|
|
1418
|
-
this._drawToContext(n,
|
|
1363
|
+
this._drawToContext(n, o, a, e), n.restore();
|
|
1419
1364
|
break;
|
|
1420
1365
|
}
|
|
1421
1366
|
case "fillSketch":
|
|
1422
|
-
this.fillSketch(n,
|
|
1367
|
+
this.fillSketch(n, o, s);
|
|
1423
1368
|
}
|
|
1424
1369
|
}
|
|
1425
1370
|
fillSketch(t, e, s) {
|
|
@@ -1450,21 +1395,21 @@ class st {
|
|
|
1450
1395
|
getDefaultOptions() {
|
|
1451
1396
|
return this.gen.defaultOptions;
|
|
1452
1397
|
}
|
|
1453
|
-
line(t, e, s, n,
|
|
1454
|
-
const
|
|
1455
|
-
return this.draw(
|
|
1398
|
+
line(t, e, s, n, a) {
|
|
1399
|
+
const o = this.gen.line(t, e, s, n, a);
|
|
1400
|
+
return this.draw(o), o;
|
|
1456
1401
|
}
|
|
1457
|
-
rectangle(t, e, s, n,
|
|
1458
|
-
const
|
|
1459
|
-
return this.draw(
|
|
1402
|
+
rectangle(t, e, s, n, a) {
|
|
1403
|
+
const o = this.gen.rectangle(t, e, s, n, a);
|
|
1404
|
+
return this.draw(o), o;
|
|
1460
1405
|
}
|
|
1461
|
-
ellipse(t, e, s, n,
|
|
1462
|
-
const
|
|
1463
|
-
return this.draw(
|
|
1406
|
+
ellipse(t, e, s, n, a) {
|
|
1407
|
+
const o = this.gen.ellipse(t, e, s, n, a);
|
|
1408
|
+
return this.draw(o), o;
|
|
1464
1409
|
}
|
|
1465
1410
|
circle(t, e, s, n) {
|
|
1466
|
-
const
|
|
1467
|
-
return this.draw(
|
|
1411
|
+
const a = this.gen.circle(t, e, s, n);
|
|
1412
|
+
return this.draw(a), a;
|
|
1468
1413
|
}
|
|
1469
1414
|
linearPath(t, e) {
|
|
1470
1415
|
const s = this.gen.linearPath(t, e);
|
|
@@ -1474,10 +1419,10 @@ class st {
|
|
|
1474
1419
|
const s = this.gen.polygon(t, e);
|
|
1475
1420
|
return this.draw(s), s;
|
|
1476
1421
|
}
|
|
1477
|
-
arc(t, e, s, n,
|
|
1422
|
+
arc(t, e, s, n, a, o) {
|
|
1478
1423
|
let h = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
|
|
1479
1424
|
let r = arguments.length > 7 ? arguments[7] : undefined;
|
|
1480
|
-
const i = this.gen.arc(t, e, s, n,
|
|
1425
|
+
const i = this.gen.arc(t, e, s, n, a, o, h, r);
|
|
1481
1426
|
return this.draw(i), i;
|
|
1482
1427
|
}
|
|
1483
1428
|
curve(t, e) {
|
|
@@ -1489,38 +1434,38 @@ class st {
|
|
|
1489
1434
|
return this.draw(s), s;
|
|
1490
1435
|
}
|
|
1491
1436
|
}
|
|
1492
|
-
const
|
|
1493
|
-
class
|
|
1437
|
+
const J = "http://www.w3.org/2000/svg";
|
|
1438
|
+
class K {
|
|
1494
1439
|
constructor(t, e) {
|
|
1495
|
-
this.svg = t, this.gen = new
|
|
1440
|
+
this.svg = t, this.gen = new N(e);
|
|
1496
1441
|
}
|
|
1497
1442
|
draw(t) {
|
|
1498
1443
|
const e = t.sets || [],
|
|
1499
1444
|
s = t.options || this.getDefaultOptions(),
|
|
1500
1445
|
n = this.svg.ownerDocument || window.document,
|
|
1501
|
-
|
|
1502
|
-
|
|
1446
|
+
a = n.createElementNS(J, "g"),
|
|
1447
|
+
o = t.options.fixedDecimalPlaceDigits;
|
|
1503
1448
|
for (const h of e) {
|
|
1504
1449
|
let e = null;
|
|
1505
1450
|
switch (h.type) {
|
|
1506
1451
|
case "path":
|
|
1507
|
-
e = n.createElementNS(
|
|
1452
|
+
e = n.createElementNS(J, "path"), e.setAttribute("d", this.opsToPath(h, o)), e.setAttribute("stroke", s.stroke), e.setAttribute("stroke-width", s.strokeWidth + ""), e.setAttribute("fill", "none"), s.strokeLineDash && e.setAttribute("stroke-dasharray", s.strokeLineDash.join(" ").trim()), s.strokeLineDashOffset && e.setAttribute("stroke-dashoffset", `${s.strokeLineDashOffset}`);
|
|
1508
1453
|
break;
|
|
1509
1454
|
case "fillPath":
|
|
1510
|
-
e = n.createElementNS(
|
|
1455
|
+
e = n.createElementNS(J, "path"), e.setAttribute("d", this.opsToPath(h, o)), e.setAttribute("stroke", "none"), e.setAttribute("stroke-width", "0"), e.setAttribute("fill", s.fill || ""), "curve" !== t.shape && "polygon" !== t.shape || e.setAttribute("fill-rule", "evenodd");
|
|
1511
1456
|
break;
|
|
1512
1457
|
case "fillSketch":
|
|
1513
1458
|
e = this.fillSketch(n, h, s);
|
|
1514
1459
|
}
|
|
1515
|
-
e &&
|
|
1460
|
+
e && a.appendChild(e);
|
|
1516
1461
|
}
|
|
1517
|
-
return
|
|
1462
|
+
return a;
|
|
1518
1463
|
}
|
|
1519
1464
|
fillSketch(t, e, s) {
|
|
1520
1465
|
let n = s.fillWeight;
|
|
1521
1466
|
n < 0 && (n = s.strokeWidth / 2);
|
|
1522
|
-
const
|
|
1523
|
-
return
|
|
1467
|
+
const a = t.createElementNS(J, "path");
|
|
1468
|
+
return a.setAttribute("d", this.opsToPath(e, s.fixedDecimalPlaceDigits)), a.setAttribute("stroke", s.fill || ""), a.setAttribute("stroke-width", n + ""), a.setAttribute("fill", "none"), s.fillLineDash && a.setAttribute("stroke-dasharray", s.fillLineDash.join(" ").trim()), s.fillLineDashOffset && a.setAttribute("stroke-dashoffset", `${s.fillLineDashOffset}`), a;
|
|
1524
1469
|
}
|
|
1525
1470
|
get generator() {
|
|
1526
1471
|
return this.gen;
|
|
@@ -1531,21 +1476,21 @@ class ot {
|
|
|
1531
1476
|
opsToPath(t, e) {
|
|
1532
1477
|
return this.gen.opsToPath(t, e);
|
|
1533
1478
|
}
|
|
1534
|
-
line(t, e, s, n,
|
|
1535
|
-
const
|
|
1536
|
-
return this.draw(
|
|
1479
|
+
line(t, e, s, n, a) {
|
|
1480
|
+
const o = this.gen.line(t, e, s, n, a);
|
|
1481
|
+
return this.draw(o);
|
|
1537
1482
|
}
|
|
1538
|
-
rectangle(t, e, s, n,
|
|
1539
|
-
const
|
|
1540
|
-
return this.draw(
|
|
1483
|
+
rectangle(t, e, s, n, a) {
|
|
1484
|
+
const o = this.gen.rectangle(t, e, s, n, a);
|
|
1485
|
+
return this.draw(o);
|
|
1541
1486
|
}
|
|
1542
|
-
ellipse(t, e, s, n,
|
|
1543
|
-
const
|
|
1544
|
-
return this.draw(
|
|
1487
|
+
ellipse(t, e, s, n, a) {
|
|
1488
|
+
const o = this.gen.ellipse(t, e, s, n, a);
|
|
1489
|
+
return this.draw(o);
|
|
1545
1490
|
}
|
|
1546
1491
|
circle(t, e, s, n) {
|
|
1547
|
-
const
|
|
1548
|
-
return this.draw(
|
|
1492
|
+
const a = this.gen.circle(t, e, s, n);
|
|
1493
|
+
return this.draw(a);
|
|
1549
1494
|
}
|
|
1550
1495
|
linearPath(t, e) {
|
|
1551
1496
|
const s = this.gen.linearPath(t, e);
|
|
@@ -1555,10 +1500,10 @@ class ot {
|
|
|
1555
1500
|
const s = this.gen.polygon(t, e);
|
|
1556
1501
|
return this.draw(s);
|
|
1557
1502
|
}
|
|
1558
|
-
arc(t, e, s, n,
|
|
1503
|
+
arc(t, e, s, n, a, o) {
|
|
1559
1504
|
let h = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
|
|
1560
1505
|
let r = arguments.length > 7 ? arguments[7] : undefined;
|
|
1561
|
-
const i = this.gen.arc(t, e, s, n,
|
|
1506
|
+
const i = this.gen.arc(t, e, s, n, a, o, h, r);
|
|
1562
1507
|
return this.draw(i);
|
|
1563
1508
|
}
|
|
1564
1509
|
curve(t, e) {
|
|
@@ -1570,11 +1515,11 @@ class ot {
|
|
|
1570
1515
|
return this.draw(s);
|
|
1571
1516
|
}
|
|
1572
1517
|
}
|
|
1573
|
-
var
|
|
1574
|
-
canvas: (t, e) => new
|
|
1575
|
-
svg: (t, e) => new
|
|
1576
|
-
generator: t => new
|
|
1577
|
-
newSeed: () =>
|
|
1518
|
+
var U = {
|
|
1519
|
+
canvas: (t, e) => new B(t, e),
|
|
1520
|
+
svg: (t, e) => new K(t, e),
|
|
1521
|
+
generator: t => new N(t),
|
|
1522
|
+
newSeed: () => N.newSeed()
|
|
1578
1523
|
};
|
|
1579
1524
|
|
|
1580
1525
|
const defaultRouthThemeSpec = {
|
|
@@ -2024,7 +1969,7 @@ class RoughBaseRender {
|
|
|
2024
1969
|
return;
|
|
2025
1970
|
}
|
|
2026
1971
|
const canvas = context.canvas.nativeCanvas;
|
|
2027
|
-
const rc =
|
|
1972
|
+
const rc = U.canvas(canvas);
|
|
2028
1973
|
const customPath = new CustomPath2D();
|
|
2029
1974
|
const roughContext = new RoughContext2d(context, customPath);
|
|
2030
1975
|
context.save();
|
|
@@ -2095,7 +2040,7 @@ let RoughCanvasArcRender = class RoughCanvasArcRender extends RoughBaseRender {
|
|
|
2095
2040
|
return;
|
|
2096
2041
|
}
|
|
2097
2042
|
const canvas = context.canvas.nativeCanvas;
|
|
2098
|
-
const rc =
|
|
2043
|
+
const rc = U.canvas(canvas);
|
|
2099
2044
|
context.highPerformanceSave();
|
|
2100
2045
|
const arcAttribute = arc.getGraphicTheme();
|
|
2101
2046
|
let { x = arcAttribute.x, y = arcAttribute.y } = arc.attribute;
|
|
@@ -2159,7 +2104,7 @@ let RoughCanvasAreaRender = class RoughCanvasAreaRender extends DefaultCanvasAre
|
|
|
2159
2104
|
}
|
|
2160
2105
|
context.highPerformanceSave();
|
|
2161
2106
|
const canvas = context.canvas.nativeCanvas;
|
|
2162
|
-
const rc =
|
|
2107
|
+
const rc = U.canvas(canvas, {});
|
|
2163
2108
|
const customPath = new CustomPath2D();
|
|
2164
2109
|
drawAreaSegments(customPath, cache, clipRange, {
|
|
2165
2110
|
offsetX,
|
|
@@ -2226,7 +2171,7 @@ let RoughCanvasCircleRender = class RoughCanvasCircleRender extends RoughBaseRen
|
|
|
2226
2171
|
return;
|
|
2227
2172
|
}
|
|
2228
2173
|
const canvas = context.canvas.nativeCanvas;
|
|
2229
|
-
const rc =
|
|
2174
|
+
const rc = U.canvas(canvas, {});
|
|
2230
2175
|
const circleAttribute = circle.getGraphicTheme();
|
|
2231
2176
|
let { x = circleAttribute.x, y = circleAttribute.y } = circle.attribute;
|
|
2232
2177
|
if (!circle.transMatrix.onlyTranslate()) {
|
|
@@ -2285,7 +2230,7 @@ let RoughCanvasPathRender = class RoughCanvasPathRender extends RoughBaseRender
|
|
|
2285
2230
|
return;
|
|
2286
2231
|
}
|
|
2287
2232
|
const canvas = context.canvas.nativeCanvas;
|
|
2288
|
-
const rc =
|
|
2233
|
+
const rc = U.canvas(canvas, {});
|
|
2289
2234
|
context.highPerformanceSave();
|
|
2290
2235
|
const pathAttribute = path.getGraphicTheme();
|
|
2291
2236
|
context.transformFromMatrix(path.transMatrix, true);
|