@antv/g-svg 1.8.24 → 1.8.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.esm.js +77 -164
- package/dist/index.js +77 -164
- package/dist/index.umd.js +603 -1142
- package/dist/index.umd.min.js +1 -9
- package/package.json +6 -6
package/dist/index.umd.js
CHANGED
|
@@ -5,20 +5,19 @@
|
|
|
5
5
|
}(this, (function (exports, gLite) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _regeneratorRuntime() {
|
|
8
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
9
|
-
|
|
10
8
|
_regeneratorRuntime = function () {
|
|
11
9
|
return exports;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
var exports = {},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
Op = Object.prototype,
|
|
13
|
+
hasOwn = Op.hasOwnProperty,
|
|
14
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
15
|
+
obj[key] = desc.value;
|
|
16
|
+
},
|
|
17
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
18
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
19
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
20
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
22
21
|
function define(obj, key, value) {
|
|
23
22
|
return Object.defineProperty(obj, key, {
|
|
24
23
|
value: value,
|
|
@@ -27,7 +26,6 @@
|
|
|
27
26
|
writable: !0
|
|
28
27
|
}), obj[key];
|
|
29
28
|
}
|
|
30
|
-
|
|
31
29
|
try {
|
|
32
30
|
define({}, "");
|
|
33
31
|
} catch (err) {
|
|
@@ -35,54 +33,14 @@
|
|
|
35
33
|
return obj[key] = value;
|
|
36
34
|
};
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
40
37
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return generator
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
47
|
-
|
|
48
|
-
if ("completed" === state) {
|
|
49
|
-
if ("throw" === method) throw arg;
|
|
50
|
-
return doneResult();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
for (context.method = method, context.arg = arg;;) {
|
|
54
|
-
var delegate = context.delegate;
|
|
55
|
-
|
|
56
|
-
if (delegate) {
|
|
57
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
58
|
-
|
|
59
|
-
if (delegateResult) {
|
|
60
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
61
|
-
return delegateResult;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
66
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
67
|
-
context.dispatchException(context.arg);
|
|
68
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
69
|
-
state = "executing";
|
|
70
|
-
var record = tryCatch(innerFn, self, context);
|
|
71
|
-
|
|
72
|
-
if ("normal" === record.type) {
|
|
73
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
74
|
-
return {
|
|
75
|
-
value: record.arg,
|
|
76
|
-
done: context.done
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}(innerFn, self, context), generator;
|
|
38
|
+
generator = Object.create(protoGenerator.prototype),
|
|
39
|
+
context = new Context(tryLocsList || []);
|
|
40
|
+
return defineProperty(generator, "_invoke", {
|
|
41
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
42
|
+
}), generator;
|
|
84
43
|
}
|
|
85
|
-
|
|
86
44
|
function tryCatch(fn, obj, arg) {
|
|
87
45
|
try {
|
|
88
46
|
return {
|
|
@@ -96,25 +54,19 @@
|
|
|
96
54
|
};
|
|
97
55
|
}
|
|
98
56
|
}
|
|
99
|
-
|
|
100
57
|
exports.wrap = wrap;
|
|
101
58
|
var ContinueSentinel = {};
|
|
102
|
-
|
|
103
59
|
function Generator() {}
|
|
104
|
-
|
|
105
60
|
function GeneratorFunction() {}
|
|
106
|
-
|
|
107
61
|
function GeneratorFunctionPrototype() {}
|
|
108
|
-
|
|
109
62
|
var IteratorPrototype = {};
|
|
110
63
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
111
64
|
return this;
|
|
112
65
|
});
|
|
113
66
|
var getProto = Object.getPrototypeOf,
|
|
114
|
-
|
|
67
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
115
68
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
116
69
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
117
|
-
|
|
118
70
|
function defineIteratorMethods(prototype) {
|
|
119
71
|
["next", "throw", "return"].forEach(function (method) {
|
|
120
72
|
define(prototype, method, function (arg) {
|
|
@@ -122,14 +74,12 @@
|
|
|
122
74
|
});
|
|
123
75
|
});
|
|
124
76
|
}
|
|
125
|
-
|
|
126
77
|
function AsyncIterator(generator, PromiseImpl) {
|
|
127
78
|
function invoke(method, arg, resolve, reject) {
|
|
128
79
|
var record = tryCatch(generator[method], generator, arg);
|
|
129
|
-
|
|
130
80
|
if ("throw" !== record.type) {
|
|
131
81
|
var result = record.arg,
|
|
132
|
-
|
|
82
|
+
value = result.value;
|
|
133
83
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
134
84
|
invoke("next", value, resolve, reject);
|
|
135
85
|
}, function (err) {
|
|
@@ -140,90 +90,114 @@
|
|
|
140
90
|
return invoke("throw", error, resolve, reject);
|
|
141
91
|
});
|
|
142
92
|
}
|
|
143
|
-
|
|
144
93
|
reject(record.arg);
|
|
145
94
|
}
|
|
146
|
-
|
|
147
95
|
var previousPromise;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
96
|
+
defineProperty(this, "_invoke", {
|
|
97
|
+
value: function (method, arg) {
|
|
98
|
+
function callInvokeWithMethodAndArg() {
|
|
99
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
100
|
+
invoke(method, arg, resolve, reject);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
108
|
+
var state = "suspendedStart";
|
|
109
|
+
return function (method, arg) {
|
|
110
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
111
|
+
if ("completed" === state) {
|
|
112
|
+
if ("throw" === method) throw arg;
|
|
113
|
+
return doneResult();
|
|
114
|
+
}
|
|
115
|
+
for (context.method = method, context.arg = arg;;) {
|
|
116
|
+
var delegate = context.delegate;
|
|
117
|
+
if (delegate) {
|
|
118
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
119
|
+
if (delegateResult) {
|
|
120
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
121
|
+
return delegateResult;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
125
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
126
|
+
context.dispatchException(context.arg);
|
|
127
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
128
|
+
state = "executing";
|
|
129
|
+
var record = tryCatch(innerFn, self, context);
|
|
130
|
+
if ("normal" === record.type) {
|
|
131
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
132
|
+
return {
|
|
133
|
+
value: record.arg,
|
|
134
|
+
done: context.done
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
154
138
|
}
|
|
155
|
-
|
|
156
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
157
139
|
};
|
|
158
140
|
}
|
|
159
|
-
|
|
160
141
|
function maybeInvokeDelegate(delegate, context) {
|
|
161
142
|
var method = delegate.iterator[context.method];
|
|
162
|
-
|
|
163
143
|
if (undefined === method) {
|
|
164
144
|
if (context.delegate = null, "throw" === context.method) {
|
|
165
145
|
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
166
146
|
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
167
147
|
}
|
|
168
|
-
|
|
169
148
|
return ContinueSentinel;
|
|
170
149
|
}
|
|
171
|
-
|
|
172
150
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
173
151
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
174
152
|
var info = record.arg;
|
|
175
153
|
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
176
154
|
}
|
|
177
|
-
|
|
178
155
|
function pushTryEntry(locs) {
|
|
179
156
|
var entry = {
|
|
180
157
|
tryLoc: locs[0]
|
|
181
158
|
};
|
|
182
159
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
183
160
|
}
|
|
184
|
-
|
|
185
161
|
function resetTryEntry(entry) {
|
|
186
162
|
var record = entry.completion || {};
|
|
187
163
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
188
164
|
}
|
|
189
|
-
|
|
190
165
|
function Context(tryLocsList) {
|
|
191
166
|
this.tryEntries = [{
|
|
192
167
|
tryLoc: "root"
|
|
193
168
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
194
169
|
}
|
|
195
|
-
|
|
196
170
|
function values(iterable) {
|
|
197
171
|
if (iterable) {
|
|
198
172
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
199
173
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
200
174
|
if ("function" == typeof iterable.next) return iterable;
|
|
201
|
-
|
|
202
175
|
if (!isNaN(iterable.length)) {
|
|
203
176
|
var i = -1,
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
};
|
|
209
|
-
|
|
177
|
+
next = function next() {
|
|
178
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
179
|
+
return next.value = undefined, next.done = !0, next;
|
|
180
|
+
};
|
|
210
181
|
return next.next = next;
|
|
211
182
|
}
|
|
212
183
|
}
|
|
213
|
-
|
|
214
184
|
return {
|
|
215
185
|
next: doneResult
|
|
216
186
|
};
|
|
217
187
|
}
|
|
218
|
-
|
|
219
188
|
function doneResult() {
|
|
220
189
|
return {
|
|
221
190
|
value: undefined,
|
|
222
191
|
done: !0
|
|
223
192
|
};
|
|
224
193
|
}
|
|
225
|
-
|
|
226
|
-
|
|
194
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
195
|
+
value: GeneratorFunctionPrototype,
|
|
196
|
+
configurable: !0
|
|
197
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
198
|
+
value: GeneratorFunction,
|
|
199
|
+
configurable: !0
|
|
200
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
227
201
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
228
202
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
229
203
|
}, exports.mark = function (genFun) {
|
|
@@ -244,17 +218,15 @@
|
|
|
244
218
|
return this;
|
|
245
219
|
}), define(Gp, "toString", function () {
|
|
246
220
|
return "[object Generator]";
|
|
247
|
-
}), exports.keys = function (
|
|
248
|
-
var
|
|
249
|
-
|
|
221
|
+
}), exports.keys = function (val) {
|
|
222
|
+
var object = Object(val),
|
|
223
|
+
keys = [];
|
|
250
224
|
for (var key in object) keys.push(key);
|
|
251
|
-
|
|
252
225
|
return keys.reverse(), function next() {
|
|
253
226
|
for (; keys.length;) {
|
|
254
227
|
var key = keys.pop();
|
|
255
228
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
256
229
|
}
|
|
257
|
-
|
|
258
230
|
return next.done = !0, next;
|
|
259
231
|
};
|
|
260
232
|
}, exports.values = values, Context.prototype = {
|
|
@@ -271,20 +243,16 @@
|
|
|
271
243
|
dispatchException: function (exception) {
|
|
272
244
|
if (this.done) throw exception;
|
|
273
245
|
var context = this;
|
|
274
|
-
|
|
275
246
|
function handle(loc, caught) {
|
|
276
247
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
277
248
|
}
|
|
278
|
-
|
|
279
249
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
280
250
|
var entry = this.tryEntries[i],
|
|
281
|
-
|
|
251
|
+
record = entry.completion;
|
|
282
252
|
if ("root" === entry.tryLoc) return handle("end");
|
|
283
|
-
|
|
284
253
|
if (entry.tryLoc <= this.prev) {
|
|
285
254
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
286
|
-
|
|
287
|
-
|
|
255
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
288
256
|
if (hasCatch && hasFinally) {
|
|
289
257
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
290
258
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -300,13 +268,11 @@
|
|
|
300
268
|
abrupt: function (type, arg) {
|
|
301
269
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
302
270
|
var entry = this.tryEntries[i];
|
|
303
|
-
|
|
304
271
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
305
272
|
var finallyEntry = entry;
|
|
306
273
|
break;
|
|
307
274
|
}
|
|
308
275
|
}
|
|
309
|
-
|
|
310
276
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
311
277
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
312
278
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -324,19 +290,15 @@
|
|
|
324
290
|
catch: function (tryLoc) {
|
|
325
291
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
326
292
|
var entry = this.tryEntries[i];
|
|
327
|
-
|
|
328
293
|
if (entry.tryLoc === tryLoc) {
|
|
329
294
|
var record = entry.completion;
|
|
330
|
-
|
|
331
295
|
if ("throw" === record.type) {
|
|
332
296
|
var thrown = record.arg;
|
|
333
297
|
resetTryEntry(entry);
|
|
334
298
|
}
|
|
335
|
-
|
|
336
299
|
return thrown;
|
|
337
300
|
}
|
|
338
301
|
}
|
|
339
|
-
|
|
340
302
|
throw new Error("illegal catch attempt");
|
|
341
303
|
},
|
|
342
304
|
delegateYield: function (iterable, resultName, nextLoc) {
|
|
@@ -348,7 +310,6 @@
|
|
|
348
310
|
}
|
|
349
311
|
}, exports;
|
|
350
312
|
}
|
|
351
|
-
|
|
352
313
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
353
314
|
try {
|
|
354
315
|
var info = gen[key](arg);
|
|
@@ -357,41 +318,33 @@
|
|
|
357
318
|
reject(error);
|
|
358
319
|
return;
|
|
359
320
|
}
|
|
360
|
-
|
|
361
321
|
if (info.done) {
|
|
362
322
|
resolve(value);
|
|
363
323
|
} else {
|
|
364
324
|
Promise.resolve(value).then(_next, _throw);
|
|
365
325
|
}
|
|
366
326
|
}
|
|
367
|
-
|
|
368
327
|
function _asyncToGenerator(fn) {
|
|
369
328
|
return function () {
|
|
370
329
|
var self = this,
|
|
371
|
-
|
|
330
|
+
args = arguments;
|
|
372
331
|
return new Promise(function (resolve, reject) {
|
|
373
332
|
var gen = fn.apply(self, args);
|
|
374
|
-
|
|
375
333
|
function _next(value) {
|
|
376
334
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
377
335
|
}
|
|
378
|
-
|
|
379
336
|
function _throw(err) {
|
|
380
337
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
381
338
|
}
|
|
382
|
-
|
|
383
339
|
_next(undefined);
|
|
384
340
|
});
|
|
385
341
|
};
|
|
386
342
|
}
|
|
387
|
-
|
|
388
343
|
function _inheritsLoose(subClass, superClass) {
|
|
389
344
|
subClass.prototype = Object.create(superClass.prototype);
|
|
390
345
|
subClass.prototype.constructor = subClass;
|
|
391
|
-
|
|
392
346
|
_setPrototypeOf(subClass, superClass);
|
|
393
347
|
}
|
|
394
|
-
|
|
395
348
|
function _setPrototypeOf(o, p) {
|
|
396
349
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
397
350
|
o.__proto__ = p;
|
|
@@ -401,19 +354,19 @@
|
|
|
401
354
|
}
|
|
402
355
|
|
|
403
356
|
function _regeneratorRuntime$1() {
|
|
404
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
405
357
|
_regeneratorRuntime$1 = function _regeneratorRuntime() {
|
|
406
358
|
return exports;
|
|
407
359
|
};
|
|
408
|
-
|
|
409
360
|
var exports = {},
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
361
|
+
Op = Object.prototype,
|
|
362
|
+
hasOwn = Op.hasOwnProperty,
|
|
363
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
364
|
+
obj[key] = desc.value;
|
|
365
|
+
},
|
|
366
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
367
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
368
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
369
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
417
370
|
function define(obj, key, value) {
|
|
418
371
|
return Object.defineProperty(obj, key, {
|
|
419
372
|
value: value,
|
|
@@ -422,7 +375,6 @@
|
|
|
422
375
|
writable: !0
|
|
423
376
|
}), obj[key];
|
|
424
377
|
}
|
|
425
|
-
|
|
426
378
|
try {
|
|
427
379
|
define({}, "");
|
|
428
380
|
} catch (err) {
|
|
@@ -430,54 +382,14 @@
|
|
|
430
382
|
return obj[key] = value;
|
|
431
383
|
};
|
|
432
384
|
}
|
|
433
|
-
|
|
434
385
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
435
386
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
return generator
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
442
|
-
|
|
443
|
-
if ("completed" === state) {
|
|
444
|
-
if ("throw" === method) throw arg;
|
|
445
|
-
return doneResult();
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
for (context.method = method, context.arg = arg;;) {
|
|
449
|
-
var delegate = context.delegate;
|
|
450
|
-
|
|
451
|
-
if (delegate) {
|
|
452
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
453
|
-
|
|
454
|
-
if (delegateResult) {
|
|
455
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
456
|
-
return delegateResult;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
461
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
462
|
-
context.dispatchException(context.arg);
|
|
463
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
464
|
-
state = "executing";
|
|
465
|
-
var record = tryCatch(innerFn, self, context);
|
|
466
|
-
|
|
467
|
-
if ("normal" === record.type) {
|
|
468
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
469
|
-
return {
|
|
470
|
-
value: record.arg,
|
|
471
|
-
done: context.done
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
}(innerFn, self, context), generator;
|
|
387
|
+
generator = Object.create(protoGenerator.prototype),
|
|
388
|
+
context = new Context(tryLocsList || []);
|
|
389
|
+
return defineProperty(generator, "_invoke", {
|
|
390
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
391
|
+
}), generator;
|
|
479
392
|
}
|
|
480
|
-
|
|
481
393
|
function tryCatch(fn, obj, arg) {
|
|
482
394
|
try {
|
|
483
395
|
return {
|
|
@@ -491,25 +403,19 @@
|
|
|
491
403
|
};
|
|
492
404
|
}
|
|
493
405
|
}
|
|
494
|
-
|
|
495
406
|
exports.wrap = wrap;
|
|
496
407
|
var ContinueSentinel = {};
|
|
497
|
-
|
|
498
408
|
function Generator() {}
|
|
499
|
-
|
|
500
409
|
function GeneratorFunction() {}
|
|
501
|
-
|
|
502
410
|
function GeneratorFunctionPrototype() {}
|
|
503
|
-
|
|
504
411
|
var IteratorPrototype = {};
|
|
505
412
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
506
413
|
return this;
|
|
507
414
|
});
|
|
508
415
|
var getProto = Object.getPrototypeOf,
|
|
509
|
-
|
|
416
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
510
417
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
511
418
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
512
|
-
|
|
513
419
|
function defineIteratorMethods(prototype) {
|
|
514
420
|
["next", "throw", "return"].forEach(function (method) {
|
|
515
421
|
define(prototype, method, function (arg) {
|
|
@@ -517,14 +423,12 @@
|
|
|
517
423
|
});
|
|
518
424
|
});
|
|
519
425
|
}
|
|
520
|
-
|
|
521
426
|
function AsyncIterator(generator, PromiseImpl) {
|
|
522
427
|
function invoke(method, arg, resolve, reject) {
|
|
523
428
|
var record = tryCatch(generator[method], generator, arg);
|
|
524
|
-
|
|
525
429
|
if ("throw" !== record.type) {
|
|
526
430
|
var result = record.arg,
|
|
527
|
-
|
|
431
|
+
value = result.value;
|
|
528
432
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
529
433
|
invoke("next", value, resolve, reject);
|
|
530
434
|
}, function (err) {
|
|
@@ -535,92 +439,116 @@
|
|
|
535
439
|
return invoke("throw", error, resolve, reject);
|
|
536
440
|
});
|
|
537
441
|
}
|
|
538
|
-
|
|
539
442
|
reject(record.arg);
|
|
540
443
|
}
|
|
541
|
-
|
|
542
444
|
var previousPromise;
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
445
|
+
defineProperty(this, "_invoke", {
|
|
446
|
+
value: function value(method, arg) {
|
|
447
|
+
function callInvokeWithMethodAndArg() {
|
|
448
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
449
|
+
invoke(method, arg, resolve, reject);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
457
|
+
var state = "suspendedStart";
|
|
458
|
+
return function (method, arg) {
|
|
459
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
460
|
+
if ("completed" === state) {
|
|
461
|
+
if ("throw" === method) throw arg;
|
|
462
|
+
return doneResult();
|
|
463
|
+
}
|
|
464
|
+
for (context.method = method, context.arg = arg;;) {
|
|
465
|
+
var delegate = context.delegate;
|
|
466
|
+
if (delegate) {
|
|
467
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
468
|
+
if (delegateResult) {
|
|
469
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
470
|
+
return delegateResult;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
474
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
475
|
+
context.dispatchException(context.arg);
|
|
476
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
477
|
+
state = "executing";
|
|
478
|
+
var record = tryCatch(innerFn, self, context);
|
|
479
|
+
if ("normal" === record.type) {
|
|
480
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
481
|
+
return {
|
|
482
|
+
value: record.arg,
|
|
483
|
+
done: context.done
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
549
487
|
}
|
|
550
|
-
|
|
551
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
552
488
|
};
|
|
553
489
|
}
|
|
554
|
-
|
|
555
490
|
function maybeInvokeDelegate(delegate, context) {
|
|
556
491
|
var method = delegate.iterator[context.method];
|
|
557
|
-
|
|
558
492
|
if (undefined === method) {
|
|
559
493
|
if (context.delegate = null, "throw" === context.method) {
|
|
560
494
|
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
561
495
|
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
562
496
|
}
|
|
563
|
-
|
|
564
497
|
return ContinueSentinel;
|
|
565
498
|
}
|
|
566
|
-
|
|
567
499
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
568
500
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
569
501
|
var info = record.arg;
|
|
570
502
|
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
571
503
|
}
|
|
572
|
-
|
|
573
504
|
function pushTryEntry(locs) {
|
|
574
505
|
var entry = {
|
|
575
506
|
tryLoc: locs[0]
|
|
576
507
|
};
|
|
577
508
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
578
509
|
}
|
|
579
|
-
|
|
580
510
|
function resetTryEntry(entry) {
|
|
581
511
|
var record = entry.completion || {};
|
|
582
512
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
583
513
|
}
|
|
584
|
-
|
|
585
514
|
function Context(tryLocsList) {
|
|
586
515
|
this.tryEntries = [{
|
|
587
516
|
tryLoc: "root"
|
|
588
517
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
589
518
|
}
|
|
590
|
-
|
|
591
519
|
function values(iterable) {
|
|
592
520
|
if (iterable) {
|
|
593
521
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
594
522
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
595
523
|
if ("function" == typeof iterable.next) return iterable;
|
|
596
|
-
|
|
597
524
|
if (!isNaN(iterable.length)) {
|
|
598
525
|
var i = -1,
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
};
|
|
606
|
-
|
|
526
|
+
next = function next() {
|
|
527
|
+
for (; ++i < iterable.length;) {
|
|
528
|
+
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
529
|
+
}
|
|
530
|
+
return next.value = undefined, next.done = !0, next;
|
|
531
|
+
};
|
|
607
532
|
return next.next = next;
|
|
608
533
|
}
|
|
609
534
|
}
|
|
610
|
-
|
|
611
535
|
return {
|
|
612
536
|
next: doneResult
|
|
613
537
|
};
|
|
614
538
|
}
|
|
615
|
-
|
|
616
539
|
function doneResult() {
|
|
617
540
|
return {
|
|
618
541
|
value: undefined,
|
|
619
542
|
done: !0
|
|
620
543
|
};
|
|
621
544
|
}
|
|
622
|
-
|
|
623
|
-
|
|
545
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
546
|
+
value: GeneratorFunctionPrototype,
|
|
547
|
+
configurable: !0
|
|
548
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
549
|
+
value: GeneratorFunction,
|
|
550
|
+
configurable: !0
|
|
551
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
624
552
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
625
553
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
626
554
|
}, exports.mark = function (genFun) {
|
|
@@ -641,19 +569,17 @@
|
|
|
641
569
|
return this;
|
|
642
570
|
}), define(Gp, "toString", function () {
|
|
643
571
|
return "[object Generator]";
|
|
644
|
-
}), exports.keys = function (
|
|
645
|
-
var
|
|
646
|
-
|
|
572
|
+
}), exports.keys = function (val) {
|
|
573
|
+
var object = Object(val),
|
|
574
|
+
keys = [];
|
|
647
575
|
for (var key in object) {
|
|
648
576
|
keys.push(key);
|
|
649
577
|
}
|
|
650
|
-
|
|
651
578
|
return keys.reverse(), function next() {
|
|
652
579
|
for (; keys.length;) {
|
|
653
580
|
var key = keys.pop();
|
|
654
581
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
655
582
|
}
|
|
656
|
-
|
|
657
583
|
return next.done = !0, next;
|
|
658
584
|
};
|
|
659
585
|
}, exports.values = values, Context.prototype = {
|
|
@@ -672,20 +598,16 @@
|
|
|
672
598
|
dispatchException: function dispatchException(exception) {
|
|
673
599
|
if (this.done) throw exception;
|
|
674
600
|
var context = this;
|
|
675
|
-
|
|
676
601
|
function handle(loc, caught) {
|
|
677
602
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
678
603
|
}
|
|
679
|
-
|
|
680
604
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
681
605
|
var entry = this.tryEntries[i],
|
|
682
|
-
|
|
606
|
+
record = entry.completion;
|
|
683
607
|
if ("root" === entry.tryLoc) return handle("end");
|
|
684
|
-
|
|
685
608
|
if (entry.tryLoc <= this.prev) {
|
|
686
609
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
687
|
-
|
|
688
|
-
|
|
610
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
689
611
|
if (hasCatch && hasFinally) {
|
|
690
612
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
691
613
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -701,13 +623,11 @@
|
|
|
701
623
|
abrupt: function abrupt(type, arg) {
|
|
702
624
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
703
625
|
var entry = this.tryEntries[i];
|
|
704
|
-
|
|
705
626
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
706
627
|
var finallyEntry = entry;
|
|
707
628
|
break;
|
|
708
629
|
}
|
|
709
630
|
}
|
|
710
|
-
|
|
711
631
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
712
632
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
713
633
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -725,19 +645,15 @@
|
|
|
725
645
|
catch: function _catch(tryLoc) {
|
|
726
646
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
727
647
|
var entry = this.tryEntries[i];
|
|
728
|
-
|
|
729
648
|
if (entry.tryLoc === tryLoc) {
|
|
730
649
|
var record = entry.completion;
|
|
731
|
-
|
|
732
650
|
if ("throw" === record.type) {
|
|
733
651
|
var thrown = record.arg;
|
|
734
652
|
resetTryEntry(entry);
|
|
735
653
|
}
|
|
736
|
-
|
|
737
654
|
return thrown;
|
|
738
655
|
}
|
|
739
656
|
}
|
|
740
|
-
|
|
741
657
|
throw new Error("illegal catch attempt");
|
|
742
658
|
},
|
|
743
659
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -749,7 +665,6 @@
|
|
|
749
665
|
}
|
|
750
666
|
}, exports;
|
|
751
667
|
}
|
|
752
|
-
|
|
753
668
|
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
754
669
|
try {
|
|
755
670
|
var info = gen[key](arg);
|
|
@@ -758,97 +673,78 @@
|
|
|
758
673
|
reject(error);
|
|
759
674
|
return;
|
|
760
675
|
}
|
|
761
|
-
|
|
762
676
|
if (info.done) {
|
|
763
677
|
resolve(value);
|
|
764
678
|
} else {
|
|
765
679
|
Promise.resolve(value).then(_next, _throw);
|
|
766
680
|
}
|
|
767
681
|
}
|
|
768
|
-
|
|
769
682
|
function _asyncToGenerator$1(fn) {
|
|
770
683
|
return function () {
|
|
771
684
|
var self = this,
|
|
772
|
-
|
|
685
|
+
args = arguments;
|
|
773
686
|
return new Promise(function (resolve, reject) {
|
|
774
687
|
var gen = fn.apply(self, args);
|
|
775
|
-
|
|
776
688
|
function _next(value) {
|
|
777
689
|
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
778
690
|
}
|
|
779
|
-
|
|
780
691
|
function _throw(err) {
|
|
781
692
|
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
782
693
|
}
|
|
783
|
-
|
|
784
694
|
_next(undefined);
|
|
785
695
|
});
|
|
786
696
|
};
|
|
787
697
|
}
|
|
788
|
-
|
|
789
698
|
function _inheritsLoose$1(subClass, superClass) {
|
|
790
699
|
subClass.prototype = Object.create(superClass.prototype);
|
|
791
700
|
subClass.prototype.constructor = subClass;
|
|
792
|
-
|
|
793
701
|
_setPrototypeOf$1(subClass, superClass);
|
|
794
702
|
}
|
|
795
|
-
|
|
796
703
|
function _setPrototypeOf$1(o, p) {
|
|
797
704
|
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
798
705
|
o.__proto__ = p;
|
|
799
706
|
return o;
|
|
800
707
|
};
|
|
801
708
|
return _setPrototypeOf$1(o, p);
|
|
802
|
-
}
|
|
709
|
+
}
|
|
803
710
|
|
|
711
|
+
// const MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
|
|
804
712
|
/**
|
|
805
713
|
* listen to mouse/touch/pointer events on DOM wrapper, trigger pointer events
|
|
806
714
|
*/
|
|
807
|
-
|
|
808
|
-
|
|
809
715
|
var DOMInteractionPlugin = /*#__PURE__*/function () {
|
|
810
716
|
function DOMInteractionPlugin() {
|
|
811
717
|
this.context = void 0;
|
|
812
718
|
}
|
|
813
|
-
|
|
814
719
|
var _proto = DOMInteractionPlugin.prototype;
|
|
815
|
-
|
|
816
720
|
_proto.apply = function apply(context) {
|
|
817
721
|
var _this = this;
|
|
818
|
-
|
|
819
722
|
var renderingService = context.renderingService,
|
|
820
|
-
|
|
723
|
+
renderingContext = context.renderingContext;
|
|
821
724
|
this.context = context;
|
|
822
|
-
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
823
|
-
|
|
725
|
+
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
726
|
+
// const SUPPORT_ONLY_TOUCH = canvas.supportsTouchEvents && MOBILE_REGEX.test(navigator.userAgent);
|
|
824
727
|
var onPointerMove = function onPointerMove(ev) {
|
|
825
728
|
renderingService.hooks.pointerMove.call(ev);
|
|
826
729
|
};
|
|
827
|
-
|
|
828
730
|
var onPointerUp = function onPointerUp(ev) {
|
|
829
731
|
renderingService.hooks.pointerUp.call(ev);
|
|
830
732
|
};
|
|
831
|
-
|
|
832
733
|
var onPointerDown = function onPointerDown(ev) {
|
|
833
734
|
renderingService.hooks.pointerDown.call(ev);
|
|
834
735
|
};
|
|
835
|
-
|
|
836
736
|
var onPointerOver = function onPointerOver(ev) {
|
|
837
737
|
renderingService.hooks.pointerOver.call(ev);
|
|
838
738
|
};
|
|
839
|
-
|
|
840
739
|
var onPointerOut = function onPointerOut(ev) {
|
|
841
740
|
renderingService.hooks.pointerOut.call(ev);
|
|
842
741
|
};
|
|
843
|
-
|
|
844
742
|
var onPointerCancel = function onPointerCancel(ev) {
|
|
845
743
|
renderingService.hooks.pointerCancel.call(ev);
|
|
846
744
|
};
|
|
847
|
-
|
|
848
745
|
var onPointerWheel = function onPointerWheel(ev) {
|
|
849
746
|
renderingService.hooks.pointerWheel.call(ev);
|
|
850
747
|
};
|
|
851
|
-
|
|
852
748
|
var addPointerEventListener = function addPointerEventListener($el) {
|
|
853
749
|
globalThis.document.addEventListener('pointermove', onPointerMove, true);
|
|
854
750
|
$el.addEventListener('pointerdown', onPointerDown, true);
|
|
@@ -856,14 +752,12 @@
|
|
|
856
752
|
$el.addEventListener('pointerover', onPointerOver, true);
|
|
857
753
|
globalThis.addEventListener('pointerup', onPointerUp, true);
|
|
858
754
|
};
|
|
859
|
-
|
|
860
755
|
var addTouchEventListener = function addTouchEventListener($el) {
|
|
861
756
|
$el.addEventListener('touchstart', onPointerDown, true);
|
|
862
757
|
$el.addEventListener('touchend', onPointerUp, true);
|
|
863
758
|
$el.addEventListener('touchmove', onPointerMove, true);
|
|
864
759
|
$el.addEventListener('touchcancel', onPointerCancel, true);
|
|
865
760
|
};
|
|
866
|
-
|
|
867
761
|
var addMouseEventListener = function addMouseEventListener($el) {
|
|
868
762
|
globalThis.document.addEventListener('mousemove', onPointerMove, true);
|
|
869
763
|
$el.addEventListener('mousedown', onPointerDown, true);
|
|
@@ -871,7 +765,6 @@
|
|
|
871
765
|
$el.addEventListener('mouseover', onPointerOver, true);
|
|
872
766
|
globalThis.addEventListener('mouseup', onPointerUp, true);
|
|
873
767
|
};
|
|
874
|
-
|
|
875
768
|
var removePointerEventListener = function removePointerEventListener($el) {
|
|
876
769
|
globalThis.document.removeEventListener('pointermove', onPointerMove, true);
|
|
877
770
|
$el.removeEventListener('pointerdown', onPointerDown, true);
|
|
@@ -879,14 +772,12 @@
|
|
|
879
772
|
$el.removeEventListener('pointerover', onPointerOver, true);
|
|
880
773
|
globalThis.removeEventListener('pointerup', onPointerUp, true);
|
|
881
774
|
};
|
|
882
|
-
|
|
883
775
|
var removeTouchEventListener = function removeTouchEventListener($el) {
|
|
884
776
|
$el.removeEventListener('touchstart', onPointerDown, true);
|
|
885
777
|
$el.removeEventListener('touchend', onPointerUp, true);
|
|
886
778
|
$el.removeEventListener('touchmove', onPointerMove, true);
|
|
887
779
|
$el.removeEventListener('touchcancel', onPointerCancel, true);
|
|
888
780
|
};
|
|
889
|
-
|
|
890
781
|
var removeMouseEventListener = function removeMouseEventListener($el) {
|
|
891
782
|
globalThis.document.removeEventListener('mousemove', onPointerMove, true);
|
|
892
783
|
$el.removeEventListener('mousedown', onPointerDown, true);
|
|
@@ -894,7 +785,6 @@
|
|
|
894
785
|
$el.removeEventListener('mouseover', onPointerOver, true);
|
|
895
786
|
globalThis.removeEventListener('mouseup', onPointerUp, true);
|
|
896
787
|
};
|
|
897
|
-
|
|
898
788
|
renderingService.hooks.init.tapPromise(DOMInteractionPlugin.tag, /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
899
789
|
var $el;
|
|
900
790
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
@@ -902,33 +792,28 @@
|
|
|
902
792
|
switch (_context.prev = _context.next) {
|
|
903
793
|
case 0:
|
|
904
794
|
$el = _this.context.contextService.getDomElement(); // @ts-ignore
|
|
905
|
-
|
|
906
795
|
if (globalThis.navigator.msPointerEnabled) {
|
|
907
796
|
// @ts-ignore
|
|
908
|
-
$el.style.msContentZooming = 'none';
|
|
909
|
-
|
|
797
|
+
$el.style.msContentZooming = 'none';
|
|
798
|
+
// @ts-ignore
|
|
910
799
|
$el.style.msTouchAction = 'none';
|
|
911
800
|
} else if (canvas.supportsPointerEvents) {
|
|
912
801
|
$el.style.touchAction = 'none';
|
|
913
802
|
}
|
|
914
|
-
|
|
915
803
|
if (canvas.supportsPointerEvents) {
|
|
916
804
|
addPointerEventListener($el);
|
|
917
805
|
} else {
|
|
918
806
|
addMouseEventListener($el);
|
|
919
807
|
}
|
|
920
|
-
|
|
921
808
|
if (canvas.supportsTouchEvents) {
|
|
922
809
|
addTouchEventListener($el);
|
|
923
|
-
}
|
|
810
|
+
}
|
|
811
|
+
// use passive event listeners
|
|
924
812
|
// @see https://zhuanlan.zhihu.com/p/24555031
|
|
925
|
-
|
|
926
|
-
|
|
927
813
|
$el.addEventListener('wheel', onPointerWheel, {
|
|
928
814
|
passive: true,
|
|
929
815
|
capture: true
|
|
930
816
|
});
|
|
931
|
-
|
|
932
817
|
case 5:
|
|
933
818
|
case "end":
|
|
934
819
|
return _context.stop();
|
|
@@ -937,62 +822,48 @@
|
|
|
937
822
|
}, _callee);
|
|
938
823
|
})));
|
|
939
824
|
renderingService.hooks.destroy.tap(DOMInteractionPlugin.tag, function () {
|
|
940
|
-
var $el = _this.context.contextService.getDomElement();
|
|
941
|
-
|
|
942
|
-
|
|
825
|
+
var $el = _this.context.contextService.getDomElement();
|
|
826
|
+
// @ts-ignore
|
|
943
827
|
if (globalThis.navigator.msPointerEnabled) {
|
|
944
828
|
// @ts-ignore
|
|
945
|
-
$el.style.msContentZooming = '';
|
|
946
|
-
|
|
829
|
+
$el.style.msContentZooming = '';
|
|
830
|
+
// @ts-ignore
|
|
947
831
|
$el.style.msTouchAction = '';
|
|
948
832
|
} else if (canvas.supportsPointerEvents) {
|
|
949
833
|
$el.style.touchAction = '';
|
|
950
834
|
}
|
|
951
|
-
|
|
952
835
|
if (canvas.supportsPointerEvents) {
|
|
953
836
|
removePointerEventListener($el);
|
|
954
837
|
} else {
|
|
955
838
|
removeMouseEventListener($el);
|
|
956
839
|
}
|
|
957
|
-
|
|
958
840
|
if (canvas.supportsTouchEvents) {
|
|
959
841
|
removeTouchEventListener($el);
|
|
960
842
|
}
|
|
961
|
-
|
|
962
843
|
$el.removeEventListener('wheel', onPointerWheel, true);
|
|
963
844
|
});
|
|
964
845
|
};
|
|
965
|
-
|
|
966
846
|
return DOMInteractionPlugin;
|
|
967
847
|
}();
|
|
968
|
-
|
|
969
848
|
DOMInteractionPlugin.tag = 'DOMInteraction';
|
|
970
|
-
|
|
971
849
|
var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
972
850
|
_inheritsLoose$1(Plugin, _AbstractRendererPlug);
|
|
973
|
-
|
|
974
851
|
function Plugin() {
|
|
975
852
|
var _this;
|
|
976
|
-
|
|
977
853
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
978
854
|
args[_key] = arguments[_key];
|
|
979
855
|
}
|
|
980
|
-
|
|
981
856
|
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
982
857
|
_this.name = 'dom-interaction';
|
|
983
858
|
return _this;
|
|
984
859
|
}
|
|
985
|
-
|
|
986
860
|
var _proto = Plugin.prototype;
|
|
987
|
-
|
|
988
861
|
_proto.init = function init() {
|
|
989
862
|
this.addRenderingPlugin(new DOMInteractionPlugin());
|
|
990
863
|
};
|
|
991
|
-
|
|
992
864
|
_proto.destroy = function destroy() {
|
|
993
865
|
this.removeAllRenderingPlugins();
|
|
994
866
|
};
|
|
995
|
-
|
|
996
867
|
return Plugin;
|
|
997
868
|
}(gLite.AbstractRendererPlugin);
|
|
998
869
|
|
|
@@ -1116,9 +987,6 @@
|
|
|
1116
987
|
return out;
|
|
1117
988
|
}
|
|
1118
989
|
|
|
1119
|
-
var toString = {}.toString;
|
|
1120
|
-
var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
|
|
1121
|
-
|
|
1122
990
|
// isFinite,
|
|
1123
991
|
var isNil = function (value) {
|
|
1124
992
|
/**
|
|
@@ -1128,6 +996,9 @@
|
|
|
1128
996
|
return value === null || value === undefined;
|
|
1129
997
|
};
|
|
1130
998
|
|
|
999
|
+
var toString = {}.toString;
|
|
1000
|
+
var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
|
|
1001
|
+
|
|
1131
1002
|
var isString = (function (str) {
|
|
1132
1003
|
return isType(str, 'String');
|
|
1133
1004
|
});
|
|
@@ -1349,19 +1220,19 @@
|
|
|
1349
1220
|
}
|
|
1350
1221
|
|
|
1351
1222
|
function _regeneratorRuntime$2() {
|
|
1352
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
1353
1223
|
_regeneratorRuntime$2 = function _regeneratorRuntime() {
|
|
1354
1224
|
return exports;
|
|
1355
1225
|
};
|
|
1356
|
-
|
|
1357
1226
|
var exports = {},
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1227
|
+
Op = Object.prototype,
|
|
1228
|
+
hasOwn = Op.hasOwnProperty,
|
|
1229
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
1230
|
+
obj[key] = desc.value;
|
|
1231
|
+
},
|
|
1232
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
1233
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
1234
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
1235
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
1365
1236
|
function define(obj, key, value) {
|
|
1366
1237
|
return Object.defineProperty(obj, key, {
|
|
1367
1238
|
value: value,
|
|
@@ -1370,7 +1241,6 @@
|
|
|
1370
1241
|
writable: !0
|
|
1371
1242
|
}), obj[key];
|
|
1372
1243
|
}
|
|
1373
|
-
|
|
1374
1244
|
try {
|
|
1375
1245
|
define({}, "");
|
|
1376
1246
|
} catch (err) {
|
|
@@ -1378,54 +1248,14 @@
|
|
|
1378
1248
|
return obj[key] = value;
|
|
1379
1249
|
};
|
|
1380
1250
|
}
|
|
1381
|
-
|
|
1382
1251
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
1383
1252
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
return generator
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
1390
|
-
|
|
1391
|
-
if ("completed" === state) {
|
|
1392
|
-
if ("throw" === method) throw arg;
|
|
1393
|
-
return doneResult();
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
for (context.method = method, context.arg = arg;;) {
|
|
1397
|
-
var delegate = context.delegate;
|
|
1398
|
-
|
|
1399
|
-
if (delegate) {
|
|
1400
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
1401
|
-
|
|
1402
|
-
if (delegateResult) {
|
|
1403
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
1404
|
-
return delegateResult;
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
1409
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
1410
|
-
context.dispatchException(context.arg);
|
|
1411
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
1412
|
-
state = "executing";
|
|
1413
|
-
var record = tryCatch(innerFn, self, context);
|
|
1414
|
-
|
|
1415
|
-
if ("normal" === record.type) {
|
|
1416
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
1417
|
-
return {
|
|
1418
|
-
value: record.arg,
|
|
1419
|
-
done: context.done
|
|
1420
|
-
};
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
1424
|
-
}
|
|
1425
|
-
};
|
|
1426
|
-
}(innerFn, self, context), generator;
|
|
1253
|
+
generator = Object.create(protoGenerator.prototype),
|
|
1254
|
+
context = new Context(tryLocsList || []);
|
|
1255
|
+
return defineProperty(generator, "_invoke", {
|
|
1256
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
1257
|
+
}), generator;
|
|
1427
1258
|
}
|
|
1428
|
-
|
|
1429
1259
|
function tryCatch(fn, obj, arg) {
|
|
1430
1260
|
try {
|
|
1431
1261
|
return {
|
|
@@ -1439,25 +1269,19 @@
|
|
|
1439
1269
|
};
|
|
1440
1270
|
}
|
|
1441
1271
|
}
|
|
1442
|
-
|
|
1443
1272
|
exports.wrap = wrap;
|
|
1444
1273
|
var ContinueSentinel = {};
|
|
1445
|
-
|
|
1446
1274
|
function Generator() {}
|
|
1447
|
-
|
|
1448
1275
|
function GeneratorFunction() {}
|
|
1449
|
-
|
|
1450
1276
|
function GeneratorFunctionPrototype() {}
|
|
1451
|
-
|
|
1452
1277
|
var IteratorPrototype = {};
|
|
1453
1278
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
1454
1279
|
return this;
|
|
1455
1280
|
});
|
|
1456
1281
|
var getProto = Object.getPrototypeOf,
|
|
1457
|
-
|
|
1282
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1458
1283
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
1459
1284
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1460
|
-
|
|
1461
1285
|
function defineIteratorMethods(prototype) {
|
|
1462
1286
|
["next", "throw", "return"].forEach(function (method) {
|
|
1463
1287
|
define(prototype, method, function (arg) {
|
|
@@ -1465,14 +1289,12 @@
|
|
|
1465
1289
|
});
|
|
1466
1290
|
});
|
|
1467
1291
|
}
|
|
1468
|
-
|
|
1469
1292
|
function AsyncIterator(generator, PromiseImpl) {
|
|
1470
1293
|
function invoke(method, arg, resolve, reject) {
|
|
1471
1294
|
var record = tryCatch(generator[method], generator, arg);
|
|
1472
|
-
|
|
1473
1295
|
if ("throw" !== record.type) {
|
|
1474
1296
|
var result = record.arg,
|
|
1475
|
-
|
|
1297
|
+
value = result.value;
|
|
1476
1298
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
1477
1299
|
invoke("next", value, resolve, reject);
|
|
1478
1300
|
}, function (err) {
|
|
@@ -1483,92 +1305,116 @@
|
|
|
1483
1305
|
return invoke("throw", error, resolve, reject);
|
|
1484
1306
|
});
|
|
1485
1307
|
}
|
|
1486
|
-
|
|
1487
1308
|
reject(record.arg);
|
|
1488
1309
|
}
|
|
1489
|
-
|
|
1490
1310
|
var previousPromise;
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1311
|
+
defineProperty(this, "_invoke", {
|
|
1312
|
+
value: function value(method, arg) {
|
|
1313
|
+
function callInvokeWithMethodAndArg() {
|
|
1314
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
1315
|
+
invoke(method, arg, resolve, reject);
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
1323
|
+
var state = "suspendedStart";
|
|
1324
|
+
return function (method, arg) {
|
|
1325
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
1326
|
+
if ("completed" === state) {
|
|
1327
|
+
if ("throw" === method) throw arg;
|
|
1328
|
+
return doneResult();
|
|
1329
|
+
}
|
|
1330
|
+
for (context.method = method, context.arg = arg;;) {
|
|
1331
|
+
var delegate = context.delegate;
|
|
1332
|
+
if (delegate) {
|
|
1333
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
1334
|
+
if (delegateResult) {
|
|
1335
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
1336
|
+
return delegateResult;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
1340
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
1341
|
+
context.dispatchException(context.arg);
|
|
1342
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
1343
|
+
state = "executing";
|
|
1344
|
+
var record = tryCatch(innerFn, self, context);
|
|
1345
|
+
if ("normal" === record.type) {
|
|
1346
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
1347
|
+
return {
|
|
1348
|
+
value: record.arg,
|
|
1349
|
+
done: context.done
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
1497
1353
|
}
|
|
1498
|
-
|
|
1499
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1500
1354
|
};
|
|
1501
1355
|
}
|
|
1502
|
-
|
|
1503
1356
|
function maybeInvokeDelegate(delegate, context) {
|
|
1504
1357
|
var method = delegate.iterator[context.method];
|
|
1505
|
-
|
|
1506
1358
|
if (undefined === method) {
|
|
1507
1359
|
if (context.delegate = null, "throw" === context.method) {
|
|
1508
1360
|
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
1509
1361
|
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
1510
1362
|
}
|
|
1511
|
-
|
|
1512
1363
|
return ContinueSentinel;
|
|
1513
1364
|
}
|
|
1514
|
-
|
|
1515
1365
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
1516
1366
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
1517
1367
|
var info = record.arg;
|
|
1518
1368
|
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
1519
1369
|
}
|
|
1520
|
-
|
|
1521
1370
|
function pushTryEntry(locs) {
|
|
1522
1371
|
var entry = {
|
|
1523
1372
|
tryLoc: locs[0]
|
|
1524
1373
|
};
|
|
1525
1374
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
1526
1375
|
}
|
|
1527
|
-
|
|
1528
1376
|
function resetTryEntry(entry) {
|
|
1529
1377
|
var record = entry.completion || {};
|
|
1530
1378
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
1531
1379
|
}
|
|
1532
|
-
|
|
1533
1380
|
function Context(tryLocsList) {
|
|
1534
1381
|
this.tryEntries = [{
|
|
1535
1382
|
tryLoc: "root"
|
|
1536
1383
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
1537
1384
|
}
|
|
1538
|
-
|
|
1539
1385
|
function values(iterable) {
|
|
1540
1386
|
if (iterable) {
|
|
1541
1387
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
1542
1388
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
1543
1389
|
if ("function" == typeof iterable.next) return iterable;
|
|
1544
|
-
|
|
1545
1390
|
if (!isNaN(iterable.length)) {
|
|
1546
1391
|
var i = -1,
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
};
|
|
1554
|
-
|
|
1392
|
+
next = function next() {
|
|
1393
|
+
for (; ++i < iterable.length;) {
|
|
1394
|
+
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1395
|
+
}
|
|
1396
|
+
return next.value = undefined, next.done = !0, next;
|
|
1397
|
+
};
|
|
1555
1398
|
return next.next = next;
|
|
1556
1399
|
}
|
|
1557
1400
|
}
|
|
1558
|
-
|
|
1559
1401
|
return {
|
|
1560
1402
|
next: doneResult
|
|
1561
1403
|
};
|
|
1562
1404
|
}
|
|
1563
|
-
|
|
1564
1405
|
function doneResult() {
|
|
1565
1406
|
return {
|
|
1566
1407
|
value: undefined,
|
|
1567
1408
|
done: !0
|
|
1568
1409
|
};
|
|
1569
1410
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1411
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
1412
|
+
value: GeneratorFunctionPrototype,
|
|
1413
|
+
configurable: !0
|
|
1414
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
1415
|
+
value: GeneratorFunction,
|
|
1416
|
+
configurable: !0
|
|
1417
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
1572
1418
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
1573
1419
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
1574
1420
|
}, exports.mark = function (genFun) {
|
|
@@ -1589,19 +1435,17 @@
|
|
|
1589
1435
|
return this;
|
|
1590
1436
|
}), define(Gp, "toString", function () {
|
|
1591
1437
|
return "[object Generator]";
|
|
1592
|
-
}), exports.keys = function (
|
|
1593
|
-
var
|
|
1594
|
-
|
|
1438
|
+
}), exports.keys = function (val) {
|
|
1439
|
+
var object = Object(val),
|
|
1440
|
+
keys = [];
|
|
1595
1441
|
for (var key in object) {
|
|
1596
1442
|
keys.push(key);
|
|
1597
1443
|
}
|
|
1598
|
-
|
|
1599
1444
|
return keys.reverse(), function next() {
|
|
1600
1445
|
for (; keys.length;) {
|
|
1601
1446
|
var key = keys.pop();
|
|
1602
1447
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
1603
1448
|
}
|
|
1604
|
-
|
|
1605
1449
|
return next.done = !0, next;
|
|
1606
1450
|
};
|
|
1607
1451
|
}, exports.values = values, Context.prototype = {
|
|
@@ -1620,20 +1464,16 @@
|
|
|
1620
1464
|
dispatchException: function dispatchException(exception) {
|
|
1621
1465
|
if (this.done) throw exception;
|
|
1622
1466
|
var context = this;
|
|
1623
|
-
|
|
1624
1467
|
function handle(loc, caught) {
|
|
1625
1468
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
1626
1469
|
}
|
|
1627
|
-
|
|
1628
1470
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1629
1471
|
var entry = this.tryEntries[i],
|
|
1630
|
-
|
|
1472
|
+
record = entry.completion;
|
|
1631
1473
|
if ("root" === entry.tryLoc) return handle("end");
|
|
1632
|
-
|
|
1633
1474
|
if (entry.tryLoc <= this.prev) {
|
|
1634
1475
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
1635
|
-
|
|
1636
|
-
|
|
1476
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1637
1477
|
if (hasCatch && hasFinally) {
|
|
1638
1478
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1639
1479
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -1649,13 +1489,11 @@
|
|
|
1649
1489
|
abrupt: function abrupt(type, arg) {
|
|
1650
1490
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1651
1491
|
var entry = this.tryEntries[i];
|
|
1652
|
-
|
|
1653
1492
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1654
1493
|
var finallyEntry = entry;
|
|
1655
1494
|
break;
|
|
1656
1495
|
}
|
|
1657
1496
|
}
|
|
1658
|
-
|
|
1659
1497
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
1660
1498
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1661
1499
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -1673,19 +1511,15 @@
|
|
|
1673
1511
|
catch: function _catch(tryLoc) {
|
|
1674
1512
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1675
1513
|
var entry = this.tryEntries[i];
|
|
1676
|
-
|
|
1677
1514
|
if (entry.tryLoc === tryLoc) {
|
|
1678
1515
|
var record = entry.completion;
|
|
1679
|
-
|
|
1680
1516
|
if ("throw" === record.type) {
|
|
1681
1517
|
var thrown = record.arg;
|
|
1682
1518
|
resetTryEntry(entry);
|
|
1683
1519
|
}
|
|
1684
|
-
|
|
1685
1520
|
return thrown;
|
|
1686
1521
|
}
|
|
1687
1522
|
}
|
|
1688
|
-
|
|
1689
1523
|
throw new Error("illegal catch attempt");
|
|
1690
1524
|
},
|
|
1691
1525
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -1697,7 +1531,6 @@
|
|
|
1697
1531
|
}
|
|
1698
1532
|
}, exports;
|
|
1699
1533
|
}
|
|
1700
|
-
|
|
1701
1534
|
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1702
1535
|
try {
|
|
1703
1536
|
var info = gen[key](arg);
|
|
@@ -1706,58 +1539,47 @@
|
|
|
1706
1539
|
reject(error);
|
|
1707
1540
|
return;
|
|
1708
1541
|
}
|
|
1709
|
-
|
|
1710
1542
|
if (info.done) {
|
|
1711
1543
|
resolve(value);
|
|
1712
1544
|
} else {
|
|
1713
1545
|
Promise.resolve(value).then(_next, _throw);
|
|
1714
1546
|
}
|
|
1715
1547
|
}
|
|
1716
|
-
|
|
1717
1548
|
function _asyncToGenerator$2(fn) {
|
|
1718
1549
|
return function () {
|
|
1719
1550
|
var self = this,
|
|
1720
|
-
|
|
1551
|
+
args = arguments;
|
|
1721
1552
|
return new Promise(function (resolve, reject) {
|
|
1722
1553
|
var gen = fn.apply(self, args);
|
|
1723
|
-
|
|
1724
1554
|
function _next(value) {
|
|
1725
1555
|
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
1726
1556
|
}
|
|
1727
|
-
|
|
1728
1557
|
function _throw(err) {
|
|
1729
1558
|
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1730
1559
|
}
|
|
1731
|
-
|
|
1732
1560
|
_next(undefined);
|
|
1733
1561
|
});
|
|
1734
1562
|
};
|
|
1735
1563
|
}
|
|
1736
|
-
|
|
1737
1564
|
function _extends() {
|
|
1738
1565
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1739
1566
|
for (var i = 1; i < arguments.length; i++) {
|
|
1740
1567
|
var source = arguments[i];
|
|
1741
|
-
|
|
1742
1568
|
for (var key in source) {
|
|
1743
1569
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1744
1570
|
target[key] = source[key];
|
|
1745
1571
|
}
|
|
1746
1572
|
}
|
|
1747
1573
|
}
|
|
1748
|
-
|
|
1749
1574
|
return target;
|
|
1750
1575
|
};
|
|
1751
1576
|
return _extends.apply(this, arguments);
|
|
1752
1577
|
}
|
|
1753
|
-
|
|
1754
1578
|
function _inheritsLoose$2(subClass, superClass) {
|
|
1755
1579
|
subClass.prototype = Object.create(superClass.prototype);
|
|
1756
1580
|
subClass.prototype.constructor = subClass;
|
|
1757
|
-
|
|
1758
1581
|
_setPrototypeOf$2(subClass, superClass);
|
|
1759
1582
|
}
|
|
1760
|
-
|
|
1761
1583
|
function _setPrototypeOf$2(o, p) {
|
|
1762
1584
|
_setPrototypeOf$2 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
1763
1585
|
o.__proto__ = p;
|
|
@@ -1765,78 +1587,77 @@
|
|
|
1765
1587
|
};
|
|
1766
1588
|
return _setPrototypeOf$2(o, p);
|
|
1767
1589
|
}
|
|
1768
|
-
|
|
1769
1590
|
var ElementSVG = function ElementSVG() {
|
|
1770
1591
|
this.$el = void 0;
|
|
1771
1592
|
this.$groupEl = void 0;
|
|
1772
1593
|
this.$hitTestingEl = void 0;
|
|
1773
1594
|
};
|
|
1774
|
-
|
|
1775
1595
|
ElementSVG.tag = 'c-svg-element';
|
|
1776
|
-
|
|
1777
1596
|
function updateImageElementAttribute($el, parsedStyle) {
|
|
1778
1597
|
var _parsedStyle$img = parsedStyle.img,
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1598
|
+
img = _parsedStyle$img === void 0 ? '' : _parsedStyle$img,
|
|
1599
|
+
width = parsedStyle.width,
|
|
1600
|
+
height = parsedStyle.height;
|
|
1782
1601
|
$el.setAttribute('x', '0');
|
|
1783
1602
|
$el.setAttribute('y', '0');
|
|
1784
|
-
|
|
1785
1603
|
if (isString(img)) {
|
|
1786
1604
|
$el.setAttribute('href', img);
|
|
1787
1605
|
} else if (img instanceof Image) {
|
|
1788
1606
|
if (!width) {
|
|
1789
|
-
$el.setAttribute('width', "" + img.width);
|
|
1607
|
+
$el.setAttribute('width', "" + img.width);
|
|
1608
|
+
// TODO: set renderable.boundsDirty
|
|
1790
1609
|
// this.attr('width', img.width);
|
|
1791
1610
|
}
|
|
1792
1611
|
|
|
1793
1612
|
if (!height) {
|
|
1794
|
-
$el.setAttribute('height', "" + img.height);
|
|
1613
|
+
$el.setAttribute('height', "" + img.height);
|
|
1614
|
+
// this.attr('height', img.height);
|
|
1795
1615
|
}
|
|
1796
1616
|
|
|
1797
1617
|
$el.setAttribute('href', img.src);
|
|
1798
|
-
} else if (
|
|
1618
|
+
} else if (
|
|
1619
|
+
// @ts-ignore
|
|
1799
1620
|
img instanceof HTMLElement && isString(img.nodeName) && img.nodeName.toUpperCase() === 'CANVAS') {
|
|
1800
|
-
$el.setAttribute('href', img.toDataURL());
|
|
1621
|
+
$el.setAttribute('href', img.toDataURL());
|
|
1622
|
+
// @ts-ignore
|
|
1801
1623
|
} else if (img instanceof ImageData) {
|
|
1802
|
-
var canvas = document.createElement('canvas');
|
|
1803
|
-
|
|
1804
|
-
canvas.setAttribute('width', "" + img.width);
|
|
1805
|
-
|
|
1624
|
+
var canvas = document.createElement('canvas');
|
|
1625
|
+
// @ts-ignore
|
|
1626
|
+
canvas.setAttribute('width', "" + img.width);
|
|
1627
|
+
// @ts-ignore
|
|
1806
1628
|
canvas.setAttribute('height', "" + img.height);
|
|
1807
1629
|
var context = canvas.getContext('2d');
|
|
1808
|
-
|
|
1809
1630
|
if (context) {
|
|
1810
1631
|
context.putImageData(img, 0, 0);
|
|
1811
|
-
|
|
1812
1632
|
if (!width) {
|
|
1813
1633
|
// @ts-ignore
|
|
1814
|
-
$el.setAttribute('width', "" + img.width);
|
|
1634
|
+
$el.setAttribute('width', "" + img.width);
|
|
1635
|
+
// this.attr('width', img.width);
|
|
1815
1636
|
}
|
|
1816
1637
|
|
|
1817
1638
|
if (!height) {
|
|
1818
1639
|
// @ts-ignore
|
|
1819
|
-
$el.setAttribute('height', "" + img.height);
|
|
1640
|
+
$el.setAttribute('height', "" + img.height);
|
|
1641
|
+
// this.attr('height', img.height);
|
|
1820
1642
|
}
|
|
1821
1643
|
|
|
1822
1644
|
$el.setAttribute('href', canvas.toDataURL());
|
|
1823
1645
|
}
|
|
1824
1646
|
}
|
|
1825
1647
|
}
|
|
1826
|
-
|
|
1827
1648
|
function updateLineElementAttribute($el, parsedStyle) {
|
|
1828
1649
|
var x1 = parsedStyle.x1,
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1650
|
+
y1 = parsedStyle.y1,
|
|
1651
|
+
x2 = parsedStyle.x2,
|
|
1652
|
+
y2 = parsedStyle.y2,
|
|
1653
|
+
_parsedStyle$defX = parsedStyle.defX,
|
|
1654
|
+
defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
|
|
1655
|
+
_parsedStyle$defY = parsedStyle.defY,
|
|
1656
|
+
defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY,
|
|
1657
|
+
markerStart = parsedStyle.markerStart,
|
|
1658
|
+
markerEnd = parsedStyle.markerEnd,
|
|
1659
|
+
markerStartOffset = parsedStyle.markerStartOffset,
|
|
1660
|
+
markerEndOffset = parsedStyle.markerEndOffset;
|
|
1840
1661
|
var startOffsetX = 0;
|
|
1841
1662
|
var startOffsetY = 0;
|
|
1842
1663
|
var endOffsetX = 0;
|
|
@@ -1844,7 +1665,6 @@
|
|
|
1844
1665
|
var rad = 0;
|
|
1845
1666
|
var x;
|
|
1846
1667
|
var y;
|
|
1847
|
-
|
|
1848
1668
|
if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
|
|
1849
1669
|
x = x2 - x1;
|
|
1850
1670
|
y = y2 - y1;
|
|
@@ -1852,32 +1672,29 @@
|
|
|
1852
1672
|
startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
|
|
1853
1673
|
startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
|
|
1854
1674
|
}
|
|
1855
|
-
|
|
1856
1675
|
if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
|
|
1857
1676
|
x = x1 - x2;
|
|
1858
1677
|
y = y1 - y2;
|
|
1859
1678
|
rad = Math.atan2(y, x);
|
|
1860
1679
|
endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
|
|
1861
1680
|
endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
|
|
1681
|
+
}
|
|
1682
|
+
// @see https://github.com/antvis/g/issues/1038
|
|
1865
1683
|
$el.setAttribute('x1', "" + (x1 - defX + startOffsetX));
|
|
1866
1684
|
$el.setAttribute('y1', "" + (y1 - defY + startOffsetY));
|
|
1867
1685
|
$el.setAttribute('x2', "" + (x2 - defX + endOffsetX));
|
|
1868
1686
|
$el.setAttribute('y2', "" + (y2 - defY + endOffsetY));
|
|
1869
1687
|
}
|
|
1870
|
-
|
|
1871
1688
|
function updatePathElementAttribute($el, parsedStyle) {
|
|
1872
1689
|
var path = parsedStyle.path,
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1690
|
+
_parsedStyle$defX = parsedStyle.defX,
|
|
1691
|
+
defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
|
|
1692
|
+
_parsedStyle$defY = parsedStyle.defY,
|
|
1693
|
+
defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY,
|
|
1694
|
+
markerStart = parsedStyle.markerStart,
|
|
1695
|
+
markerEnd = parsedStyle.markerEnd,
|
|
1696
|
+
markerStartOffset = parsedStyle.markerStartOffset,
|
|
1697
|
+
markerEndOffset = parsedStyle.markerEndOffset;
|
|
1881
1698
|
var startOffsetX = 0;
|
|
1882
1699
|
var startOffsetY = 0;
|
|
1883
1700
|
var endOffsetX = 0;
|
|
@@ -1885,46 +1702,39 @@
|
|
|
1885
1702
|
var rad = 0;
|
|
1886
1703
|
var x;
|
|
1887
1704
|
var y;
|
|
1888
|
-
|
|
1889
1705
|
if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
|
|
1890
1706
|
var _markerStart$parentNo = markerStart.parentNode.getStartTangent(),
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1707
|
+
p1 = _markerStart$parentNo[0],
|
|
1708
|
+
p2 = _markerStart$parentNo[1];
|
|
1894
1709
|
x = p1[0] - p2[0];
|
|
1895
1710
|
y = p1[1] - p2[1];
|
|
1896
1711
|
rad = Math.atan2(y, x);
|
|
1897
1712
|
startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
|
|
1898
1713
|
startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
|
|
1899
1714
|
}
|
|
1900
|
-
|
|
1901
1715
|
if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
|
|
1902
1716
|
var _markerEnd$parentNode = markerEnd.parentNode.getEndTangent(),
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1717
|
+
_p = _markerEnd$parentNode[0],
|
|
1718
|
+
_p2 = _markerEnd$parentNode[1];
|
|
1906
1719
|
x = _p[0] - _p2[0];
|
|
1907
1720
|
y = _p[1] - _p2[1];
|
|
1908
1721
|
rad = Math.atan2(y, x);
|
|
1909
1722
|
endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
|
|
1910
1723
|
endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
|
|
1911
1724
|
}
|
|
1912
|
-
|
|
1913
1725
|
$el.setAttribute('d', gLite.translatePathToString(path.absolutePath, defX, defY, startOffsetX, startOffsetY, endOffsetX, endOffsetY));
|
|
1914
1726
|
}
|
|
1915
|
-
|
|
1916
1727
|
function updatePolylineElementAttribute($el, parsedStyle) {
|
|
1917
1728
|
var points = parsedStyle.points.points,
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1729
|
+
_parsedStyle$defX = parsedStyle.defX,
|
|
1730
|
+
defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
|
|
1731
|
+
_parsedStyle$defY = parsedStyle.defY,
|
|
1732
|
+
defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY,
|
|
1733
|
+
markerStart = parsedStyle.markerStart,
|
|
1734
|
+
markerStartOffset = parsedStyle.markerStartOffset,
|
|
1735
|
+
markerEnd = parsedStyle.markerEnd,
|
|
1736
|
+
markerEndOffset = parsedStyle.markerEndOffset;
|
|
1926
1737
|
var length = points.length;
|
|
1927
|
-
|
|
1928
1738
|
if (points && length >= 2) {
|
|
1929
1739
|
var startOffsetX = 0;
|
|
1930
1740
|
var startOffsetY = 0;
|
|
@@ -1933,7 +1743,6 @@
|
|
|
1933
1743
|
var rad = 0;
|
|
1934
1744
|
var x;
|
|
1935
1745
|
var y;
|
|
1936
|
-
|
|
1937
1746
|
if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
|
|
1938
1747
|
x = points[1][0] - points[0][0];
|
|
1939
1748
|
y = points[1][1] - points[0][1];
|
|
@@ -1941,7 +1750,6 @@
|
|
|
1941
1750
|
startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
|
|
1942
1751
|
startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
|
|
1943
1752
|
}
|
|
1944
|
-
|
|
1945
1753
|
if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
|
|
1946
1754
|
x = points[length - 2][0] - points[length - 1][0];
|
|
1947
1755
|
y = points[length - 2][1] - points[length - 1][1];
|
|
@@ -1949,11 +1757,9 @@
|
|
|
1949
1757
|
endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
|
|
1950
1758
|
endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
|
|
1951
1759
|
}
|
|
1952
|
-
|
|
1953
1760
|
$el.setAttribute('points', points.map(function (point, i) {
|
|
1954
1761
|
var offsetX = 0;
|
|
1955
1762
|
var offsetY = 0;
|
|
1956
|
-
|
|
1957
1763
|
if (i === 0) {
|
|
1958
1764
|
offsetX = startOffsetX;
|
|
1959
1765
|
offsetY = startOffsetY;
|
|
@@ -1961,55 +1767,46 @@
|
|
|
1961
1767
|
offsetX = endOffsetX;
|
|
1962
1768
|
offsetY = endOffsetY;
|
|
1963
1769
|
}
|
|
1964
|
-
|
|
1965
1770
|
return point[0] - defX + offsetX + "," + (point[1] - defY + offsetY);
|
|
1966
1771
|
}).join(' '));
|
|
1967
1772
|
}
|
|
1968
1773
|
}
|
|
1969
|
-
|
|
1970
1774
|
function updateRectElementAttribute($el, parsedStyle) {
|
|
1971
1775
|
var radius = parsedStyle.radius,
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1776
|
+
width = parsedStyle.width,
|
|
1777
|
+
height = parsedStyle.height;
|
|
1778
|
+
// CSSKeyword: auto
|
|
1975
1779
|
if (!isFinite(width) || !isFinite(height)) {
|
|
1976
1780
|
return;
|
|
1977
1781
|
}
|
|
1978
|
-
|
|
1979
1782
|
var hasRadius = radius && radius.some(function (r) {
|
|
1980
1783
|
return r !== 0;
|
|
1981
1784
|
});
|
|
1982
1785
|
var d = '';
|
|
1983
|
-
|
|
1984
1786
|
if (!hasRadius) {
|
|
1985
1787
|
d = "M 0,0 l " + width + ",0 l 0," + height + " l" + -width + " 0 z";
|
|
1986
1788
|
} else {
|
|
1987
1789
|
var _radius$map = radius.map(function (r) {
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1790
|
+
return clamp(r, 0, Math.min(Math.abs(width) / 2, Math.abs(height) / 2));
|
|
1791
|
+
}),
|
|
1792
|
+
tlr = _radius$map[0],
|
|
1793
|
+
trr = _radius$map[1],
|
|
1794
|
+
brr = _radius$map[2],
|
|
1795
|
+
blr = _radius$map[3];
|
|
1995
1796
|
var signX = width > 0 ? 1 : -1;
|
|
1996
|
-
var signY = height > 0 ? 1 : -1;
|
|
1997
|
-
|
|
1797
|
+
var signY = height > 0 ? 1 : -1;
|
|
1798
|
+
// sweep-flag @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Paths#arcs
|
|
1998
1799
|
var sweepFlag = signX + signY !== 0 ? 1 : 0;
|
|
1999
1800
|
d = [["M " + signX * tlr + ",0"], ["l " + (width - signX * (tlr + trr)) + ",0"], ["a " + trr + "," + trr + ",0,0," + sweepFlag + "," + signX * trr + "," + signY * trr], ["l 0," + (height - signY * (trr + brr))], ["a " + brr + "," + brr + ",0,0," + sweepFlag + "," + -signX * brr + "," + signY * brr], ["l " + (signX * (brr + blr) - width) + ",0"], ["a " + blr + "," + blr + ",0,0," + sweepFlag + "," + -signX * blr + "," + -signY * blr], ["l 0," + (signY * (blr + tlr) - height)], ["a " + tlr + "," + tlr + ",0,0," + sweepFlag + "," + signX * tlr + "," + -signY * tlr], ['z']].join(' ');
|
|
2000
1801
|
}
|
|
2001
|
-
|
|
2002
1802
|
$el.setAttribute('d', d);
|
|
2003
1803
|
}
|
|
2004
|
-
|
|
2005
1804
|
function createSVGElement(type, doc) {
|
|
2006
1805
|
return (doc || document).createElementNS('http://www.w3.org/2000/svg', type);
|
|
2007
1806
|
}
|
|
2008
|
-
|
|
2009
1807
|
function numberToLongString(x) {
|
|
2010
1808
|
return x.toFixed(6).replace('.000000', '');
|
|
2011
1809
|
}
|
|
2012
|
-
|
|
2013
1810
|
function convertHTML(str) {
|
|
2014
1811
|
var regex = /[&|<|>|"|']/g;
|
|
2015
1812
|
return str.replace(regex, function (match) {
|
|
@@ -2026,7 +1823,6 @@
|
|
|
2026
1823
|
}
|
|
2027
1824
|
});
|
|
2028
1825
|
}
|
|
2029
|
-
|
|
2030
1826
|
var SVG_ATTR_MAP = {
|
|
2031
1827
|
opacity: 'opacity',
|
|
2032
1828
|
fillStyle: 'fill',
|
|
@@ -2108,11 +1904,9 @@
|
|
|
2108
1904
|
*
|
|
2109
1905
|
* eg. g_svg_circle_345
|
|
2110
1906
|
*/
|
|
2111
|
-
|
|
2112
1907
|
var G_SVG_PREFIX = 'g-svg';
|
|
2113
1908
|
var CLIP_PATH_PREFIX = 'clip-path-';
|
|
2114
1909
|
var TEXT_PATH_PREFIX = 'text-path-';
|
|
2115
|
-
|
|
2116
1910
|
var SVGRendererPlugin = /*#__PURE__*/function () {
|
|
2117
1911
|
function SVGRendererPlugin(pluginOptions, defElementManager, context) {
|
|
2118
1912
|
this.pluginOptions = void 0;
|
|
@@ -2130,105 +1924,77 @@
|
|
|
2130
1924
|
/**
|
|
2131
1925
|
* <camera>
|
|
2132
1926
|
*/
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
1927
|
var _proto = SVGRendererPlugin.prototype;
|
|
2136
|
-
|
|
2137
1928
|
_proto.apply = function apply(context) {
|
|
2138
1929
|
var _this = this;
|
|
2139
|
-
|
|
2140
1930
|
var renderingService = context.renderingService,
|
|
2141
|
-
|
|
1931
|
+
renderingContext = context.renderingContext;
|
|
2142
1932
|
this.context = context;
|
|
2143
1933
|
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
2144
1934
|
var document = this.context.config.document;
|
|
2145
|
-
|
|
2146
1935
|
var handleMounted = function handleMounted(e) {
|
|
2147
|
-
var object = e.target;
|
|
2148
|
-
|
|
1936
|
+
var object = e.target;
|
|
1937
|
+
// create SVG DOM Node
|
|
2149
1938
|
_this.createSVGDom(document, object, _this.$camera);
|
|
2150
1939
|
};
|
|
2151
|
-
|
|
2152
1940
|
var handleUnmounted = function handleUnmounted(e) {
|
|
2153
1941
|
var object = e.target;
|
|
2154
|
-
|
|
2155
1942
|
_this.defElementManager.clear(object.entity);
|
|
2156
|
-
|
|
2157
1943
|
_this.clipPathUseMap.delete(object);
|
|
2158
|
-
|
|
2159
1944
|
_this.removeSVGDom(object);
|
|
2160
1945
|
};
|
|
2161
|
-
|
|
2162
1946
|
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
2163
|
-
var object = e.target;
|
|
1947
|
+
var object = e.target;
|
|
1948
|
+
// @see https://github.com/antvis/g/issues/994
|
|
2164
1949
|
// @ts-ignore
|
|
2165
|
-
|
|
2166
1950
|
if (!object.elementSVG) {
|
|
2167
1951
|
return;
|
|
2168
1952
|
}
|
|
2169
|
-
|
|
2170
1953
|
var attrName = e.attrName;
|
|
2171
|
-
|
|
2172
1954
|
var attribtues = _this.dirtyAttributes.get(object);
|
|
2173
|
-
|
|
2174
1955
|
if (!attribtues) {
|
|
2175
1956
|
_this.dirtyAttributes.set(object, []);
|
|
2176
|
-
|
|
2177
1957
|
attribtues = _this.dirtyAttributes.get(object);
|
|
2178
1958
|
}
|
|
2179
|
-
|
|
2180
1959
|
attribtues.push(attrName);
|
|
2181
1960
|
};
|
|
2182
|
-
|
|
2183
1961
|
var handleGeometryBoundsChanged = function handleGeometryBoundsChanged(e) {
|
|
2184
1962
|
var _object$elementSVG;
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
1963
|
+
var object = e.target;
|
|
1964
|
+
// @ts-ignore
|
|
2188
1965
|
var $el = (_object$elementSVG = object.elementSVG) === null || _object$elementSVG === void 0 ? void 0 : _object$elementSVG.$el;
|
|
2189
1966
|
var _object$parsedStyle = object.parsedStyle,
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
1967
|
+
fill = _object$parsedStyle.fill,
|
|
1968
|
+
stroke = _object$parsedStyle.stroke;
|
|
2193
1969
|
if (fill && !(fill instanceof gLite.CSSRGB)) {
|
|
2194
1970
|
_this.defElementManager.createOrUpdateGradientAndPattern(object, $el, fill, 'fill');
|
|
2195
1971
|
}
|
|
2196
|
-
|
|
2197
1972
|
if (stroke && !(stroke instanceof gLite.CSSRGB)) {
|
|
2198
1973
|
_this.defElementManager.createOrUpdateGradientAndPattern(object, $el, stroke, 'stroke');
|
|
2199
1974
|
}
|
|
2200
1975
|
};
|
|
2201
|
-
|
|
2202
1976
|
renderingService.hooks.init.tapPromise(SVGRendererPlugin.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
2203
1977
|
var _this$context$config, background, document, $svg;
|
|
2204
|
-
|
|
2205
1978
|
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
2206
1979
|
while (1) {
|
|
2207
1980
|
switch (_context.prev = _context.next) {
|
|
2208
1981
|
case 0:
|
|
2209
1982
|
_this$context$config = _this.context.config, background = _this$context$config.background, document = _this$context$config.document; // <defs>
|
|
2210
|
-
|
|
2211
1983
|
_this.defElementManager.init();
|
|
2212
|
-
|
|
2213
1984
|
$svg = _this.context.contextService.getContext();
|
|
2214
|
-
|
|
2215
1985
|
if (background) {
|
|
2216
1986
|
$svg.style.background = background;
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
|
|
1987
|
+
}
|
|
1988
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/color-interpolation-filters
|
|
2220
1989
|
$svg.setAttribute('color-interpolation-filters', 'sRGB');
|
|
2221
1990
|
_this.$camera = createSVGElement('g', document);
|
|
2222
1991
|
_this.$camera.id = G_SVG_PREFIX + "-camera";
|
|
2223
|
-
|
|
2224
1992
|
_this.applyTransform(_this.$camera, _this.context.camera.getOrthoMatrix());
|
|
2225
|
-
|
|
2226
1993
|
$svg.appendChild(_this.$camera);
|
|
2227
1994
|
canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
2228
1995
|
canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
2229
1996
|
canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
2230
1997
|
canvas.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleGeometryBoundsChanged);
|
|
2231
|
-
|
|
2232
1998
|
case 13:
|
|
2233
1999
|
case "end":
|
|
2234
2000
|
return _context.stop();
|
|
@@ -2244,25 +2010,23 @@
|
|
|
2244
2010
|
});
|
|
2245
2011
|
renderingService.hooks.render.tap(SVGRendererPlugin.tag, function (object) {
|
|
2246
2012
|
// if (!object.isCulled()) {
|
|
2247
|
-
_this.renderQueue.push(object);
|
|
2248
|
-
|
|
2013
|
+
_this.renderQueue.push(object);
|
|
2014
|
+
// }
|
|
2249
2015
|
});
|
|
2016
|
+
|
|
2250
2017
|
renderingService.hooks.beginFrame.tap(SVGRendererPlugin.tag, function () {
|
|
2251
2018
|
var doc = _this.context.config.document;
|
|
2252
|
-
|
|
2253
2019
|
if (_this.pendingReorderQueue.size) {
|
|
2254
2020
|
_this.pendingReorderQueue.forEach(function (object) {
|
|
2255
2021
|
var _object$elementSVG2;
|
|
2256
|
-
|
|
2257
2022
|
var children = ((object === null || object === void 0 ? void 0 : object.children) || []).slice();
|
|
2258
|
-
var $parentGroupEl =
|
|
2023
|
+
var $parentGroupEl =
|
|
2024
|
+
// @ts-ignore
|
|
2259
2025
|
object === null || object === void 0 ? void 0 : (_object$elementSVG2 = object.elementSVG) === null || _object$elementSVG2 === void 0 ? void 0 : _object$elementSVG2.$groupEl;
|
|
2260
|
-
|
|
2261
2026
|
if ($parentGroupEl) {
|
|
2262
2027
|
_this.reorderChildren(doc || document, $parentGroupEl, children || []);
|
|
2263
2028
|
}
|
|
2264
2029
|
});
|
|
2265
|
-
|
|
2266
2030
|
_this.pendingReorderQueue.clear();
|
|
2267
2031
|
}
|
|
2268
2032
|
});
|
|
@@ -2270,83 +2034,65 @@
|
|
|
2270
2034
|
if (renderingContext.renderReasons.has(gLite.RenderReason.CAMERA_CHANGED)) {
|
|
2271
2035
|
_this.applyTransform(_this.$camera, _this.context.camera.getOrthoMatrix());
|
|
2272
2036
|
}
|
|
2273
|
-
|
|
2274
2037
|
_this.renderQueue.forEach(function (object) {
|
|
2275
|
-
var _object$elementSVG3, _object$elementSVG4;
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2038
|
+
var _object$elementSVG3, _object$elementSVG4;
|
|
2039
|
+
// @ts-ignore
|
|
2040
|
+
var $el = (_object$elementSVG3 = object.elementSVG) === null || _object$elementSVG3 === void 0 ? void 0 : _object$elementSVG3.$el;
|
|
2041
|
+
// @ts-ignore
|
|
2280
2042
|
var $groupEl = (_object$elementSVG4 = object.elementSVG) === null || _object$elementSVG4 === void 0 ? void 0 : _object$elementSVG4.$groupEl;
|
|
2281
|
-
|
|
2282
2043
|
if ($el && $groupEl) {
|
|
2283
2044
|
// apply local RTS transformation to <group> wrapper
|
|
2284
2045
|
// account for anchor
|
|
2285
2046
|
var localTransform = object.getLocalTransform();
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2047
|
+
_this.applyTransform($groupEl, localTransform);
|
|
2048
|
+
// clipped shapes should also be informed
|
|
2290
2049
|
var $useRefs = _this.clipPathUseMap.get(object);
|
|
2291
|
-
|
|
2292
2050
|
if ($useRefs && $useRefs.length) {
|
|
2293
2051
|
$useRefs.forEach(function ($use) {
|
|
2294
2052
|
// <clipPath transform="matrix()"><circle /></clipPath>
|
|
2295
|
-
_this.applyTransform($use, object.getWorldTransform());
|
|
2053
|
+
_this.applyTransform($use, object.getWorldTransform());
|
|
2054
|
+
// const parentInvert = mat4.invert(
|
|
2296
2055
|
// mat4.create(),
|
|
2297
2056
|
// (object as DisplayObject).getWorldTransform(),
|
|
2298
2057
|
// );
|
|
2299
2058
|
// this.applyTransform($clipPath, parentInvert);
|
|
2300
|
-
|
|
2301
2059
|
});
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
|
|
2060
|
+
}
|
|
2061
|
+
// finish rendering, clear dirty flag
|
|
2305
2062
|
object.renderable.dirty = false;
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
|
|
2063
|
+
}
|
|
2064
|
+
// update dirty attributes
|
|
2309
2065
|
var attributes = _this.dirtyAttributes.get(object);
|
|
2310
|
-
|
|
2311
2066
|
if (attributes) {
|
|
2312
2067
|
attributes.forEach(function (attrName) {
|
|
2313
2068
|
if (attrName === 'zIndex') {
|
|
2314
2069
|
var _object$parentNode, _object$parentNode$el;
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2070
|
+
var parent = object.parentNode;
|
|
2071
|
+
// @ts-ignore
|
|
2318
2072
|
var _$groupEl = (_object$parentNode = object.parentNode) === null || _object$parentNode === void 0 ? void 0 : (_object$parentNode$el = _object$parentNode.elementSVG) === null || _object$parentNode$el === void 0 ? void 0 : _object$parentNode$el.$groupEl;
|
|
2319
|
-
|
|
2320
2073
|
var children = ((parent === null || parent === void 0 ? void 0 : parent.children) || []).slice();
|
|
2321
|
-
|
|
2322
2074
|
if (_$groupEl) {
|
|
2323
2075
|
_this.reorderChildren(document, _$groupEl, children);
|
|
2324
2076
|
}
|
|
2325
2077
|
} else if (attrName === 'increasedLineWidthForHitTesting') {
|
|
2326
2078
|
_this.createOrUpdateHitArea(object, $el, $groupEl);
|
|
2327
2079
|
}
|
|
2328
|
-
|
|
2329
2080
|
_this.updateAttribute(object, [attrName]);
|
|
2330
2081
|
});
|
|
2331
|
-
|
|
2332
2082
|
_this.dirtyAttributes.delete(object);
|
|
2333
2083
|
}
|
|
2334
2084
|
});
|
|
2335
|
-
|
|
2336
2085
|
_this.renderQueue = [];
|
|
2337
2086
|
});
|
|
2338
2087
|
};
|
|
2339
|
-
|
|
2340
2088
|
_proto.getId = function getId(object) {
|
|
2341
2089
|
return G_SVG_PREFIX + "-" + object.nodeName + "-" + object.entity;
|
|
2342
2090
|
};
|
|
2343
|
-
|
|
2344
2091
|
_proto.reorderChildren = function reorderChildren(doc, $groupEl, children) {
|
|
2345
2092
|
// need to reorder parent's children
|
|
2346
2093
|
children.sort(function (a, b) {
|
|
2347
2094
|
return a.sortable.renderOrder - b.sortable.renderOrder;
|
|
2348
2095
|
});
|
|
2349
|
-
|
|
2350
2096
|
if (children.length) {
|
|
2351
2097
|
// create empty fragment
|
|
2352
2098
|
var fragment = (doc || document).createDocumentFragment();
|
|
@@ -2354,7 +2100,6 @@
|
|
|
2354
2100
|
if (child.isConnected) {
|
|
2355
2101
|
// @ts-ignore
|
|
2356
2102
|
var $el = child.elementSVG.$groupEl;
|
|
2357
|
-
|
|
2358
2103
|
if ($el) {
|
|
2359
2104
|
fragment.appendChild($el);
|
|
2360
2105
|
}
|
|
@@ -2363,79 +2108,68 @@
|
|
|
2363
2108
|
$groupEl.appendChild(fragment);
|
|
2364
2109
|
}
|
|
2365
2110
|
};
|
|
2366
|
-
|
|
2367
2111
|
_proto.applyTransform = function applyTransform($el, rts) {
|
|
2368
2112
|
// use proper precision avoiding too long string in `transform`
|
|
2369
2113
|
// @see https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Transformations
|
|
2370
2114
|
$el.setAttribute('transform', "matrix(" + numberToLongString(rts[0]) + "," + numberToLongString(rts[1]) + "," + numberToLongString(rts[4]) + "," + numberToLongString(rts[5]) + "," + numberToLongString(rts[12]) + "," + numberToLongString(rts[13]) + ")");
|
|
2371
2115
|
};
|
|
2372
|
-
|
|
2373
2116
|
_proto.applyAttributes = function applyAttributes(object) {
|
|
2374
2117
|
// @ts-ignore
|
|
2375
2118
|
var elementSVG = object.elementSVG;
|
|
2376
2119
|
var $el = elementSVG === null || elementSVG === void 0 ? void 0 : elementSVG.$el;
|
|
2377
2120
|
var $groupEl = elementSVG === null || elementSVG === void 0 ? void 0 : elementSVG.$groupEl;
|
|
2378
|
-
|
|
2379
2121
|
if ($el && $groupEl) {
|
|
2380
2122
|
var nodeName = object.nodeName,
|
|
2381
|
-
|
|
2123
|
+
attributes = object.attributes;
|
|
2382
2124
|
$el.setAttribute('fill', 'none');
|
|
2383
|
-
|
|
2384
2125
|
if (nodeName === gLite.Shape.IMAGE) {
|
|
2385
2126
|
$el.setAttribute('preserveAspectRatio', 'none');
|
|
2386
|
-
}
|
|
2387
|
-
|
|
2388
|
-
|
|
2127
|
+
}
|
|
2128
|
+
// apply attributes
|
|
2389
2129
|
this.updateAttribute(object, Object.keys(attributes));
|
|
2390
2130
|
}
|
|
2391
2131
|
};
|
|
2392
|
-
|
|
2393
2132
|
_proto.updateAttribute = function updateAttribute(object, attributes) {
|
|
2394
2133
|
var _this2 = this;
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2134
|
+
var document = this.context.config.document;
|
|
2135
|
+
// @ts-ignore
|
|
2398
2136
|
var _object$elementSVG5 = object.elementSVG,
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2137
|
+
$el = _object$elementSVG5.$el,
|
|
2138
|
+
$groupEl = _object$elementSVG5.$groupEl,
|
|
2139
|
+
$hitTestingEl = _object$elementSVG5.$hitTestingEl;
|
|
2402
2140
|
var parsedStyle = object.parsedStyle,
|
|
2403
|
-
|
|
2141
|
+
computedStyle = object.computedStyle;
|
|
2404
2142
|
var shouldUpdateElementAttribute = attributes.some(function (name) {
|
|
2405
|
-
return (
|
|
2143
|
+
return (
|
|
2144
|
+
// @ts-ignore
|
|
2406
2145
|
_this2.context.SVGElementLifeCycleContribution.shouldUpdateElementAttribute(object, name)
|
|
2407
2146
|
);
|
|
2408
|
-
});
|
|
2409
|
-
|
|
2147
|
+
});
|
|
2148
|
+
// need re-generate path
|
|
2410
2149
|
if (shouldUpdateElementAttribute && $el) {
|
|
2411
2150
|
[$el, $hitTestingEl].forEach(function ($el) {
|
|
2412
2151
|
if ($el) {
|
|
2413
2152
|
// @ts-ignore
|
|
2414
2153
|
_this2.context.SVGElementLifeCycleContribution.updateElementAttribute(object, $el);
|
|
2415
|
-
|
|
2416
2154
|
if (object.nodeName !== gLite.Shape.TEXT) {
|
|
2417
2155
|
_this2.updateAnchorWithTransform(object);
|
|
2418
2156
|
}
|
|
2419
2157
|
}
|
|
2420
2158
|
});
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2423
|
-
|
|
2159
|
+
}
|
|
2160
|
+
// update common attributes
|
|
2424
2161
|
attributes.forEach(function (name) {
|
|
2425
2162
|
var _FORMAT_VALUE_MAP$nam, _propertyMetadataCach;
|
|
2426
|
-
|
|
2427
2163
|
var usedName = SVG_ATTR_MAP[name];
|
|
2428
2164
|
var computedValue = computedStyle[name];
|
|
2429
2165
|
var computedValueStr = computedValue && computedValue.toString();
|
|
2430
2166
|
var formattedValueStr = ((_FORMAT_VALUE_MAP$nam = FORMAT_VALUE_MAP[name]) === null || _FORMAT_VALUE_MAP$nam === void 0 ? void 0 : _FORMAT_VALUE_MAP$nam[computedValueStr]) || computedValueStr;
|
|
2431
2167
|
var usedValue = parsedStyle[name];
|
|
2432
2168
|
var inherited = !!((_propertyMetadataCach = gLite.propertyMetadataCache[name]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.inh);
|
|
2433
|
-
|
|
2434
2169
|
if (!usedName) {
|
|
2435
2170
|
return;
|
|
2436
|
-
}
|
|
2437
|
-
|
|
2438
|
-
|
|
2171
|
+
}
|
|
2172
|
+
// <foreignObject>
|
|
2439
2173
|
if (object.nodeName === gLite.Shape.HTML) {
|
|
2440
2174
|
if (name === 'lineWidth') {
|
|
2441
2175
|
$el.style['border-width'] = (usedValue || 0) + "px";
|
|
@@ -2443,7 +2177,6 @@
|
|
|
2443
2177
|
$el.style['border-style'] = 'dashed';
|
|
2444
2178
|
}
|
|
2445
2179
|
}
|
|
2446
|
-
|
|
2447
2180
|
if (name === 'fill') {
|
|
2448
2181
|
if (object.nodeName === gLite.Shape.HTML) {
|
|
2449
2182
|
$el.style.background = usedValue.toString();
|
|
@@ -2497,72 +2230,62 @@
|
|
|
2497
2230
|
}
|
|
2498
2231
|
});
|
|
2499
2232
|
};
|
|
2500
|
-
|
|
2501
2233
|
_proto.createSVGDom = function createSVGDom(document, object, root, noWrapWithGroup) {
|
|
2502
2234
|
if (noWrapWithGroup === void 0) {
|
|
2503
2235
|
noWrapWithGroup = false;
|
|
2504
|
-
}
|
|
2236
|
+
}
|
|
2237
|
+
// create svg element
|
|
2505
2238
|
// @ts-ignore
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
object.elementSVG
|
|
2509
|
-
|
|
2510
|
-
var svgElement = object.elementSVG; // use <group> as default, eg. CustomElement
|
|
2239
|
+
object.elementSVG = new ElementSVG();
|
|
2240
|
+
// @ts-ignore
|
|
2241
|
+
var svgElement = object.elementSVG;
|
|
2242
|
+
// use <group> as default, eg. CustomElement
|
|
2511
2243
|
// @ts-ignore
|
|
2512
|
-
|
|
2513
2244
|
var $el = this.context.SVGElementLifeCycleContribution.createElement(object);
|
|
2514
|
-
|
|
2515
2245
|
if ($el) {
|
|
2516
2246
|
var _object$parentNode$el2;
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2247
|
+
var $groupEl;
|
|
2248
|
+
// save $el on parsedStyle, which will be returned in getDomElement()
|
|
2520
2249
|
if (object.nodeName === gLite.Shape.HTML) {
|
|
2521
2250
|
object.parsedStyle.$el = $el;
|
|
2522
2251
|
}
|
|
2523
|
-
|
|
2524
2252
|
if (this.pluginOptions.outputSVGElementId) {
|
|
2525
2253
|
$el.id = this.getId(object);
|
|
2526
2254
|
}
|
|
2527
|
-
|
|
2528
2255
|
if (this.pluginOptions.outputSVGElementName && object.name) {
|
|
2529
2256
|
$el.setAttribute('name', object.name);
|
|
2530
2257
|
}
|
|
2531
|
-
|
|
2532
2258
|
if (($el.hasAttribute('data-wrapgroup') || $el.nodeName !== 'g') && !noWrapWithGroup) {
|
|
2533
2259
|
$groupEl = createSVGElement('g', document);
|
|
2534
2260
|
$groupEl.appendChild($el);
|
|
2535
2261
|
} else {
|
|
2536
2262
|
$groupEl = $el;
|
|
2537
2263
|
}
|
|
2538
|
-
|
|
2539
2264
|
svgElement.$el = $el;
|
|
2540
|
-
svgElement.$groupEl = $groupEl;
|
|
2541
|
-
|
|
2542
|
-
this.applyAttributes(object);
|
|
2543
|
-
|
|
2265
|
+
svgElement.$groupEl = $groupEl;
|
|
2266
|
+
// apply attributes at first time
|
|
2267
|
+
this.applyAttributes(object);
|
|
2268
|
+
// create hitArea if necessary
|
|
2544
2269
|
this.createOrUpdateHitArea(object, $el, $groupEl);
|
|
2545
|
-
var $parentGroupEl =
|
|
2270
|
+
var $parentGroupEl =
|
|
2271
|
+
// @ts-ignore
|
|
2546
2272
|
object.parentNode && ((_object$parentNode$el2 = object.parentNode.elementSVG) === null || _object$parentNode$el2 === void 0 ? void 0 : _object$parentNode$el2.$groupEl) || root;
|
|
2547
|
-
|
|
2548
2273
|
if ($parentGroupEl) {
|
|
2549
|
-
$parentGroupEl.appendChild($groupEl);
|
|
2550
|
-
|
|
2274
|
+
$parentGroupEl.appendChild($groupEl);
|
|
2275
|
+
// need reorder children later
|
|
2551
2276
|
this.pendingReorderQueue.add(object.parentNode);
|
|
2552
2277
|
}
|
|
2553
2278
|
}
|
|
2554
2279
|
};
|
|
2555
|
-
|
|
2556
2280
|
_proto.removeSVGDom = function removeSVGDom(object) {
|
|
2557
|
-
var _object$elementSVG6;
|
|
2558
|
-
|
|
2559
|
-
|
|
2281
|
+
var _object$elementSVG6;
|
|
2282
|
+
// @ts-ignore
|
|
2560
2283
|
var $groupEl = (_object$elementSVG6 = object.elementSVG) === null || _object$elementSVG6 === void 0 ? void 0 : _object$elementSVG6.$groupEl;
|
|
2561
|
-
|
|
2562
2284
|
if ($groupEl && $groupEl.parentNode) {
|
|
2563
|
-
$groupEl.parentNode.removeChild($groupEl);
|
|
2564
|
-
|
|
2565
|
-
this.context.SVGElementLifeCycleContribution.destroyElement(object, $groupEl);
|
|
2285
|
+
$groupEl.parentNode.removeChild($groupEl);
|
|
2286
|
+
// @ts-ignore
|
|
2287
|
+
this.context.SVGElementLifeCycleContribution.destroyElement(object, $groupEl);
|
|
2288
|
+
// object.entity.removeComponent(ElementSVG, true);
|
|
2566
2289
|
}
|
|
2567
2290
|
};
|
|
2568
2291
|
|
|
@@ -2570,30 +2293,27 @@
|
|
|
2570
2293
|
// @ts-ignore
|
|
2571
2294
|
var svgElement = object.elementSVG;
|
|
2572
2295
|
var $hitTestingEl = svgElement.$hitTestingEl;
|
|
2573
|
-
var increasedLineWidthForHitTesting = object.parsedStyle.increasedLineWidthForHitTesting;
|
|
2574
|
-
|
|
2296
|
+
var increasedLineWidthForHitTesting = object.parsedStyle.increasedLineWidthForHitTesting;
|
|
2297
|
+
// account for hitArea
|
|
2575
2298
|
if (increasedLineWidthForHitTesting) {
|
|
2576
2299
|
if (!$hitTestingEl) {
|
|
2577
2300
|
$hitTestingEl = $el.cloneNode();
|
|
2578
|
-
|
|
2579
2301
|
if (this.pluginOptions.outputSVGElementId) {
|
|
2580
2302
|
// use the entity suffix, so that `g-plugin-svg-picker` can extract
|
|
2581
2303
|
$hitTestingEl.id = G_SVG_PREFIX + "-" + object.nodeName + "-hittesting-" + object.entity;
|
|
2582
|
-
}
|
|
2583
|
-
|
|
2584
|
-
|
|
2304
|
+
}
|
|
2305
|
+
// clear attributes like `filter` `font-size`
|
|
2585
2306
|
['filter'].forEach(function (attribute) {
|
|
2586
2307
|
$hitTestingEl.removeAttribute(attribute);
|
|
2587
|
-
});
|
|
2588
|
-
|
|
2308
|
+
});
|
|
2309
|
+
// hitArea should be 'transparent' but not 'none'
|
|
2589
2310
|
var hasFill = $el.getAttribute('fill') !== 'none';
|
|
2590
2311
|
$hitTestingEl.setAttribute('fill', hasFill ? 'transparent' : 'none');
|
|
2591
2312
|
$hitTestingEl.setAttribute('stroke', 'transparent');
|
|
2592
2313
|
$groupEl.appendChild($hitTestingEl);
|
|
2593
2314
|
svgElement.$hitTestingEl = $hitTestingEl;
|
|
2594
|
-
}
|
|
2595
|
-
|
|
2596
|
-
|
|
2315
|
+
}
|
|
2316
|
+
// increase interactive line width
|
|
2597
2317
|
$hitTestingEl.setAttribute('stroke-width', "" + (increasedLineWidthForHitTesting + object.parsedStyle.lineWidth));
|
|
2598
2318
|
} else {
|
|
2599
2319
|
if ($hitTestingEl) {
|
|
@@ -2602,82 +2322,67 @@
|
|
|
2602
2322
|
}
|
|
2603
2323
|
}
|
|
2604
2324
|
};
|
|
2605
|
-
|
|
2606
2325
|
_proto.createOrUpdateInnerHTML = function createOrUpdateInnerHTML(doc, $el, usedValue) {
|
|
2607
2326
|
var $div = (doc || document).createElement('div');
|
|
2608
|
-
|
|
2609
2327
|
if (typeof usedValue === 'string') {
|
|
2610
2328
|
$div.innerHTML = usedValue;
|
|
2611
2329
|
} else {
|
|
2612
2330
|
$div.appendChild(usedValue);
|
|
2613
2331
|
}
|
|
2614
|
-
|
|
2615
2332
|
$el.innerHTML = '';
|
|
2616
2333
|
$el.appendChild($div);
|
|
2617
2334
|
};
|
|
2618
|
-
|
|
2619
2335
|
_proto.createOrUpdateClipOrTextPath = function createOrUpdateClipOrTextPath(document, clipPath, object, isTextPath) {
|
|
2620
2336
|
if (isTextPath === void 0) {
|
|
2621
2337
|
isTextPath = false;
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
|
|
2338
|
+
}
|
|
2339
|
+
// @ts-ignore
|
|
2625
2340
|
var $groupEl = object.elementSVG.$groupEl;
|
|
2626
2341
|
var PREFIX = isTextPath ? TEXT_PATH_PREFIX : CLIP_PATH_PREFIX;
|
|
2627
2342
|
var attributeNameCamel = isTextPath ? 'g' : 'clipPath';
|
|
2628
2343
|
var attributeNameHyphen = isTextPath ? 'text-path' : 'clip-path';
|
|
2629
|
-
|
|
2630
2344
|
if (clipPath) {
|
|
2631
2345
|
var clipPathId = PREFIX + clipPath.entity + '-' + object.entity;
|
|
2632
2346
|
var $def = this.defElementManager.getDefElement();
|
|
2633
2347
|
var existed = $def.querySelector("#" + clipPathId);
|
|
2634
|
-
|
|
2635
2348
|
if (!existed) {
|
|
2636
2349
|
var $clipPath;
|
|
2637
|
-
|
|
2638
2350
|
if (isTextPath) {
|
|
2639
2351
|
// use <path> directly instead of wrapping with <g>
|
|
2640
|
-
this.createSVGDom(document, clipPath, null, true);
|
|
2641
|
-
|
|
2352
|
+
this.createSVGDom(document, clipPath, null, true);
|
|
2353
|
+
// @ts-ignore
|
|
2642
2354
|
$clipPath = clipPath.elementSVG.$el;
|
|
2643
2355
|
} else {
|
|
2644
2356
|
// the clipPath is allowed to be detached from canvas
|
|
2645
2357
|
if (!clipPath.isConnected) {
|
|
2646
2358
|
var $existedClipPath = $def.querySelector("#" + this.getId(clipPath));
|
|
2647
|
-
|
|
2648
2359
|
if (!$existedClipPath) {
|
|
2649
2360
|
this.createSVGDom(document, clipPath, $def, true);
|
|
2650
2361
|
}
|
|
2651
|
-
}
|
|
2652
|
-
|
|
2653
|
-
|
|
2362
|
+
}
|
|
2363
|
+
// create <clipPath> dom node
|
|
2654
2364
|
$clipPath = createSVGElement(attributeNameCamel, document);
|
|
2655
|
-
var $use = createSVGElement('use', document);
|
|
2656
|
-
|
|
2365
|
+
var $use = createSVGElement('use', document);
|
|
2366
|
+
// @ts-ignore
|
|
2657
2367
|
$use.setAttribute('href', "#" + clipPath.elementSVG.$el.id);
|
|
2658
2368
|
$clipPath.appendChild($use);
|
|
2659
2369
|
var $useRefs = this.clipPathUseMap.get(clipPath);
|
|
2660
|
-
|
|
2661
2370
|
if (!$useRefs) {
|
|
2662
2371
|
this.clipPathUseMap.set(clipPath, []);
|
|
2663
2372
|
$useRefs = this.clipPathUseMap.get(clipPath);
|
|
2664
2373
|
}
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2374
|
+
$useRefs.push($use);
|
|
2375
|
+
// <clipPath transform="matrix()"><circle /></clipPath>
|
|
2668
2376
|
this.applyTransform($use, clipPath.getWorldTransform());
|
|
2669
2377
|
var parentInvert = invert(create(), object.getWorldTransform());
|
|
2670
2378
|
this.applyTransform($clipPath, parentInvert);
|
|
2671
2379
|
}
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2380
|
+
$clipPath.id = clipPathId;
|
|
2381
|
+
// append it to <defs>
|
|
2675
2382
|
$def.appendChild($clipPath);
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
|
-
|
|
2383
|
+
}
|
|
2384
|
+
// apply attributes
|
|
2679
2385
|
this.applyAttributes(clipPath);
|
|
2680
|
-
|
|
2681
2386
|
if (!isTextPath) {
|
|
2682
2387
|
// apply clipPath to $group
|
|
2683
2388
|
// @see https://github.com/antvis/g/issues/961
|
|
@@ -2692,32 +2397,26 @@
|
|
|
2692
2397
|
}
|
|
2693
2398
|
/**
|
|
2694
2399
|
* the origin is bounding box's top left corner
|
|
2695
|
-
|
|
2696
|
-
;
|
|
2697
|
-
|
|
2400
|
+
*/;
|
|
2698
2401
|
_proto.updateAnchorWithTransform = function updateAnchorWithTransform(object) {
|
|
2699
2402
|
var _object$elementSVG7, _object$elementSVG8;
|
|
2700
|
-
|
|
2701
2403
|
var bounds = object.getGeometryBounds();
|
|
2702
2404
|
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
2703
2405
|
var height = bounds && bounds.halfExtents[1] * 2 || 0;
|
|
2704
|
-
|
|
2705
2406
|
var _ref2 = object.parsedStyle || {},
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2407
|
+
anchor = _ref2.anchor;
|
|
2408
|
+
// @ts-ignore
|
|
2709
2409
|
[(_object$elementSVG7 = object.elementSVG) === null || _object$elementSVG7 === void 0 ? void 0 : _object$elementSVG7.$el, (_object$elementSVG8 = object.elementSVG) === null || _object$elementSVG8 === void 0 ? void 0 : _object$elementSVG8.$hitTestingEl].forEach(function ($el) {
|
|
2710
2410
|
if ($el) {
|
|
2711
2411
|
var tx = -(anchor[0] * width);
|
|
2712
2412
|
var ty = -(anchor[1] * height);
|
|
2713
|
-
|
|
2714
2413
|
if (tx !== 0 || ty !== 0) {
|
|
2715
2414
|
// apply anchor to element's `transform` property
|
|
2716
|
-
$el.setAttribute('transform',
|
|
2415
|
+
$el.setAttribute('transform',
|
|
2416
|
+
// can't use percent unit like translate(-50%, -50%)
|
|
2717
2417
|
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/transform#translate
|
|
2718
2418
|
"translate(" + tx + "," + ty + ")");
|
|
2719
2419
|
}
|
|
2720
|
-
|
|
2721
2420
|
if (object.nodeName === gLite.Shape.CIRCLE || object.nodeName === gLite.Shape.ELLIPSE) {
|
|
2722
2421
|
$el.setAttribute('cx', "" + width / 2);
|
|
2723
2422
|
$el.setAttribute('cy', "" + height / 2);
|
|
@@ -2725,11 +2424,11 @@
|
|
|
2725
2424
|
}
|
|
2726
2425
|
});
|
|
2727
2426
|
};
|
|
2728
|
-
|
|
2729
2427
|
return SVGRendererPlugin;
|
|
2730
2428
|
}();
|
|
2731
|
-
|
|
2732
2429
|
SVGRendererPlugin.tag = 'SVGRenderer';
|
|
2430
|
+
|
|
2431
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/alignment-baseline
|
|
2733
2432
|
var BASELINE_MAP = {
|
|
2734
2433
|
top: 'before-edge',
|
|
2735
2434
|
middle: 'central',
|
|
@@ -2737,9 +2436,9 @@
|
|
|
2737
2436
|
alphabetic: 'alphabetic',
|
|
2738
2437
|
ideographic: 'ideographic',
|
|
2739
2438
|
hanging: 'hanging'
|
|
2740
|
-
};
|
|
2439
|
+
};
|
|
2440
|
+
// for FireFox
|
|
2741
2441
|
// @see https://github.com/plouc/nivo/issues/164
|
|
2742
|
-
|
|
2743
2442
|
var BASELINE_MAP_FOR_FIREFOX = {
|
|
2744
2443
|
top: 'text-before-edge',
|
|
2745
2444
|
middle: 'central',
|
|
@@ -2748,26 +2447,24 @@
|
|
|
2748
2447
|
ideographic: 'ideographic',
|
|
2749
2448
|
hanging: 'hanging'
|
|
2750
2449
|
};
|
|
2751
|
-
|
|
2752
2450
|
function updateTextElementAttribute($el, parsedStyle) {
|
|
2753
2451
|
var textBaseline = parsedStyle.textBaseline,
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2452
|
+
lineWidth = parsedStyle.lineWidth,
|
|
2453
|
+
metrics = parsedStyle.metrics,
|
|
2454
|
+
dx = parsedStyle.dx,
|
|
2455
|
+
dy = parsedStyle.dy,
|
|
2456
|
+
textPath = parsedStyle.textPath,
|
|
2457
|
+
_parsedStyle$textPath = parsedStyle.textPathSide,
|
|
2458
|
+
textPathSide = _parsedStyle$textPath === void 0 ? 'left' : _parsedStyle$textPath,
|
|
2459
|
+
_parsedStyle$textPath2 = parsedStyle.textPathStartOffset,
|
|
2460
|
+
textPathStartOffset = _parsedStyle$textPath2 === void 0 ? 0 : _parsedStyle$textPath2,
|
|
2461
|
+
_parsedStyle$textDeco = parsedStyle.textDecorationLine,
|
|
2462
|
+
textDecorationLine = _parsedStyle$textDeco === void 0 ? '' : _parsedStyle$textDeco,
|
|
2463
|
+
_parsedStyle$textDeco2 = parsedStyle.textDecorationColor,
|
|
2464
|
+
textDecorationColor = _parsedStyle$textDeco2 === void 0 ? '' : _parsedStyle$textDeco2,
|
|
2465
|
+
_parsedStyle$textDeco3 = parsedStyle.textDecorationStyle,
|
|
2466
|
+
textDecorationStyle = _parsedStyle$textDeco3 === void 0 ? '' : _parsedStyle$textDeco3;
|
|
2769
2467
|
var browser = detect();
|
|
2770
|
-
|
|
2771
2468
|
if (browser && browser.name === 'firefox') {
|
|
2772
2469
|
// compatible with FireFox browser, ref: https://github.com/antvis/g/issues/119
|
|
2773
2470
|
$el.setAttribute('dominant-baseline', BASELINE_MAP_FOR_FIREFOX[textBaseline] || 'alphabetic');
|
|
@@ -2775,47 +2472,39 @@
|
|
|
2775
2472
|
$el.setAttribute('dominant-baseline', BASELINE_MAP_FOR_FIREFOX[textBaseline]);
|
|
2776
2473
|
$el.setAttribute('alignment-baseline', BASELINE_MAP[textBaseline]);
|
|
2777
2474
|
}
|
|
2778
|
-
|
|
2779
2475
|
$el.setAttribute('paint-order', 'stroke');
|
|
2780
2476
|
var lines = metrics.lines,
|
|
2781
|
-
|
|
2782
|
-
|
|
2477
|
+
lineHeight = metrics.lineHeight,
|
|
2478
|
+
height = metrics.height;
|
|
2783
2479
|
var lineNum = lines.length;
|
|
2784
2480
|
var styleCSSText = '';
|
|
2785
|
-
|
|
2786
2481
|
if (dx !== 0 || dy !== 0) {
|
|
2787
2482
|
styleCSSText += "transform:translate(" + dx + "px, " + dy + "px);";
|
|
2788
2483
|
}
|
|
2789
|
-
|
|
2790
2484
|
if (textDecorationLine && textDecorationLine !== 'none') {
|
|
2791
2485
|
// use CSS text-decoration since the implementation in SVG is not good enough
|
|
2792
2486
|
styleCSSText += "text-decoration:" + textDecorationLine + " " + textDecorationStyle + " " + textDecorationColor + ";";
|
|
2793
2487
|
}
|
|
2794
|
-
|
|
2795
2488
|
if (styleCSSText) {
|
|
2796
2489
|
$el.setAttribute('style', styleCSSText);
|
|
2797
2490
|
}
|
|
2798
|
-
|
|
2799
2491
|
if (lineNum === 1) {
|
|
2800
2492
|
var textContent = convertHTML(lines[0]);
|
|
2801
|
-
$el.setAttribute('dx', "" + lineWidth / 2);
|
|
2493
|
+
$el.setAttribute('dx', "" + lineWidth / 2);
|
|
2494
|
+
// <textPath> only support one line
|
|
2802
2495
|
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/textPath
|
|
2803
|
-
|
|
2804
2496
|
if (textPath) {
|
|
2805
2497
|
// clear existed text content first
|
|
2806
|
-
$el.innerHTML = '';
|
|
2807
|
-
|
|
2498
|
+
$el.innerHTML = '';
|
|
2499
|
+
// append <textPath href="#MyPath">text</textPath>
|
|
2808
2500
|
var $textPath = createSVGElement('textPath', $el.ownerDocument);
|
|
2809
2501
|
$textPath.setAttribute('href', "#" + (TEXT_PATH_PREFIX + textPath.entity));
|
|
2810
|
-
|
|
2811
2502
|
if (textPathSide !== 'left') {
|
|
2812
2503
|
$textPath.setAttribute('side', textPathSide);
|
|
2813
2504
|
}
|
|
2814
|
-
|
|
2815
2505
|
if (textPathStartOffset !== 0) {
|
|
2816
2506
|
$textPath.setAttribute('startOffset', "" + textPathStartOffset);
|
|
2817
2507
|
}
|
|
2818
|
-
|
|
2819
2508
|
$textPath.innerHTML = textContent;
|
|
2820
2509
|
$el.appendChild($textPath);
|
|
2821
2510
|
} else {
|
|
@@ -2825,7 +2514,6 @@
|
|
|
2825
2514
|
$el.innerHTML = lines.map(function (line, i) {
|
|
2826
2515
|
var dx = lineWidth / 2;
|
|
2827
2516
|
var dy = 0;
|
|
2828
|
-
|
|
2829
2517
|
if (i === 0) {
|
|
2830
2518
|
// TODO: handle other textBaseline values
|
|
2831
2519
|
if (textBaseline === 'middle') {
|
|
@@ -2838,77 +2526,63 @@
|
|
|
2838
2526
|
} else {
|
|
2839
2527
|
dy = lineHeight;
|
|
2840
2528
|
}
|
|
2841
|
-
|
|
2842
2529
|
return "<tspan x=\"0\" dx=\"" + dx + "\" dy=\"" + dy + "\">" + convertHTML(line) + "</tspan>";
|
|
2843
2530
|
}).join('');
|
|
2844
2531
|
}
|
|
2845
2532
|
}
|
|
2846
|
-
|
|
2847
2533
|
var _SHAPE2TAGS, _SHAPE_UPDATE_DEPS;
|
|
2848
|
-
|
|
2849
2534
|
var SHAPE2TAGS = (_SHAPE2TAGS = {}, _SHAPE2TAGS[gLite.Shape.RECT] = 'path', _SHAPE2TAGS[gLite.Shape.CIRCLE] = 'circle', _SHAPE2TAGS[gLite.Shape.ELLIPSE] = 'ellipse', _SHAPE2TAGS[gLite.Shape.IMAGE] = 'image', _SHAPE2TAGS[gLite.Shape.GROUP] = 'g', _SHAPE2TAGS[gLite.Shape.LINE] = 'line', _SHAPE2TAGS[gLite.Shape.POLYLINE] = 'polyline', _SHAPE2TAGS[gLite.Shape.POLYGON] = 'polygon', _SHAPE2TAGS[gLite.Shape.TEXT] = 'text', _SHAPE2TAGS[gLite.Shape.PATH] = 'path', _SHAPE2TAGS[gLite.Shape.HTML] = 'foreignObject', _SHAPE2TAGS);
|
|
2850
|
-
var SHAPE_UPDATE_DEPS = (_SHAPE_UPDATE_DEPS = {}, _SHAPE_UPDATE_DEPS[gLite.Shape.CIRCLE] = ['r'], _SHAPE_UPDATE_DEPS[gLite.Shape.ELLIPSE] = ['rx', 'ry'], _SHAPE_UPDATE_DEPS[gLite.Shape.RECT] = ['width', 'height', 'radius'], _SHAPE_UPDATE_DEPS[gLite.Shape.IMAGE] = ['img', 'width', 'height'], _SHAPE_UPDATE_DEPS[gLite.Shape.LINE] = ['x1', 'y1', 'x2', 'y2', 'markerStart', 'markerEnd', 'markerStartOffset', 'markerEndOffset'], _SHAPE_UPDATE_DEPS[gLite.Shape.POLYLINE] = ['points', 'markerStart', 'markerEnd', 'markerMid', 'markerStartOffset', 'markerEndOffset'], _SHAPE_UPDATE_DEPS[gLite.Shape.POLYGON] = ['points', 'markerStart', 'markerEnd', 'markerMid', 'markerStartOffset', 'markerEndOffset'], _SHAPE_UPDATE_DEPS[gLite.Shape.PATH] = ['path', 'markerStart', 'markerEnd', 'markerMid', 'markerStartOffset', 'markerEndOffset'], _SHAPE_UPDATE_DEPS[gLite.Shape.TEXT] = ['text', 'font', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'lineHeight', 'letterSpacing', 'wordWrap', 'wordWrapWidth', 'maxLines', 'leading', 'textBaseline', 'textAlign', 'textTransform', 'textOverflow', 'textPath', 'textPathSide', 'textPathStartOffset', 'textDecorationLine', 'textDecorationColor', 'textDecorationStyle',
|
|
2535
|
+
var SHAPE_UPDATE_DEPS = (_SHAPE_UPDATE_DEPS = {}, _SHAPE_UPDATE_DEPS[gLite.Shape.CIRCLE] = ['r'], _SHAPE_UPDATE_DEPS[gLite.Shape.ELLIPSE] = ['rx', 'ry'], _SHAPE_UPDATE_DEPS[gLite.Shape.RECT] = ['width', 'height', 'radius'], _SHAPE_UPDATE_DEPS[gLite.Shape.IMAGE] = ['img', 'width', 'height'], _SHAPE_UPDATE_DEPS[gLite.Shape.LINE] = ['x1', 'y1', 'x2', 'y2', 'markerStart', 'markerEnd', 'markerStartOffset', 'markerEndOffset'], _SHAPE_UPDATE_DEPS[gLite.Shape.POLYLINE] = ['points', 'markerStart', 'markerEnd', 'markerMid', 'markerStartOffset', 'markerEndOffset'], _SHAPE_UPDATE_DEPS[gLite.Shape.POLYGON] = ['points', 'markerStart', 'markerEnd', 'markerMid', 'markerStartOffset', 'markerEndOffset'], _SHAPE_UPDATE_DEPS[gLite.Shape.PATH] = ['path', 'markerStart', 'markerEnd', 'markerMid', 'markerStartOffset', 'markerEndOffset'], _SHAPE_UPDATE_DEPS[gLite.Shape.TEXT] = ['text', 'font', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'lineHeight', 'letterSpacing', 'wordWrap', 'wordWrapWidth', 'maxLines', 'leading', 'textBaseline', 'textAlign', 'textTransform', 'textOverflow', 'textPath', 'textPathSide', 'textPathStartOffset', 'textDecorationLine', 'textDecorationColor', 'textDecorationStyle',
|
|
2536
|
+
// 'whiteSpace',
|
|
2851
2537
|
'dx', 'dy'], _SHAPE_UPDATE_DEPS);
|
|
2852
|
-
|
|
2853
2538
|
var DefaultElementLifeCycleContribution = /*#__PURE__*/function () {
|
|
2854
2539
|
function DefaultElementLifeCycleContribution(context) {
|
|
2855
2540
|
this.context = void 0;
|
|
2856
2541
|
this.context = context;
|
|
2857
2542
|
}
|
|
2858
|
-
|
|
2859
2543
|
var _proto = DefaultElementLifeCycleContribution.prototype;
|
|
2860
|
-
|
|
2861
2544
|
_proto.createElement = function createElement(object) {
|
|
2862
2545
|
var doc = this.context.config.document;
|
|
2863
2546
|
var type = SHAPE2TAGS[object.nodeName] || 'g';
|
|
2864
2547
|
return createSVGElement(type, doc || document);
|
|
2865
2548
|
};
|
|
2866
|
-
|
|
2867
2549
|
_proto.destroyElement = function destroyElement(object, $el) {};
|
|
2868
|
-
|
|
2869
2550
|
_proto.shouldUpdateElementAttribute = function shouldUpdateElementAttribute(object, attributeName) {
|
|
2870
2551
|
var nodeName = object.nodeName;
|
|
2871
2552
|
return (SHAPE_UPDATE_DEPS[nodeName] || []).indexOf(attributeName) > -1;
|
|
2872
2553
|
};
|
|
2873
|
-
|
|
2874
2554
|
_proto.updateElementAttribute = function updateElementAttribute(object) {
|
|
2875
2555
|
// @ts-ignore
|
|
2876
2556
|
var $el = object.elementSVG.$el;
|
|
2877
2557
|
var nodeName = object.nodeName,
|
|
2878
|
-
|
|
2879
|
-
|
|
2558
|
+
parsedStyle = object.parsedStyle;
|
|
2880
2559
|
switch (nodeName) {
|
|
2881
2560
|
case gLite.Shape.IMAGE:
|
|
2882
2561
|
{
|
|
2883
2562
|
updateImageElementAttribute($el, parsedStyle);
|
|
2884
2563
|
break;
|
|
2885
2564
|
}
|
|
2886
|
-
|
|
2887
2565
|
case gLite.Shape.RECT:
|
|
2888
2566
|
{
|
|
2889
2567
|
updateRectElementAttribute($el, parsedStyle);
|
|
2890
2568
|
break;
|
|
2891
2569
|
}
|
|
2892
|
-
|
|
2893
2570
|
case gLite.Shape.LINE:
|
|
2894
2571
|
{
|
|
2895
2572
|
updateLineElementAttribute($el, parsedStyle);
|
|
2896
2573
|
break;
|
|
2897
2574
|
}
|
|
2898
|
-
|
|
2899
2575
|
case gLite.Shape.POLYGON:
|
|
2900
2576
|
case gLite.Shape.POLYLINE:
|
|
2901
2577
|
{
|
|
2902
2578
|
updatePolylineElementAttribute($el, parsedStyle);
|
|
2903
2579
|
break;
|
|
2904
2580
|
}
|
|
2905
|
-
|
|
2906
2581
|
case gLite.Shape.PATH:
|
|
2907
2582
|
{
|
|
2908
2583
|
updatePathElementAttribute($el, parsedStyle);
|
|
2909
2584
|
break;
|
|
2910
2585
|
}
|
|
2911
|
-
|
|
2912
2586
|
case gLite.Shape.TEXT:
|
|
2913
2587
|
{
|
|
2914
2588
|
updateTextElementAttribute($el, parsedStyle);
|
|
@@ -2916,38 +2590,32 @@
|
|
|
2916
2590
|
}
|
|
2917
2591
|
}
|
|
2918
2592
|
};
|
|
2919
|
-
|
|
2920
2593
|
return DefaultElementLifeCycleContribution;
|
|
2921
2594
|
}();
|
|
2922
|
-
|
|
2923
2595
|
var FILTER_PREFIX = 'g-filter-';
|
|
2924
2596
|
/**
|
|
2925
2597
|
* use SVG filters, eg. blur, brightness, contrast...
|
|
2926
2598
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/filter
|
|
2927
2599
|
*/
|
|
2928
|
-
|
|
2929
2600
|
function createOrUpdateFilter(document, $def, object, $el, filters) {
|
|
2930
2601
|
// eg. filter="url(#f1) url(#f2)"
|
|
2931
2602
|
var filterName = FILTER_PREFIX + object.entity;
|
|
2932
2603
|
var $existedFilters = $def.querySelectorAll("[name=" + filterName + "]");
|
|
2933
|
-
|
|
2934
2604
|
if ($existedFilters.length) {
|
|
2935
2605
|
$existedFilters.forEach(function ($filter) {
|
|
2936
2606
|
$def.removeChild($filter);
|
|
2937
2607
|
});
|
|
2938
2608
|
}
|
|
2939
|
-
|
|
2940
2609
|
if (filters.length === 0) {
|
|
2941
2610
|
// 'none'
|
|
2942
2611
|
$el === null || $el === void 0 ? void 0 : $el.removeAttribute('filter');
|
|
2943
2612
|
} else {
|
|
2944
2613
|
var filterIds = filters.map(function (_ref, i) {
|
|
2945
2614
|
var name = _ref.name,
|
|
2946
|
-
|
|
2947
|
-
var $filter = createSVGElement('filter', document);
|
|
2948
|
-
|
|
2615
|
+
params = _ref.params;
|
|
2616
|
+
var $filter = createSVGElement('filter', document);
|
|
2617
|
+
// @see https://github.com/antvis/g/issues/1025
|
|
2949
2618
|
$filter.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
2950
|
-
|
|
2951
2619
|
if (name === 'blur') {
|
|
2952
2620
|
createBlur(document, $filter, params);
|
|
2953
2621
|
} else if (name === 'brightness') {
|
|
@@ -2967,13 +2635,12 @@
|
|
|
2967
2635
|
} else if (name === 'invert') {
|
|
2968
2636
|
createInvert(document, $filter, params);
|
|
2969
2637
|
}
|
|
2970
|
-
|
|
2971
2638
|
$filter.id = filterName + "-" + i;
|
|
2972
2639
|
$filter.setAttribute('name', filterName);
|
|
2973
2640
|
$def.appendChild($filter);
|
|
2974
2641
|
return $filter.id;
|
|
2975
|
-
});
|
|
2976
|
-
|
|
2642
|
+
});
|
|
2643
|
+
// @see https://github.com/antvis/G/issues/1114
|
|
2977
2644
|
setTimeout(function () {
|
|
2978
2645
|
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', filterIds.map(function (filterId) {
|
|
2979
2646
|
return "url(#" + filterId + ")";
|
|
@@ -2981,43 +2648,36 @@
|
|
|
2981
2648
|
});
|
|
2982
2649
|
}
|
|
2983
2650
|
}
|
|
2984
|
-
|
|
2985
2651
|
function convertToAbsoluteValue(param) {
|
|
2986
2652
|
return param.unit === gLite.UnitType.kPercentage ? param.value / 100 : param.value;
|
|
2987
2653
|
}
|
|
2988
2654
|
/**
|
|
2989
2655
|
* @see https://drafts.fxtf.org/filter-effects/#blurEquivalent
|
|
2990
2656
|
*/
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
2657
|
function createBlur(document, $filter, params) {
|
|
2994
2658
|
var $feGaussianBlur = createSVGElement('feGaussianBlur', document);
|
|
2995
2659
|
$feGaussianBlur.setAttribute('in', 'SourceGraphic');
|
|
2996
2660
|
$feGaussianBlur.setAttribute('stdDeviation', "" + params[0].value);
|
|
2997
2661
|
$filter.appendChild($feGaussianBlur);
|
|
2998
2662
|
}
|
|
2999
|
-
|
|
3000
2663
|
function createFeComponentTransfer(document, $filter, _ref2) {
|
|
3001
2664
|
var type = _ref2.type,
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
2665
|
+
slope = _ref2.slope,
|
|
2666
|
+
intercept = _ref2.intercept,
|
|
2667
|
+
tableValues = _ref2.tableValues;
|
|
3005
2668
|
var $feComponentTransfer = createSVGElement('feComponentTransfer', document);
|
|
3006
2669
|
[createSVGElement('feFuncR', document), createSVGElement('feFuncG', document), createSVGElement('feFuncB', document)].forEach(function ($feFunc) {
|
|
3007
2670
|
$feFunc.setAttribute('type', type);
|
|
3008
|
-
|
|
3009
2671
|
if (type === 'table') {
|
|
3010
2672
|
$feFunc.setAttribute('tableValues', "" + tableValues);
|
|
3011
2673
|
} else {
|
|
3012
2674
|
$feFunc.setAttribute('slope', "" + slope);
|
|
3013
2675
|
$feFunc.setAttribute('intercept', "" + intercept);
|
|
3014
2676
|
}
|
|
3015
|
-
|
|
3016
2677
|
$feComponentTransfer.appendChild($feFunc);
|
|
3017
2678
|
});
|
|
3018
2679
|
$filter.appendChild($feComponentTransfer);
|
|
3019
2680
|
}
|
|
3020
|
-
|
|
3021
2681
|
function createContrast(document, $filter, params) {
|
|
3022
2682
|
var slope = convertToAbsoluteValue(params[0]);
|
|
3023
2683
|
createFeComponentTransfer(document, $filter, {
|
|
@@ -3026,7 +2686,6 @@
|
|
|
3026
2686
|
intercept: -(0.5 * slope) + 0.5
|
|
3027
2687
|
});
|
|
3028
2688
|
}
|
|
3029
|
-
|
|
3030
2689
|
function createInvert(document, $filter, params) {
|
|
3031
2690
|
var amount = convertToAbsoluteValue(params[0]);
|
|
3032
2691
|
createFeComponentTransfer(document, $filter, {
|
|
@@ -3034,7 +2693,6 @@
|
|
|
3034
2693
|
tableValues: amount + " " + (1 - amount)
|
|
3035
2694
|
});
|
|
3036
2695
|
}
|
|
3037
|
-
|
|
3038
2696
|
function createBrightness(document, $filter, params) {
|
|
3039
2697
|
var slope = convertToAbsoluteValue(params[0]);
|
|
3040
2698
|
createFeComponentTransfer(document, $filter, {
|
|
@@ -3043,7 +2701,6 @@
|
|
|
3043
2701
|
intercept: 0
|
|
3044
2702
|
});
|
|
3045
2703
|
}
|
|
3046
|
-
|
|
3047
2704
|
function createSaturate(document, $filter, params) {
|
|
3048
2705
|
var amount = convertToAbsoluteValue(params[0]);
|
|
3049
2706
|
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
@@ -3051,19 +2708,17 @@
|
|
|
3051
2708
|
$feColorMatrix.setAttribute('values', "" + amount);
|
|
3052
2709
|
$filter.appendChild($feColorMatrix);
|
|
3053
2710
|
}
|
|
3054
|
-
|
|
3055
2711
|
function createHueRotate(document, $filter, params) {
|
|
3056
2712
|
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
3057
2713
|
$feColorMatrix.setAttribute('type', 'hueRotate');
|
|
3058
2714
|
$feColorMatrix.setAttribute('values', "" + params[0].to(gLite.UnitType.kDegrees).value);
|
|
3059
2715
|
$filter.appendChild($feColorMatrix);
|
|
3060
2716
|
}
|
|
3061
|
-
|
|
3062
2717
|
function createDropShadow(document, $filter, params) {
|
|
3063
2718
|
var shadowOffsetX = params[0].value;
|
|
3064
2719
|
var shadowOffsetY = params[1].value;
|
|
3065
|
-
var shadowBlur = params[2].value;
|
|
3066
|
-
|
|
2720
|
+
var shadowBlur = params[2].value;
|
|
2721
|
+
// @ts-ignore
|
|
3067
2722
|
var shadowColor = params[3].formatted;
|
|
3068
2723
|
var $feGaussianBlur = createSVGElement('feGaussianBlur', document);
|
|
3069
2724
|
$feGaussianBlur.setAttribute('in', 'SourceAlpha');
|
|
@@ -3089,7 +2744,6 @@
|
|
|
3089
2744
|
$feMerge.appendChild($feMergeNode1);
|
|
3090
2745
|
$feMerge.appendChild($feMergeNode2);
|
|
3091
2746
|
}
|
|
3092
|
-
|
|
3093
2747
|
function createFeColorMatrix(document, $filter, matrix) {
|
|
3094
2748
|
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
3095
2749
|
$feColorMatrix.setAttribute('type', 'matrix');
|
|
@@ -3099,32 +2753,25 @@
|
|
|
3099
2753
|
/**
|
|
3100
2754
|
* @see https://drafts.fxtf.org/filter-effects/#grayscaleEquivalent
|
|
3101
2755
|
*/
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
2756
|
function createGrayscale(document, $filter, params) {
|
|
3105
2757
|
var amount = convertToAbsoluteValue(params[0]);
|
|
3106
2758
|
createFeColorMatrix(document, $filter, [0.2126 + 0.7874 * (1 - amount), 0.7152 - 0.7152 * (1 - amount), 0.0722 - 0.0722 * (1 - amount), 0, 0, 0.2126 - 0.2126 * (1 - amount), 0.7152 + 0.2848 * (1 - amount), 0.0722 - 0.0722 * (1 - amount), 0, 0, 0.2126 - 0.2126 * (1 - amount), 0.7152 - 0.7152 * (1 - amount), 0.0722 + 0.9278 * (1 - amount), 0, 0, 0, 0, 0, 1, 0]);
|
|
3107
2759
|
}
|
|
3108
2760
|
/**
|
|
3109
2761
|
* @see https://drafts.fxtf.org/filter-effects/#sepiaEquivalent
|
|
3110
|
-
*/
|
|
3111
|
-
|
|
3112
|
-
|
|
2762
|
+
*/
|
|
3113
2763
|
function createSepia(document, $filter, params) {
|
|
3114
2764
|
var amount = convertToAbsoluteValue(params[0]);
|
|
3115
2765
|
createFeColorMatrix(document, $filter, [0.393 + 0.607 * (1 - amount), 0.769 - 0.769 * (1 - amount), 0.189 - 0.189 * (1 - amount), 0, 0, 0.349 - 0.349 * (1 - amount), 0.686 + 0.314 * (1 - amount), 0.168 - 0.168 * (1 - amount), 0, 0, 0.272 - 0.272 * (1 - amount), 0.534 - 0.534 * (1 - amount), 0.131 + 0.869 * (1 - amount), 0, 0, 0, 0, 0, 1, 0]);
|
|
3116
2766
|
}
|
|
3117
|
-
|
|
3118
2767
|
var PATTERN_PREFIX = 'g-pattern-';
|
|
3119
2768
|
var cacheKey2IDMap = {};
|
|
3120
2769
|
var counter = 0;
|
|
3121
|
-
|
|
3122
2770
|
function createOrUpdateGradientAndPattern(document, $def, object, $el, parsedColor, name, createImage) {
|
|
3123
2771
|
// eg. clipPath don't have fill/stroke
|
|
3124
2772
|
if (!parsedColor) {
|
|
3125
2773
|
return '';
|
|
3126
2774
|
}
|
|
3127
|
-
|
|
3128
2775
|
if (parsedColor instanceof gLite.CSSRGB) {
|
|
3129
2776
|
// keep using currentColor @see https://github.com/d3/d3-axis/issues/49
|
|
3130
2777
|
if (object.style[name] === 'currentColor') {
|
|
@@ -3134,9 +2781,9 @@
|
|
|
3134
2781
|
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, parsedColor.isNone ? 'none' : parsedColor.toString());
|
|
3135
2782
|
}
|
|
3136
2783
|
} else if (gLite.isPattern(parsedColor)) {
|
|
3137
|
-
var patternId = createOrUpdatePattern(document, $def, object, parsedColor, createImage);
|
|
2784
|
+
var patternId = createOrUpdatePattern(document, $def, object, parsedColor, createImage);
|
|
2785
|
+
// use style instead of attribute when applying <pattern>
|
|
3138
2786
|
// @see https://stackoverflow.com/a/7723115
|
|
3139
|
-
|
|
3140
2787
|
$el.style[name] = "url(#" + patternId + ")";
|
|
3141
2788
|
return patternId;
|
|
3142
2789
|
} else {
|
|
@@ -3152,36 +2799,30 @@
|
|
|
3152
2799
|
return filterId;
|
|
3153
2800
|
}
|
|
3154
2801
|
}
|
|
3155
|
-
|
|
3156
2802
|
return '';
|
|
3157
2803
|
}
|
|
3158
|
-
|
|
3159
2804
|
function generateCacheKey(src, options) {
|
|
3160
2805
|
if (options === void 0) {
|
|
3161
2806
|
options = {};
|
|
3162
2807
|
}
|
|
3163
|
-
|
|
3164
2808
|
var cacheKey = '';
|
|
3165
|
-
|
|
3166
2809
|
if (src instanceof gLite.CSSGradientValue) {
|
|
3167
2810
|
var type = src.type,
|
|
3168
|
-
|
|
3169
|
-
|
|
2811
|
+
value = src.value;
|
|
3170
2812
|
if (type === gLite.GradientType.LinearGradient || type === gLite.GradientType.RadialGradient) {
|
|
3171
2813
|
// @ts-ignore
|
|
3172
2814
|
var _value$options = _extends({}, value, options),
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
2815
|
+
_type = _value$options.type,
|
|
2816
|
+
width = _value$options.width,
|
|
2817
|
+
height = _value$options.height,
|
|
2818
|
+
steps = _value$options.steps,
|
|
2819
|
+
angle = _value$options.angle,
|
|
2820
|
+
cx = _value$options.cx,
|
|
2821
|
+
cy = _value$options.cy,
|
|
2822
|
+
size = _value$options.size;
|
|
3182
2823
|
cacheKey = "gradient-" + _type + "-" + ((angle === null || angle === void 0 ? void 0 : angle.toString()) || 0) + "-" + ((cx === null || cx === void 0 ? void 0 : cx.toString()) || 0) + "-" + ((cy === null || cy === void 0 ? void 0 : cy.toString()) || 0) + "-" + ((size === null || size === void 0 ? void 0 : size.toString()) || 0) + "-" + width + "-" + height + "-" + steps.map(function (_ref) {
|
|
3183
2824
|
var offset = _ref.offset,
|
|
3184
|
-
|
|
2825
|
+
color = _ref.color;
|
|
3185
2826
|
return "" + offset + color;
|
|
3186
2827
|
}).join('-');
|
|
3187
2828
|
}
|
|
@@ -3192,25 +2833,20 @@
|
|
|
3192
2833
|
cacheKey = "pattern-" + counter;
|
|
3193
2834
|
}
|
|
3194
2835
|
}
|
|
3195
|
-
|
|
3196
2836
|
if (cacheKey) {
|
|
3197
2837
|
if (!cacheKey2IDMap[cacheKey]) {
|
|
3198
2838
|
cacheKey2IDMap[cacheKey] = PATTERN_PREFIX + ("" + counter++);
|
|
3199
2839
|
}
|
|
3200
2840
|
}
|
|
3201
|
-
|
|
3202
2841
|
return cacheKey2IDMap[cacheKey];
|
|
3203
2842
|
}
|
|
3204
|
-
|
|
3205
2843
|
function createOrUpdatePattern(document, $def, object, pattern, createImage) {
|
|
3206
2844
|
var patternId = generateCacheKey(pattern);
|
|
3207
2845
|
var $existed = $def.querySelector("#" + patternId);
|
|
3208
|
-
|
|
3209
2846
|
if (!$existed) {
|
|
3210
2847
|
var image = pattern.image,
|
|
3211
|
-
|
|
2848
|
+
repetition = pattern.repetition;
|
|
3212
2849
|
var imageURL = '';
|
|
3213
|
-
|
|
3214
2850
|
if (isString(image)) {
|
|
3215
2851
|
imageURL = image;
|
|
3216
2852
|
} else {
|
|
@@ -3222,7 +2858,6 @@
|
|
|
3222
2858
|
} else ;
|
|
3223
2859
|
}
|
|
3224
2860
|
}
|
|
3225
|
-
|
|
3226
2861
|
if (imageURL) {
|
|
3227
2862
|
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/pattern
|
|
3228
2863
|
var $pattern = createSVGElement('pattern', document);
|
|
@@ -3230,37 +2865,30 @@
|
|
|
3230
2865
|
var $image = createSVGElement('image', document);
|
|
3231
2866
|
$pattern.appendChild($image);
|
|
3232
2867
|
$pattern.id = patternId;
|
|
3233
|
-
$def.appendChild($pattern);
|
|
2868
|
+
$def.appendChild($pattern);
|
|
2869
|
+
// use href instead of xlink:href
|
|
3234
2870
|
// @see https://stackoverflow.com/a/13379007
|
|
3235
|
-
|
|
3236
2871
|
$image.setAttribute('href', imageURL);
|
|
3237
2872
|
var img;
|
|
3238
|
-
|
|
3239
2873
|
if (createImage) {
|
|
3240
2874
|
img = createImage(imageURL);
|
|
3241
2875
|
} else if (gLite.isBrowser) {
|
|
3242
2876
|
img = new window.Image();
|
|
3243
2877
|
}
|
|
3244
|
-
|
|
3245
2878
|
if (!imageURL.match(/^data:/i)) {
|
|
3246
2879
|
img.crossOrigin = 'Anonymous';
|
|
3247
2880
|
$image.setAttribute('crossorigin', 'anonymous');
|
|
3248
2881
|
}
|
|
3249
|
-
|
|
3250
2882
|
img.src = imageURL;
|
|
3251
|
-
|
|
3252
2883
|
var onload = function onload() {
|
|
3253
2884
|
$pattern.setAttribute('x', '0');
|
|
3254
2885
|
$pattern.setAttribute('y', '0');
|
|
3255
|
-
|
|
3256
2886
|
var _object$getGeometryBo = object.getGeometryBounds(),
|
|
3257
|
-
|
|
2887
|
+
halfExtents = _object$getGeometryBo.halfExtents;
|
|
2888
|
+
// There is no equivalent to CSS no-repeat for SVG patterns
|
|
3258
2889
|
// @see https://stackoverflow.com/a/33481956
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
2890
|
var patternWidth = img.width;
|
|
3262
2891
|
var patternHeight = img.height;
|
|
3263
|
-
|
|
3264
2892
|
if (repetition === 'repeat-x') {
|
|
3265
2893
|
patternHeight = halfExtents[1] * 2;
|
|
3266
2894
|
} else if (repetition === 'repeat-y') {
|
|
@@ -3269,7 +2897,6 @@
|
|
|
3269
2897
|
patternWidth = halfExtents[0] * 2;
|
|
3270
2898
|
patternHeight = halfExtents[1] * 2;
|
|
3271
2899
|
}
|
|
3272
|
-
|
|
3273
2900
|
$pattern.setAttribute('width', "" + patternWidth);
|
|
3274
2901
|
$pattern.setAttribute('height', "" + patternHeight);
|
|
3275
2902
|
$image.setAttribute('x', '0');
|
|
@@ -3277,20 +2904,17 @@
|
|
|
3277
2904
|
$image.setAttribute('width', "" + img.width);
|
|
3278
2905
|
$image.setAttribute('height', "" + img.height);
|
|
3279
2906
|
};
|
|
3280
|
-
|
|
3281
2907
|
if (img.complete) {
|
|
3282
2908
|
onload();
|
|
3283
2909
|
} else {
|
|
3284
|
-
img.onload = onload;
|
|
3285
|
-
|
|
2910
|
+
img.onload = onload;
|
|
2911
|
+
// Fix onload() bug in IE9
|
|
3286
2912
|
img.src = img.src;
|
|
3287
2913
|
}
|
|
3288
2914
|
}
|
|
3289
2915
|
}
|
|
3290
|
-
|
|
3291
2916
|
return patternId;
|
|
3292
2917
|
}
|
|
3293
|
-
|
|
3294
2918
|
function createOrUpdateGradient(document, object, $def, $el, parsedColor) {
|
|
3295
2919
|
var bounds = object.getGeometryBounds();
|
|
3296
2920
|
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
@@ -3300,70 +2924,63 @@
|
|
|
3300
2924
|
height: height
|
|
3301
2925
|
});
|
|
3302
2926
|
var $existed = $def.querySelector("#" + gradientId);
|
|
3303
|
-
|
|
3304
2927
|
if (!$existed) {
|
|
3305
2928
|
// <linearGradient> <radialGradient>
|
|
3306
2929
|
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/linearGradient
|
|
3307
2930
|
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/radialGradient
|
|
3308
|
-
$existed = createSVGElement(parsedColor.type === gLite.GradientType.LinearGradient ? 'linearGradient' : 'radialGradient', document);
|
|
3309
|
-
|
|
3310
|
-
$existed.setAttribute('gradientUnits', 'userSpaceOnUse');
|
|
3311
|
-
|
|
2931
|
+
$existed = createSVGElement(parsedColor.type === gLite.GradientType.LinearGradient ? 'linearGradient' : 'radialGradient', document);
|
|
2932
|
+
// @see https://github.com/antvis/g/issues/1025
|
|
2933
|
+
$existed.setAttribute('gradientUnits', 'userSpaceOnUse');
|
|
2934
|
+
// add stops
|
|
3312
2935
|
var innerHTML = '';
|
|
3313
|
-
parsedColor.value.steps
|
|
2936
|
+
parsedColor.value.steps
|
|
2937
|
+
// sort by offset @see https://github.com/antvis/G/issues/1171
|
|
3314
2938
|
.sort(function (a, b) {
|
|
3315
2939
|
return a.offset.value - b.offset.value;
|
|
3316
2940
|
}).forEach(function (_ref2) {
|
|
3317
2941
|
var offset = _ref2.offset,
|
|
3318
|
-
|
|
3319
|
-
|
|
2942
|
+
color = _ref2.color;
|
|
2943
|
+
// TODO: support absolute unit like `px`
|
|
3320
2944
|
innerHTML += "<stop offset=\"" + offset.value / 100 + "\" stop-color=\"" + color + "\"></stop>";
|
|
3321
2945
|
});
|
|
3322
2946
|
$existed.innerHTML = innerHTML;
|
|
3323
2947
|
$existed.id = gradientId;
|
|
3324
2948
|
$def.appendChild($existed);
|
|
3325
2949
|
}
|
|
3326
|
-
|
|
3327
2950
|
if (parsedColor.type === gLite.GradientType.LinearGradient) {
|
|
3328
2951
|
var angle = parsedColor.value.angle;
|
|
3329
|
-
|
|
3330
2952
|
var _computeLinearGradien = gLite.computeLinearGradient(width, height, angle),
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
2953
|
+
x1 = _computeLinearGradien.x1,
|
|
2954
|
+
y1 = _computeLinearGradien.y1,
|
|
2955
|
+
x2 = _computeLinearGradien.x2,
|
|
2956
|
+
y2 = _computeLinearGradien.y2;
|
|
3336
2957
|
$existed.setAttribute('x1', "" + x1);
|
|
3337
2958
|
$existed.setAttribute('y1', "" + y1);
|
|
3338
2959
|
$existed.setAttribute('x2', "" + x2);
|
|
3339
|
-
$existed.setAttribute('y2', "" + y2);
|
|
2960
|
+
$existed.setAttribute('y2', "" + y2);
|
|
2961
|
+
// $existed.setAttribute('gradientTransform', `rotate(${angle})`);
|
|
3340
2962
|
} else {
|
|
3341
2963
|
var _parsedColor$value = parsedColor.value,
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
2964
|
+
cx = _parsedColor$value.cx,
|
|
2965
|
+
cy = _parsedColor$value.cy,
|
|
2966
|
+
size = _parsedColor$value.size;
|
|
3346
2967
|
var _computeRadialGradien = gLite.computeRadialGradient(width, height, cx, cy, size),
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
2968
|
+
x = _computeRadialGradien.x,
|
|
2969
|
+
y = _computeRadialGradien.y,
|
|
2970
|
+
r = _computeRadialGradien.r;
|
|
3351
2971
|
$existed.setAttribute('cx', "" + x);
|
|
3352
2972
|
$existed.setAttribute('cy', "" + y);
|
|
3353
2973
|
$existed.setAttribute('r', "" + r);
|
|
3354
2974
|
}
|
|
3355
|
-
|
|
3356
2975
|
return gradientId;
|
|
3357
2976
|
}
|
|
3358
|
-
|
|
3359
2977
|
function createOrUpdateMultiGradient(document, object, $def, $el, gradients) {
|
|
3360
2978
|
var filterId = FILTER_PREFIX + object.entity + '-gradient';
|
|
3361
2979
|
var $existed = $def.querySelector("#" + filterId);
|
|
3362
|
-
|
|
3363
2980
|
if (!$existed) {
|
|
3364
2981
|
$existed = createSVGElement('filter', document);
|
|
3365
|
-
$existed.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
3366
|
-
|
|
2982
|
+
$existed.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
2983
|
+
// @see https://github.com/antvis/g/issues/1025
|
|
3367
2984
|
$existed.setAttribute('x', '0%');
|
|
3368
2985
|
$existed.setAttribute('y', '0%');
|
|
3369
2986
|
$existed.setAttribute('width', '100%');
|
|
@@ -3380,8 +2997,6 @@
|
|
|
3380
2997
|
<feComposite in="blendedGrad" in2="SourceGraphic" operator="in"/>
|
|
3381
2998
|
</filter>
|
|
3382
2999
|
*/
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
3000
|
var blended = 0;
|
|
3386
3001
|
gradients.forEach(function (gradient, i) {
|
|
3387
3002
|
var gradientId = createOrUpdateGradient(document, object, $def, $el, gradient);
|
|
@@ -3398,13 +3013,12 @@
|
|
|
3398
3013
|
$feImage.setAttribute('href', "#" + rectId);
|
|
3399
3014
|
$feImage.setAttribute('result', filterId + "-" + i);
|
|
3400
3015
|
$existed.appendChild($feImage);
|
|
3401
|
-
|
|
3402
3016
|
if (i > 0) {
|
|
3403
3017
|
var $feBlend = createSVGElement('feBlend', document);
|
|
3404
3018
|
$feBlend.setAttribute('in', i === 1 ? filterId + "-" + (i - 1) : filterId + "-blended-" + (blended - 1));
|
|
3405
3019
|
$feBlend.setAttribute('in2', filterId + "-" + i);
|
|
3406
|
-
$feBlend.setAttribute('result', filterId + "-blended-" + blended++);
|
|
3407
|
-
|
|
3020
|
+
$feBlend.setAttribute('result', filterId + "-blended-" + blended++);
|
|
3021
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/blend-mode
|
|
3408
3022
|
$feBlend.setAttribute('mode', 'multiply');
|
|
3409
3023
|
$existed.appendChild($feBlend);
|
|
3410
3024
|
}
|
|
@@ -3416,36 +3030,31 @@
|
|
|
3416
3030
|
$existed.appendChild($feComposite);
|
|
3417
3031
|
return filterId;
|
|
3418
3032
|
}
|
|
3419
|
-
|
|
3420
3033
|
var FILTER_DROPSHADOW_PREFIX = 'g-filter-dropshadow-';
|
|
3421
3034
|
/**
|
|
3422
3035
|
* use SVG filters
|
|
3423
3036
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/filter
|
|
3424
3037
|
*/
|
|
3425
|
-
|
|
3426
3038
|
function createOrUpdateShadow(document, $def, object, $el, name) {
|
|
3427
3039
|
var _object$parsedStyle = object.parsedStyle,
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3040
|
+
shadowType = _object$parsedStyle.shadowType,
|
|
3041
|
+
shadowBlur = _object$parsedStyle.shadowBlur,
|
|
3042
|
+
shadowColor = _object$parsedStyle.shadowColor,
|
|
3043
|
+
shadowOffsetX = _object$parsedStyle.shadowOffsetX,
|
|
3044
|
+
shadowOffsetY = _object$parsedStyle.shadowOffsetY;
|
|
3433
3045
|
var hasShadow = !isNil(shadowColor) && shadowBlur > 0;
|
|
3434
3046
|
var shadowId = FILTER_DROPSHADOW_PREFIX + object.entity;
|
|
3435
3047
|
var $existedFilter = $def.querySelector("#" + shadowId);
|
|
3436
|
-
|
|
3437
3048
|
if ($existedFilter) {
|
|
3438
3049
|
var existedShadowType = $existedFilter.getAttribute('data-type');
|
|
3439
|
-
|
|
3440
3050
|
if (existedShadowType !== shadowType || !hasShadow) {
|
|
3441
3051
|
// remove existed shadow
|
|
3442
3052
|
$existedFilter.remove();
|
|
3443
3053
|
$existedFilter = null;
|
|
3444
3054
|
}
|
|
3445
|
-
}
|
|
3055
|
+
}
|
|
3056
|
+
// <Group> also has shadowType as its default value
|
|
3446
3057
|
// only apply shadow when blur > 0
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
3058
|
if (hasShadow) {
|
|
3450
3059
|
// use filter <feDropShadow>
|
|
3451
3060
|
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow
|
|
@@ -3454,11 +3063,9 @@
|
|
|
3454
3063
|
$el === null || $el === void 0 ? void 0 : $el.removeAttribute('filter');
|
|
3455
3064
|
return;
|
|
3456
3065
|
}
|
|
3457
|
-
|
|
3458
3066
|
if (!$existedFilter) {
|
|
3459
3067
|
$existedFilter = createSVGElement('filter', document);
|
|
3460
3068
|
$existedFilter.setAttribute('data-type', shadowType);
|
|
3461
|
-
|
|
3462
3069
|
if (shadowType === 'outer') {
|
|
3463
3070
|
var $feDropShadow = createSVGElement('feDropShadow', document);
|
|
3464
3071
|
$feDropShadow.setAttribute('dx', "" + (shadowOffsetX || 0) / 2);
|
|
@@ -3502,19 +3109,16 @@
|
|
|
3502
3109
|
$feMerge.appendChild($feMergeNode);
|
|
3503
3110
|
$feMerge.appendChild($feMergeNode2);
|
|
3504
3111
|
}
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3112
|
+
$existedFilter.id = shadowId;
|
|
3113
|
+
// @see https://github.com/antvis/g/issues/1025
|
|
3508
3114
|
$existedFilter.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
3509
3115
|
$def.appendChild($existedFilter);
|
|
3510
3116
|
return;
|
|
3511
3117
|
}
|
|
3512
|
-
|
|
3513
3118
|
if (shadowType === 'inner') {
|
|
3514
3119
|
var _$feGaussianBlur = $existedFilter.children[1];
|
|
3515
3120
|
var _$feOffset = $existedFilter.children[2];
|
|
3516
3121
|
var _$feFlood = $existedFilter.children[3];
|
|
3517
|
-
|
|
3518
3122
|
if (name === 'shadowColor') {
|
|
3519
3123
|
_$feFlood.setAttribute('flood-color', shadowColor.toString());
|
|
3520
3124
|
} else if (name === 'shadowBlur') {
|
|
@@ -3529,7 +3133,6 @@
|
|
|
3529
3133
|
}
|
|
3530
3134
|
} else if (shadowType === 'outer') {
|
|
3531
3135
|
var _$feDropShadow = $existedFilter.children[0];
|
|
3532
|
-
|
|
3533
3136
|
if (name === 'shadowColor') {
|
|
3534
3137
|
_$feDropShadow.setAttribute('flood-color', shadowColor.toString());
|
|
3535
3138
|
} else if (name === 'shadowBlur') {
|
|
@@ -3544,9 +3147,7 @@
|
|
|
3544
3147
|
}
|
|
3545
3148
|
}
|
|
3546
3149
|
}
|
|
3547
|
-
|
|
3548
3150
|
var urlRegexp = /url\(#(.*)\)/;
|
|
3549
|
-
|
|
3550
3151
|
var DefElementManager = /*#__PURE__*/function () {
|
|
3551
3152
|
function DefElementManager(context) {
|
|
3552
3153
|
this.context = void 0;
|
|
@@ -3557,123 +3158,98 @@
|
|
|
3557
3158
|
/**
|
|
3558
3159
|
* container for <gradient> <clipPath>...
|
|
3559
3160
|
*/
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
3161
|
var _proto = DefElementManager.prototype;
|
|
3563
|
-
|
|
3564
3162
|
_proto.getDefElement = function getDefElement() {
|
|
3565
3163
|
return this.$def;
|
|
3566
3164
|
};
|
|
3567
|
-
|
|
3568
3165
|
_proto.init = function init() {
|
|
3569
3166
|
var document = this.context.config.document;
|
|
3570
3167
|
var $svg = this.context.contextService.getContext();
|
|
3571
3168
|
this.$def = createSVGElement('defs', document);
|
|
3572
3169
|
$svg.appendChild(this.$def);
|
|
3573
3170
|
};
|
|
3574
|
-
|
|
3575
3171
|
_proto.clear = function clear(entity) {
|
|
3576
3172
|
var _this = this;
|
|
3577
|
-
|
|
3578
3173
|
Object.keys(this.gradientCache).forEach(function (id) {
|
|
3579
3174
|
_this.clearUnusedDefElement(_this.gradientCache, id, entity);
|
|
3580
3175
|
});
|
|
3581
3176
|
};
|
|
3582
|
-
|
|
3583
3177
|
_proto.clearUnusedDefElement = function clearUnusedDefElement(cache, id, entity) {
|
|
3584
3178
|
if (cache[id] && cache[id].size === 1 && cache[id].has(entity)) {
|
|
3585
3179
|
var targetElement = this.$def.querySelector("#" + id);
|
|
3586
|
-
|
|
3587
3180
|
if (targetElement) {
|
|
3588
3181
|
this.$def.removeChild(targetElement);
|
|
3589
3182
|
}
|
|
3590
3183
|
}
|
|
3591
3184
|
};
|
|
3592
|
-
|
|
3593
3185
|
_proto.createOrUpdateGradientAndPattern = function createOrUpdateGradientAndPattern$1(object, $el, parsedColor, name) {
|
|
3594
3186
|
var _this$context$config = this.context.config,
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3187
|
+
doc = _this$context$config.document,
|
|
3188
|
+
createImage = _this$context$config.createImage;
|
|
3598
3189
|
if ($el) {
|
|
3599
|
-
var _$el$getAttribute;
|
|
3600
|
-
|
|
3601
|
-
|
|
3190
|
+
var _$el$getAttribute;
|
|
3191
|
+
// `url(#${gradientId})`
|
|
3602
3192
|
var matches = (_$el$getAttribute = $el.getAttribute(name)) === null || _$el$getAttribute === void 0 ? void 0 : _$el$getAttribute.match(urlRegexp);
|
|
3603
|
-
|
|
3604
3193
|
if (matches && matches.length > 1) {
|
|
3605
3194
|
this.clearUnusedDefElement(this.gradientCache, matches[1], object.entity);
|
|
3606
3195
|
}
|
|
3607
|
-
|
|
3608
3196
|
var newDefElementId = createOrUpdateGradientAndPattern(doc || document, this.$def, object, $el, parsedColor, name, createImage);
|
|
3609
|
-
|
|
3610
3197
|
if (!this.gradientCache[newDefElementId]) {
|
|
3611
3198
|
this.gradientCache[newDefElementId] = new Set();
|
|
3612
3199
|
}
|
|
3613
|
-
|
|
3614
3200
|
this.gradientCache[newDefElementId].add(object.entity);
|
|
3615
3201
|
}
|
|
3616
3202
|
};
|
|
3617
|
-
|
|
3618
3203
|
_proto.createOrUpdateShadow = function createOrUpdateShadow$1(object, $el, name) {
|
|
3619
3204
|
var doc = this.context.config.document;
|
|
3620
3205
|
createOrUpdateShadow(doc || document, this.$def, object, $el, name);
|
|
3621
3206
|
};
|
|
3622
|
-
|
|
3623
3207
|
_proto.createOrUpdateFilter = function createOrUpdateFilter$1(object, $el, filters) {
|
|
3624
3208
|
var doc = this.context.config.document;
|
|
3625
3209
|
createOrUpdateFilter(doc || document, this.$def, object, $el, filters);
|
|
3626
3210
|
};
|
|
3627
|
-
|
|
3628
3211
|
return DefElementManager;
|
|
3629
3212
|
}();
|
|
3630
|
-
|
|
3631
3213
|
var Plugin$1 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
3632
3214
|
_inheritsLoose$2(Plugin, _AbstractRendererPlug);
|
|
3633
|
-
|
|
3634
3215
|
function Plugin(options) {
|
|
3635
3216
|
var _this;
|
|
3636
|
-
|
|
3637
3217
|
if (options === void 0) {
|
|
3638
3218
|
options = {};
|
|
3639
3219
|
}
|
|
3640
|
-
|
|
3641
3220
|
_this = _AbstractRendererPlug.call(this) || this;
|
|
3642
3221
|
_this.options = void 0;
|
|
3643
3222
|
_this.name = 'svg-renderer';
|
|
3644
3223
|
_this.options = options;
|
|
3645
3224
|
return _this;
|
|
3646
3225
|
}
|
|
3647
|
-
|
|
3648
3226
|
var _proto = Plugin.prototype;
|
|
3649
|
-
|
|
3650
3227
|
_proto.init = function init() {
|
|
3651
3228
|
var _this$options = this.options,
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
var defElementManager = new DefElementManager(this.context);
|
|
3655
|
-
|
|
3656
|
-
var defaultElementLifeCycleContribution = new DefaultElementLifeCycleContribution(this.context);
|
|
3657
|
-
|
|
3658
|
-
this.context.defaultElementLifeCycleContribution = defaultElementLifeCycleContribution;
|
|
3659
|
-
|
|
3229
|
+
outputSVGElementId = _this$options.outputSVGElementId,
|
|
3230
|
+
outputSVGElementName = _this$options.outputSVGElementName;
|
|
3231
|
+
var defElementManager = new DefElementManager(this.context);
|
|
3232
|
+
// default implementation
|
|
3233
|
+
var defaultElementLifeCycleContribution = new DefaultElementLifeCycleContribution(this.context);
|
|
3234
|
+
// @ts-ignore
|
|
3235
|
+
this.context.defaultElementLifeCycleContribution = defaultElementLifeCycleContribution;
|
|
3236
|
+
// @ts-ignore
|
|
3660
3237
|
this.context.SVGElementLifeCycleContribution = defaultElementLifeCycleContribution;
|
|
3661
3238
|
var SVGRendererPluginOptions = {
|
|
3662
3239
|
outputSVGElementId: !isNil(outputSVGElementId) ? !!outputSVGElementId : true,
|
|
3663
3240
|
outputSVGElementName: !isNil(outputSVGElementName) ? !!outputSVGElementName : true
|
|
3664
3241
|
};
|
|
3665
|
-
this.addRenderingPlugin(
|
|
3242
|
+
this.addRenderingPlugin(
|
|
3243
|
+
// @ts-ignore
|
|
3666
3244
|
new SVGRendererPlugin(SVGRendererPluginOptions, defElementManager, this.context));
|
|
3667
3245
|
};
|
|
3668
|
-
|
|
3669
3246
|
_proto.destroy = function destroy() {
|
|
3670
|
-
this.removeAllRenderingPlugins();
|
|
3671
|
-
|
|
3672
|
-
delete this.context.defaultElementLifeCycleContribution;
|
|
3673
|
-
|
|
3247
|
+
this.removeAllRenderingPlugins();
|
|
3248
|
+
// @ts-ignore
|
|
3249
|
+
delete this.context.defaultElementLifeCycleContribution;
|
|
3250
|
+
// @ts-ignore
|
|
3674
3251
|
delete this.context.SVGElementLifeCycleContribution;
|
|
3675
3252
|
};
|
|
3676
|
-
|
|
3677
3253
|
return Plugin;
|
|
3678
3254
|
}(gLite.AbstractRendererPlugin);
|
|
3679
3255
|
|
|
@@ -3700,19 +3276,19 @@
|
|
|
3700
3276
|
});
|
|
3701
3277
|
|
|
3702
3278
|
function _regeneratorRuntime$3() {
|
|
3703
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3704
3279
|
_regeneratorRuntime$3 = function _regeneratorRuntime() {
|
|
3705
3280
|
return exports;
|
|
3706
3281
|
};
|
|
3707
|
-
|
|
3708
3282
|
var exports = {},
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3283
|
+
Op = Object.prototype,
|
|
3284
|
+
hasOwn = Op.hasOwnProperty,
|
|
3285
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
3286
|
+
obj[key] = desc.value;
|
|
3287
|
+
},
|
|
3288
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
3289
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
3290
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
3291
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
3716
3292
|
function define(obj, key, value) {
|
|
3717
3293
|
return Object.defineProperty(obj, key, {
|
|
3718
3294
|
value: value,
|
|
@@ -3721,7 +3297,6 @@
|
|
|
3721
3297
|
writable: !0
|
|
3722
3298
|
}), obj[key];
|
|
3723
3299
|
}
|
|
3724
|
-
|
|
3725
3300
|
try {
|
|
3726
3301
|
define({}, "");
|
|
3727
3302
|
} catch (err) {
|
|
@@ -3729,54 +3304,14 @@
|
|
|
3729
3304
|
return obj[key] = value;
|
|
3730
3305
|
};
|
|
3731
3306
|
}
|
|
3732
|
-
|
|
3733
3307
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
3734
3308
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
return generator
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
3741
|
-
|
|
3742
|
-
if ("completed" === state) {
|
|
3743
|
-
if ("throw" === method) throw arg;
|
|
3744
|
-
return doneResult();
|
|
3745
|
-
}
|
|
3746
|
-
|
|
3747
|
-
for (context.method = method, context.arg = arg;;) {
|
|
3748
|
-
var delegate = context.delegate;
|
|
3749
|
-
|
|
3750
|
-
if (delegate) {
|
|
3751
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
3752
|
-
|
|
3753
|
-
if (delegateResult) {
|
|
3754
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
3755
|
-
return delegateResult;
|
|
3756
|
-
}
|
|
3757
|
-
}
|
|
3758
|
-
|
|
3759
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
3760
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
3761
|
-
context.dispatchException(context.arg);
|
|
3762
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
3763
|
-
state = "executing";
|
|
3764
|
-
var record = tryCatch(innerFn, self, context);
|
|
3765
|
-
|
|
3766
|
-
if ("normal" === record.type) {
|
|
3767
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
3768
|
-
return {
|
|
3769
|
-
value: record.arg,
|
|
3770
|
-
done: context.done
|
|
3771
|
-
};
|
|
3772
|
-
}
|
|
3773
|
-
|
|
3774
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
3775
|
-
}
|
|
3776
|
-
};
|
|
3777
|
-
}(innerFn, self, context), generator;
|
|
3309
|
+
generator = Object.create(protoGenerator.prototype),
|
|
3310
|
+
context = new Context(tryLocsList || []);
|
|
3311
|
+
return defineProperty(generator, "_invoke", {
|
|
3312
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
3313
|
+
}), generator;
|
|
3778
3314
|
}
|
|
3779
|
-
|
|
3780
3315
|
function tryCatch(fn, obj, arg) {
|
|
3781
3316
|
try {
|
|
3782
3317
|
return {
|
|
@@ -3790,25 +3325,19 @@
|
|
|
3790
3325
|
};
|
|
3791
3326
|
}
|
|
3792
3327
|
}
|
|
3793
|
-
|
|
3794
3328
|
exports.wrap = wrap;
|
|
3795
3329
|
var ContinueSentinel = {};
|
|
3796
|
-
|
|
3797
3330
|
function Generator() {}
|
|
3798
|
-
|
|
3799
3331
|
function GeneratorFunction() {}
|
|
3800
|
-
|
|
3801
3332
|
function GeneratorFunctionPrototype() {}
|
|
3802
|
-
|
|
3803
3333
|
var IteratorPrototype = {};
|
|
3804
3334
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
3805
3335
|
return this;
|
|
3806
3336
|
});
|
|
3807
3337
|
var getProto = Object.getPrototypeOf,
|
|
3808
|
-
|
|
3338
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
3809
3339
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
3810
3340
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
3811
|
-
|
|
3812
3341
|
function defineIteratorMethods(prototype) {
|
|
3813
3342
|
["next", "throw", "return"].forEach(function (method) {
|
|
3814
3343
|
define(prototype, method, function (arg) {
|
|
@@ -3816,14 +3345,12 @@
|
|
|
3816
3345
|
});
|
|
3817
3346
|
});
|
|
3818
3347
|
}
|
|
3819
|
-
|
|
3820
3348
|
function AsyncIterator(generator, PromiseImpl) {
|
|
3821
3349
|
function invoke(method, arg, resolve, reject) {
|
|
3822
3350
|
var record = tryCatch(generator[method], generator, arg);
|
|
3823
|
-
|
|
3824
3351
|
if ("throw" !== record.type) {
|
|
3825
3352
|
var result = record.arg,
|
|
3826
|
-
|
|
3353
|
+
value = result.value;
|
|
3827
3354
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
3828
3355
|
invoke("next", value, resolve, reject);
|
|
3829
3356
|
}, function (err) {
|
|
@@ -3834,92 +3361,116 @@
|
|
|
3834
3361
|
return invoke("throw", error, resolve, reject);
|
|
3835
3362
|
});
|
|
3836
3363
|
}
|
|
3837
|
-
|
|
3838
3364
|
reject(record.arg);
|
|
3839
3365
|
}
|
|
3840
|
-
|
|
3841
3366
|
var previousPromise;
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3367
|
+
defineProperty(this, "_invoke", {
|
|
3368
|
+
value: function value(method, arg) {
|
|
3369
|
+
function callInvokeWithMethodAndArg() {
|
|
3370
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
3371
|
+
invoke(method, arg, resolve, reject);
|
|
3372
|
+
});
|
|
3373
|
+
}
|
|
3374
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
3375
|
+
}
|
|
3376
|
+
});
|
|
3377
|
+
}
|
|
3378
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
3379
|
+
var state = "suspendedStart";
|
|
3380
|
+
return function (method, arg) {
|
|
3381
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
3382
|
+
if ("completed" === state) {
|
|
3383
|
+
if ("throw" === method) throw arg;
|
|
3384
|
+
return doneResult();
|
|
3385
|
+
}
|
|
3386
|
+
for (context.method = method, context.arg = arg;;) {
|
|
3387
|
+
var delegate = context.delegate;
|
|
3388
|
+
if (delegate) {
|
|
3389
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
3390
|
+
if (delegateResult) {
|
|
3391
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
3392
|
+
return delegateResult;
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
3396
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
3397
|
+
context.dispatchException(context.arg);
|
|
3398
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
3399
|
+
state = "executing";
|
|
3400
|
+
var record = tryCatch(innerFn, self, context);
|
|
3401
|
+
if ("normal" === record.type) {
|
|
3402
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
3403
|
+
return {
|
|
3404
|
+
value: record.arg,
|
|
3405
|
+
done: context.done
|
|
3406
|
+
};
|
|
3407
|
+
}
|
|
3408
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
3848
3409
|
}
|
|
3849
|
-
|
|
3850
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
3851
3410
|
};
|
|
3852
3411
|
}
|
|
3853
|
-
|
|
3854
3412
|
function maybeInvokeDelegate(delegate, context) {
|
|
3855
3413
|
var method = delegate.iterator[context.method];
|
|
3856
|
-
|
|
3857
3414
|
if (undefined === method) {
|
|
3858
3415
|
if (context.delegate = null, "throw" === context.method) {
|
|
3859
3416
|
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
3860
3417
|
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
3861
3418
|
}
|
|
3862
|
-
|
|
3863
3419
|
return ContinueSentinel;
|
|
3864
3420
|
}
|
|
3865
|
-
|
|
3866
3421
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
3867
3422
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
3868
3423
|
var info = record.arg;
|
|
3869
3424
|
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
3870
3425
|
}
|
|
3871
|
-
|
|
3872
3426
|
function pushTryEntry(locs) {
|
|
3873
3427
|
var entry = {
|
|
3874
3428
|
tryLoc: locs[0]
|
|
3875
3429
|
};
|
|
3876
3430
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
3877
3431
|
}
|
|
3878
|
-
|
|
3879
3432
|
function resetTryEntry(entry) {
|
|
3880
3433
|
var record = entry.completion || {};
|
|
3881
3434
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
3882
3435
|
}
|
|
3883
|
-
|
|
3884
3436
|
function Context(tryLocsList) {
|
|
3885
3437
|
this.tryEntries = [{
|
|
3886
3438
|
tryLoc: "root"
|
|
3887
3439
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
3888
3440
|
}
|
|
3889
|
-
|
|
3890
3441
|
function values(iterable) {
|
|
3891
3442
|
if (iterable) {
|
|
3892
3443
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
3893
3444
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
3894
3445
|
if ("function" == typeof iterable.next) return iterable;
|
|
3895
|
-
|
|
3896
3446
|
if (!isNaN(iterable.length)) {
|
|
3897
3447
|
var i = -1,
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
};
|
|
3905
|
-
|
|
3448
|
+
next = function next() {
|
|
3449
|
+
for (; ++i < iterable.length;) {
|
|
3450
|
+
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
3451
|
+
}
|
|
3452
|
+
return next.value = undefined, next.done = !0, next;
|
|
3453
|
+
};
|
|
3906
3454
|
return next.next = next;
|
|
3907
3455
|
}
|
|
3908
3456
|
}
|
|
3909
|
-
|
|
3910
3457
|
return {
|
|
3911
3458
|
next: doneResult
|
|
3912
3459
|
};
|
|
3913
3460
|
}
|
|
3914
|
-
|
|
3915
3461
|
function doneResult() {
|
|
3916
3462
|
return {
|
|
3917
3463
|
value: undefined,
|
|
3918
3464
|
done: !0
|
|
3919
3465
|
};
|
|
3920
3466
|
}
|
|
3921
|
-
|
|
3922
|
-
|
|
3467
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
3468
|
+
value: GeneratorFunctionPrototype,
|
|
3469
|
+
configurable: !0
|
|
3470
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
3471
|
+
value: GeneratorFunction,
|
|
3472
|
+
configurable: !0
|
|
3473
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
3923
3474
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
3924
3475
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
3925
3476
|
}, exports.mark = function (genFun) {
|
|
@@ -3940,19 +3491,17 @@
|
|
|
3940
3491
|
return this;
|
|
3941
3492
|
}), define(Gp, "toString", function () {
|
|
3942
3493
|
return "[object Generator]";
|
|
3943
|
-
}), exports.keys = function (
|
|
3944
|
-
var
|
|
3945
|
-
|
|
3494
|
+
}), exports.keys = function (val) {
|
|
3495
|
+
var object = Object(val),
|
|
3496
|
+
keys = [];
|
|
3946
3497
|
for (var key in object) {
|
|
3947
3498
|
keys.push(key);
|
|
3948
3499
|
}
|
|
3949
|
-
|
|
3950
3500
|
return keys.reverse(), function next() {
|
|
3951
3501
|
for (; keys.length;) {
|
|
3952
3502
|
var key = keys.pop();
|
|
3953
3503
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
3954
3504
|
}
|
|
3955
|
-
|
|
3956
3505
|
return next.done = !0, next;
|
|
3957
3506
|
};
|
|
3958
3507
|
}, exports.values = values, Context.prototype = {
|
|
@@ -3971,20 +3520,16 @@
|
|
|
3971
3520
|
dispatchException: function dispatchException(exception) {
|
|
3972
3521
|
if (this.done) throw exception;
|
|
3973
3522
|
var context = this;
|
|
3974
|
-
|
|
3975
3523
|
function handle(loc, caught) {
|
|
3976
3524
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
3977
3525
|
}
|
|
3978
|
-
|
|
3979
3526
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3980
3527
|
var entry = this.tryEntries[i],
|
|
3981
|
-
|
|
3528
|
+
record = entry.completion;
|
|
3982
3529
|
if ("root" === entry.tryLoc) return handle("end");
|
|
3983
|
-
|
|
3984
3530
|
if (entry.tryLoc <= this.prev) {
|
|
3985
3531
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
3986
|
-
|
|
3987
|
-
|
|
3532
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
3988
3533
|
if (hasCatch && hasFinally) {
|
|
3989
3534
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
3990
3535
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -4000,13 +3545,11 @@
|
|
|
4000
3545
|
abrupt: function abrupt(type, arg) {
|
|
4001
3546
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
4002
3547
|
var entry = this.tryEntries[i];
|
|
4003
|
-
|
|
4004
3548
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
4005
3549
|
var finallyEntry = entry;
|
|
4006
3550
|
break;
|
|
4007
3551
|
}
|
|
4008
3552
|
}
|
|
4009
|
-
|
|
4010
3553
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
4011
3554
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
4012
3555
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -4024,19 +3567,15 @@
|
|
|
4024
3567
|
catch: function _catch(tryLoc) {
|
|
4025
3568
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
4026
3569
|
var entry = this.tryEntries[i];
|
|
4027
|
-
|
|
4028
3570
|
if (entry.tryLoc === tryLoc) {
|
|
4029
3571
|
var record = entry.completion;
|
|
4030
|
-
|
|
4031
3572
|
if ("throw" === record.type) {
|
|
4032
3573
|
var thrown = record.arg;
|
|
4033
3574
|
resetTryEntry(entry);
|
|
4034
3575
|
}
|
|
4035
|
-
|
|
4036
3576
|
return thrown;
|
|
4037
3577
|
}
|
|
4038
3578
|
}
|
|
4039
|
-
|
|
4040
3579
|
throw new Error("illegal catch attempt");
|
|
4041
3580
|
},
|
|
4042
3581
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -4048,7 +3587,6 @@
|
|
|
4048
3587
|
}
|
|
4049
3588
|
}, exports;
|
|
4050
3589
|
}
|
|
4051
|
-
|
|
4052
3590
|
function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4053
3591
|
try {
|
|
4054
3592
|
var info = gen[key](arg);
|
|
@@ -4057,41 +3595,33 @@
|
|
|
4057
3595
|
reject(error);
|
|
4058
3596
|
return;
|
|
4059
3597
|
}
|
|
4060
|
-
|
|
4061
3598
|
if (info.done) {
|
|
4062
3599
|
resolve(value);
|
|
4063
3600
|
} else {
|
|
4064
3601
|
Promise.resolve(value).then(_next, _throw);
|
|
4065
3602
|
}
|
|
4066
3603
|
}
|
|
4067
|
-
|
|
4068
3604
|
function _asyncToGenerator$3(fn) {
|
|
4069
3605
|
return function () {
|
|
4070
3606
|
var self = this,
|
|
4071
|
-
|
|
3607
|
+
args = arguments;
|
|
4072
3608
|
return new Promise(function (resolve, reject) {
|
|
4073
3609
|
var gen = fn.apply(self, args);
|
|
4074
|
-
|
|
4075
3610
|
function _next(value) {
|
|
4076
3611
|
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
|
|
4077
3612
|
}
|
|
4078
|
-
|
|
4079
3613
|
function _throw(err) {
|
|
4080
3614
|
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
|
|
4081
3615
|
}
|
|
4082
|
-
|
|
4083
3616
|
_next(undefined);
|
|
4084
3617
|
});
|
|
4085
3618
|
};
|
|
4086
3619
|
}
|
|
4087
|
-
|
|
4088
3620
|
function _inheritsLoose$3(subClass, superClass) {
|
|
4089
3621
|
subClass.prototype = Object.create(superClass.prototype);
|
|
4090
3622
|
subClass.prototype.constructor = subClass;
|
|
4091
|
-
|
|
4092
3623
|
_setPrototypeOf$3(subClass, superClass);
|
|
4093
3624
|
}
|
|
4094
|
-
|
|
4095
3625
|
function _setPrototypeOf$3(o, p) {
|
|
4096
3626
|
_setPrototypeOf$3 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
4097
3627
|
o.__proto__ = p;
|
|
@@ -4099,7 +3629,6 @@
|
|
|
4099
3629
|
};
|
|
4100
3630
|
return _setPrototypeOf$3(o, p);
|
|
4101
3631
|
}
|
|
4102
|
-
|
|
4103
3632
|
function _unsupportedIterableToArray(o, minLen) {
|
|
4104
3633
|
if (!o) return;
|
|
4105
3634
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -4108,21 +3637,16 @@
|
|
|
4108
3637
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
4109
3638
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
4110
3639
|
}
|
|
4111
|
-
|
|
4112
3640
|
function _arrayLikeToArray(arr, len) {
|
|
4113
3641
|
if (len == null || len > arr.length) len = arr.length;
|
|
4114
|
-
|
|
4115
3642
|
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
4116
3643
|
arr2[i] = arr[i];
|
|
4117
3644
|
}
|
|
4118
|
-
|
|
4119
3645
|
return arr2;
|
|
4120
3646
|
}
|
|
4121
|
-
|
|
4122
3647
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
4123
3648
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
4124
3649
|
if (it) return (it = it.call(o)).next.bind(it);
|
|
4125
|
-
|
|
4126
3650
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
4127
3651
|
if (it) o = it;
|
|
4128
3652
|
var i = 0;
|
|
@@ -4136,27 +3660,22 @@
|
|
|
4136
3660
|
};
|
|
4137
3661
|
};
|
|
4138
3662
|
}
|
|
4139
|
-
|
|
4140
3663
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4141
3664
|
}
|
|
3665
|
+
|
|
4142
3666
|
/**
|
|
4143
3667
|
* pick shape(s) with Mouse/Touch event
|
|
4144
3668
|
*
|
|
4145
3669
|
* 1. find AABB with r-tree
|
|
4146
3670
|
* 2. use elementFromPoint
|
|
4147
3671
|
*/
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
3672
|
var SVGPickerPlugin = /*#__PURE__*/function () {
|
|
4151
3673
|
function SVGPickerPlugin() {}
|
|
4152
|
-
|
|
4153
3674
|
var _proto = SVGPickerPlugin.prototype;
|
|
4154
|
-
|
|
4155
3675
|
_proto.apply = function apply(context) {
|
|
4156
3676
|
var _this = this;
|
|
4157
|
-
|
|
4158
3677
|
var doc = context.config.document,
|
|
4159
|
-
|
|
3678
|
+
renderingService = context.renderingService;
|
|
4160
3679
|
renderingService.hooks.pick.tapPromise(SVGPickerPlugin.tag, /*#__PURE__*/function () {
|
|
4161
3680
|
var _ref = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee(result) {
|
|
4162
3681
|
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
@@ -4164,7 +3683,6 @@
|
|
|
4164
3683
|
switch (_context.prev = _context.next) {
|
|
4165
3684
|
case 0:
|
|
4166
3685
|
return _context.abrupt("return", _this.pick(doc, result));
|
|
4167
|
-
|
|
4168
3686
|
case 1:
|
|
4169
3687
|
case "end":
|
|
4170
3688
|
return _context.stop();
|
|
@@ -4172,7 +3690,6 @@
|
|
|
4172
3690
|
}
|
|
4173
3691
|
}, _callee);
|
|
4174
3692
|
}));
|
|
4175
|
-
|
|
4176
3693
|
return function (_x) {
|
|
4177
3694
|
return _ref.apply(this, arguments);
|
|
4178
3695
|
};
|
|
@@ -4181,28 +3698,24 @@
|
|
|
4181
3698
|
return _this.pick(doc, result);
|
|
4182
3699
|
});
|
|
4183
3700
|
};
|
|
4184
|
-
|
|
4185
3701
|
_proto.pick = function pick(doc, result) {
|
|
4186
3702
|
var topmost = result.topmost,
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
3703
|
+
_result$position = result.position,
|
|
3704
|
+
clientX = _result$position.clientX,
|
|
3705
|
+
clientY = _result$position.clientY;
|
|
4191
3706
|
try {
|
|
4192
|
-
var targets = [];
|
|
4193
|
-
|
|
3707
|
+
var targets = [];
|
|
3708
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/elementsFromPoint
|
|
4194
3709
|
for (var _iterator = _createForOfIteratorHelperLoose((doc || document).elementsFromPoint(clientX, clientY)), _step; !(_step = _iterator()).done;) {
|
|
4195
|
-
var element = _step.value;
|
|
4196
|
-
|
|
3710
|
+
var element = _step.value;
|
|
3711
|
+
// eg. g_svg_circle_345
|
|
4197
3712
|
var id = element && element.getAttribute('id');
|
|
4198
|
-
|
|
4199
3713
|
if (id && id.startsWith(G_SVG_PREFIX)) {
|
|
4200
3714
|
var index = id.lastIndexOf('-');
|
|
4201
|
-
var target = gLite.runtime.displayObjectPool.getByEntity(id.substring(index + 1));
|
|
4202
|
-
|
|
3715
|
+
var target = gLite.runtime.displayObjectPool.getByEntity(id.substring(index + 1));
|
|
3716
|
+
// don't need to account for `visibility` since DOM API already does
|
|
4203
3717
|
if (target && target.isInteractive()) {
|
|
4204
3718
|
targets.push(target);
|
|
4205
|
-
|
|
4206
3719
|
if (topmost) {
|
|
4207
3720
|
result.picked = targets;
|
|
4208
3721
|
return result;
|
|
@@ -4210,45 +3723,33 @@
|
|
|
4210
3723
|
}
|
|
4211
3724
|
}
|
|
4212
3725
|
}
|
|
4213
|
-
|
|
4214
3726
|
result.picked = targets;
|
|
4215
3727
|
} catch (e) {
|
|
4216
3728
|
result.picked = [];
|
|
4217
3729
|
}
|
|
4218
|
-
|
|
4219
3730
|
return result;
|
|
4220
3731
|
};
|
|
4221
|
-
|
|
4222
3732
|
return SVGPickerPlugin;
|
|
4223
3733
|
}();
|
|
4224
|
-
|
|
4225
3734
|
SVGPickerPlugin.tag = 'SVGPicker';
|
|
4226
|
-
|
|
4227
3735
|
var Plugin$2 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
4228
3736
|
_inheritsLoose$3(Plugin, _AbstractRendererPlug);
|
|
4229
|
-
|
|
4230
3737
|
function Plugin() {
|
|
4231
3738
|
var _this;
|
|
4232
|
-
|
|
4233
3739
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4234
3740
|
args[_key] = arguments[_key];
|
|
4235
3741
|
}
|
|
4236
|
-
|
|
4237
3742
|
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
4238
3743
|
_this.name = 'svg-picker';
|
|
4239
3744
|
return _this;
|
|
4240
3745
|
}
|
|
4241
|
-
|
|
4242
3746
|
var _proto = Plugin.prototype;
|
|
4243
|
-
|
|
4244
3747
|
_proto.init = function init() {
|
|
4245
3748
|
this.addRenderingPlugin(new SVGPickerPlugin());
|
|
4246
3749
|
};
|
|
4247
|
-
|
|
4248
3750
|
_proto.destroy = function destroy() {
|
|
4249
3751
|
this.removeAllRenderingPlugins();
|
|
4250
3752
|
};
|
|
4251
|
-
|
|
4252
3753
|
return Plugin;
|
|
4253
3754
|
}(gLite.AbstractRendererPlugin);
|
|
4254
3755
|
|
|
@@ -4265,38 +3766,30 @@
|
|
|
4265
3766
|
this.canvasConfig = void 0;
|
|
4266
3767
|
this.canvasConfig = context.config;
|
|
4267
3768
|
}
|
|
4268
|
-
|
|
4269
3769
|
var _proto = SVGContextService.prototype;
|
|
4270
|
-
|
|
4271
3770
|
_proto.init = /*#__PURE__*/function () {
|
|
4272
3771
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
4273
3772
|
var _this$canvasConfig, container, doc, devicePixelRatio, $namespace, dpr;
|
|
4274
|
-
|
|
4275
3773
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4276
3774
|
while (1) {
|
|
4277
3775
|
switch (_context.prev = _context.next) {
|
|
4278
3776
|
case 0:
|
|
4279
3777
|
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document, devicePixelRatio = _this$canvasConfig.devicePixelRatio; // create container
|
|
4280
|
-
|
|
4281
3778
|
this.$container = isString(container) ? (doc || document).getElementById(container) : container;
|
|
4282
|
-
|
|
4283
3779
|
if (this.$container) {
|
|
4284
3780
|
if (!this.$container.style.position) {
|
|
4285
3781
|
this.$container.style.position = 'relative';
|
|
4286
3782
|
}
|
|
4287
|
-
|
|
4288
3783
|
$namespace = createSVGElement('svg', doc);
|
|
4289
3784
|
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
4290
3785
|
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
4291
3786
|
this.$container.appendChild($namespace);
|
|
4292
3787
|
this.$namespace = $namespace;
|
|
4293
|
-
}
|
|
4294
|
-
|
|
4295
|
-
|
|
3788
|
+
}
|
|
3789
|
+
// use user-defined dpr first
|
|
4296
3790
|
dpr = devicePixelRatio || gLite.isBrowser && window.devicePixelRatio || 1;
|
|
4297
3791
|
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
4298
3792
|
this.dpr = dpr;
|
|
4299
|
-
|
|
4300
3793
|
case 6:
|
|
4301
3794
|
case "end":
|
|
4302
3795
|
return _context.stop();
|
|
@@ -4304,40 +3797,31 @@
|
|
|
4304
3797
|
}
|
|
4305
3798
|
}, _callee, this);
|
|
4306
3799
|
}));
|
|
4307
|
-
|
|
4308
3800
|
function init() {
|
|
4309
3801
|
return _init.apply(this, arguments);
|
|
4310
3802
|
}
|
|
4311
|
-
|
|
4312
3803
|
return init;
|
|
4313
3804
|
}() // @ts-ignore
|
|
4314
3805
|
;
|
|
4315
|
-
|
|
4316
3806
|
_proto.getDomElement = function getDomElement() {
|
|
4317
3807
|
return this.$namespace;
|
|
4318
3808
|
};
|
|
4319
|
-
|
|
4320
3809
|
_proto.getContext = function getContext() {
|
|
4321
3810
|
return this.$namespace;
|
|
4322
3811
|
};
|
|
4323
|
-
|
|
4324
3812
|
_proto.getDPR = function getDPR() {
|
|
4325
3813
|
return this.dpr;
|
|
4326
3814
|
};
|
|
4327
|
-
|
|
4328
3815
|
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
4329
3816
|
var _this$$namespace;
|
|
4330
|
-
|
|
4331
3817
|
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
4332
3818
|
};
|
|
4333
|
-
|
|
4334
3819
|
_proto.destroy = function destroy() {
|
|
4335
3820
|
// destroy context
|
|
4336
3821
|
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
4337
3822
|
this.$container.removeChild(this.$namespace);
|
|
4338
3823
|
}
|
|
4339
3824
|
};
|
|
4340
|
-
|
|
4341
3825
|
_proto.resize = function resize(width, height) {
|
|
4342
3826
|
// SVG should ignore DPR
|
|
4343
3827
|
if (this.$namespace) {
|
|
@@ -4345,13 +3829,11 @@
|
|
|
4345
3829
|
this.$namespace.setAttribute('height', "" + height);
|
|
4346
3830
|
}
|
|
4347
3831
|
};
|
|
4348
|
-
|
|
4349
3832
|
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
|
|
4350
3833
|
if (this.$container) {
|
|
4351
3834
|
this.$container.style.cursor = cursor;
|
|
4352
3835
|
}
|
|
4353
3836
|
};
|
|
4354
|
-
|
|
4355
3837
|
_proto.toDataURL = /*#__PURE__*/function () {
|
|
4356
3838
|
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
4357
3839
|
var cloneNode, svgDocType, svgDoc;
|
|
@@ -4359,13 +3841,11 @@
|
|
|
4359
3841
|
while (1) {
|
|
4360
3842
|
switch (_context2.prev = _context2.next) {
|
|
4361
3843
|
case 0:
|
|
4362
|
-
|
|
4363
3844
|
cloneNode = this.$namespace.cloneNode(true);
|
|
4364
3845
|
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
4365
3846
|
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
4366
3847
|
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
4367
3848
|
return _context2.abrupt("return", "data:image/svg+xml;charset=utf8," + encodeURIComponent(new XMLSerializer().serializeToString(svgDoc)));
|
|
4368
|
-
|
|
4369
3849
|
case 6:
|
|
4370
3850
|
case "end":
|
|
4371
3851
|
return _context2.stop();
|
|
@@ -4373,71 +3853,52 @@
|
|
|
4373
3853
|
}
|
|
4374
3854
|
}, _callee2, this);
|
|
4375
3855
|
}));
|
|
4376
|
-
|
|
4377
3856
|
function toDataURL(_x) {
|
|
4378
3857
|
return _toDataURL.apply(this, arguments);
|
|
4379
3858
|
}
|
|
4380
|
-
|
|
4381
3859
|
return toDataURL;
|
|
4382
3860
|
}();
|
|
4383
|
-
|
|
4384
3861
|
return SVGContextService;
|
|
4385
3862
|
}();
|
|
4386
3863
|
|
|
4387
3864
|
var ContextRegisterPlugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
4388
3865
|
_inheritsLoose(ContextRegisterPlugin, _AbstractRendererPlug);
|
|
4389
|
-
|
|
4390
3866
|
function ContextRegisterPlugin() {
|
|
4391
3867
|
var _this;
|
|
4392
|
-
|
|
4393
3868
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4394
3869
|
args[_key] = arguments[_key];
|
|
4395
3870
|
}
|
|
4396
|
-
|
|
4397
3871
|
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
4398
3872
|
_this.name = 'svg-context-register';
|
|
4399
3873
|
return _this;
|
|
4400
3874
|
}
|
|
4401
|
-
|
|
4402
3875
|
var _proto = ContextRegisterPlugin.prototype;
|
|
4403
|
-
|
|
4404
3876
|
_proto.init = function init() {
|
|
4405
3877
|
// @ts-ignore
|
|
4406
3878
|
this.context.ContextService = SVGContextService;
|
|
4407
3879
|
};
|
|
4408
|
-
|
|
4409
3880
|
_proto.destroy = function destroy() {
|
|
4410
3881
|
delete this.context.ContextService;
|
|
4411
3882
|
};
|
|
4412
|
-
|
|
4413
3883
|
return ContextRegisterPlugin;
|
|
4414
3884
|
}(gLite.AbstractRendererPlugin);
|
|
4415
3885
|
|
|
4416
3886
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
4417
3887
|
_inheritsLoose(Renderer, _AbstractRenderer);
|
|
4418
|
-
|
|
4419
3888
|
function Renderer(config) {
|
|
4420
3889
|
var _this;
|
|
4421
|
-
|
|
4422
3890
|
if (config === void 0) {
|
|
4423
3891
|
config = {};
|
|
4424
3892
|
}
|
|
4425
|
-
|
|
4426
3893
|
_this = _AbstractRenderer.call(this, config) || this;
|
|
4427
|
-
|
|
4428
3894
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
4429
|
-
|
|
4430
3895
|
_this.registerPlugin(new Plugin$1({
|
|
4431
3896
|
outputSVGElementId: config.outputSVGElementId
|
|
4432
3897
|
}));
|
|
4433
|
-
|
|
4434
3898
|
_this.registerPlugin(new Plugin());
|
|
4435
|
-
|
|
4436
3899
|
_this.registerPlugin(new Plugin$2());
|
|
4437
|
-
|
|
4438
3900
|
return _this;
|
|
4439
3901
|
}
|
|
4440
|
-
|
|
4441
3902
|
return Renderer;
|
|
4442
3903
|
}(gLite.AbstractRenderer);
|
|
4443
3904
|
|