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