@antv/g-svg 1.8.23 → 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 +767 -1304
- 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
|
|
|
@@ -1001,42 +872,157 @@
|
|
|
1001
872
|
Plugin: Plugin
|
|
1002
873
|
});
|
|
1003
874
|
|
|
1004
|
-
|
|
1005
|
-
|
|
875
|
+
/**
|
|
876
|
+
* Common utilities
|
|
877
|
+
* @module glMatrix
|
|
878
|
+
*/
|
|
879
|
+
var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
|
|
880
|
+
if (!Math.hypot) Math.hypot = function () {
|
|
881
|
+
var y = 0,
|
|
882
|
+
i = arguments.length;
|
|
1006
883
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
*/
|
|
1013
|
-
return value === null || value === undefined;
|
|
884
|
+
while (i--) {
|
|
885
|
+
y += arguments[i] * arguments[i];
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
return Math.sqrt(y);
|
|
1014
889
|
};
|
|
1015
890
|
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
891
|
+
/**
|
|
892
|
+
* 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
|
|
893
|
+
* @module mat4
|
|
894
|
+
*/
|
|
1019
895
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
return max;
|
|
1026
|
-
}
|
|
1027
|
-
return a;
|
|
1028
|
-
};
|
|
896
|
+
/**
|
|
897
|
+
* Creates a new identity mat4
|
|
898
|
+
*
|
|
899
|
+
* @returns {mat4} a new 4x4 matrix
|
|
900
|
+
*/
|
|
1029
901
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
902
|
+
function create() {
|
|
903
|
+
var out = new ARRAY_TYPE(16);
|
|
904
|
+
|
|
905
|
+
if (ARRAY_TYPE != Float32Array) {
|
|
906
|
+
out[1] = 0;
|
|
907
|
+
out[2] = 0;
|
|
908
|
+
out[3] = 0;
|
|
909
|
+
out[4] = 0;
|
|
910
|
+
out[6] = 0;
|
|
911
|
+
out[7] = 0;
|
|
912
|
+
out[8] = 0;
|
|
913
|
+
out[9] = 0;
|
|
914
|
+
out[11] = 0;
|
|
915
|
+
out[12] = 0;
|
|
916
|
+
out[13] = 0;
|
|
917
|
+
out[14] = 0;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
out[0] = 1;
|
|
921
|
+
out[5] = 1;
|
|
922
|
+
out[10] = 1;
|
|
923
|
+
out[15] = 1;
|
|
924
|
+
return out;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Inverts a mat4
|
|
928
|
+
*
|
|
929
|
+
* @param {mat4} out the receiving matrix
|
|
930
|
+
* @param {ReadonlyMat4} a the source matrix
|
|
931
|
+
* @returns {mat4} out
|
|
932
|
+
*/
|
|
933
|
+
|
|
934
|
+
function invert(out, a) {
|
|
935
|
+
var a00 = a[0],
|
|
936
|
+
a01 = a[1],
|
|
937
|
+
a02 = a[2],
|
|
938
|
+
a03 = a[3];
|
|
939
|
+
var a10 = a[4],
|
|
940
|
+
a11 = a[5],
|
|
941
|
+
a12 = a[6],
|
|
942
|
+
a13 = a[7];
|
|
943
|
+
var a20 = a[8],
|
|
944
|
+
a21 = a[9],
|
|
945
|
+
a22 = a[10],
|
|
946
|
+
a23 = a[11];
|
|
947
|
+
var a30 = a[12],
|
|
948
|
+
a31 = a[13],
|
|
949
|
+
a32 = a[14],
|
|
950
|
+
a33 = a[15];
|
|
951
|
+
var b00 = a00 * a11 - a01 * a10;
|
|
952
|
+
var b01 = a00 * a12 - a02 * a10;
|
|
953
|
+
var b02 = a00 * a13 - a03 * a10;
|
|
954
|
+
var b03 = a01 * a12 - a02 * a11;
|
|
955
|
+
var b04 = a01 * a13 - a03 * a11;
|
|
956
|
+
var b05 = a02 * a13 - a03 * a12;
|
|
957
|
+
var b06 = a20 * a31 - a21 * a30;
|
|
958
|
+
var b07 = a20 * a32 - a22 * a30;
|
|
959
|
+
var b08 = a20 * a33 - a23 * a30;
|
|
960
|
+
var b09 = a21 * a32 - a22 * a31;
|
|
961
|
+
var b10 = a21 * a33 - a23 * a31;
|
|
962
|
+
var b11 = a22 * a33 - a23 * a32; // Calculate the determinant
|
|
963
|
+
|
|
964
|
+
var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
|
|
965
|
+
|
|
966
|
+
if (!det) {
|
|
967
|
+
return null;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
det = 1.0 / det;
|
|
971
|
+
out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
|
|
972
|
+
out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
|
|
973
|
+
out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
|
|
974
|
+
out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
|
|
975
|
+
out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
|
|
976
|
+
out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
|
|
977
|
+
out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
|
|
978
|
+
out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
|
|
979
|
+
out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
|
|
980
|
+
out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
|
|
981
|
+
out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
|
|
982
|
+
out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
|
|
983
|
+
out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
|
|
984
|
+
out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
|
|
985
|
+
out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
|
|
986
|
+
out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
|
|
987
|
+
return out;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
// isFinite,
|
|
991
|
+
var isNil = function (value) {
|
|
992
|
+
/**
|
|
993
|
+
* isNil(null) => true
|
|
994
|
+
* isNil() => true
|
|
995
|
+
*/
|
|
996
|
+
return value === null || value === undefined;
|
|
997
|
+
};
|
|
998
|
+
|
|
999
|
+
var toString = {}.toString;
|
|
1000
|
+
var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
|
|
1001
|
+
|
|
1002
|
+
var isString = (function (str) {
|
|
1003
|
+
return isType(str, 'String');
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
var clamp = function (a, min, max) {
|
|
1007
|
+
if (a < min) {
|
|
1008
|
+
return min;
|
|
1009
|
+
}
|
|
1010
|
+
else if (a > max) {
|
|
1011
|
+
return max;
|
|
1012
|
+
}
|
|
1013
|
+
return a;
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
|
|
1017
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1018
|
+
if (ar || !(i in from)) {
|
|
1019
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1020
|
+
ar[i] = from[i];
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1024
|
+
};
|
|
1025
|
+
var BrowserInfo = /** @class */ (function () {
|
|
1040
1026
|
function BrowserInfo(name, version, os) {
|
|
1041
1027
|
this.name = name;
|
|
1042
1028
|
this.version = version;
|
|
@@ -1234,19 +1220,19 @@
|
|
|
1234
1220
|
}
|
|
1235
1221
|
|
|
1236
1222
|
function _regeneratorRuntime$2() {
|
|
1237
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
1238
1223
|
_regeneratorRuntime$2 = function _regeneratorRuntime() {
|
|
1239
1224
|
return exports;
|
|
1240
1225
|
};
|
|
1241
|
-
|
|
1242
1226
|
var exports = {},
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
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";
|
|
1250
1236
|
function define(obj, key, value) {
|
|
1251
1237
|
return Object.defineProperty(obj, key, {
|
|
1252
1238
|
value: value,
|
|
@@ -1255,7 +1241,6 @@
|
|
|
1255
1241
|
writable: !0
|
|
1256
1242
|
}), obj[key];
|
|
1257
1243
|
}
|
|
1258
|
-
|
|
1259
1244
|
try {
|
|
1260
1245
|
define({}, "");
|
|
1261
1246
|
} catch (err) {
|
|
@@ -1263,54 +1248,14 @@
|
|
|
1263
1248
|
return obj[key] = value;
|
|
1264
1249
|
};
|
|
1265
1250
|
}
|
|
1266
|
-
|
|
1267
1251
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
1268
1252
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
return generator
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
1275
|
-
|
|
1276
|
-
if ("completed" === state) {
|
|
1277
|
-
if ("throw" === method) throw arg;
|
|
1278
|
-
return doneResult();
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
for (context.method = method, context.arg = arg;;) {
|
|
1282
|
-
var delegate = context.delegate;
|
|
1283
|
-
|
|
1284
|
-
if (delegate) {
|
|
1285
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
1286
|
-
|
|
1287
|
-
if (delegateResult) {
|
|
1288
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
1289
|
-
return delegateResult;
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
1294
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
1295
|
-
context.dispatchException(context.arg);
|
|
1296
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
1297
|
-
state = "executing";
|
|
1298
|
-
var record = tryCatch(innerFn, self, context);
|
|
1299
|
-
|
|
1300
|
-
if ("normal" === record.type) {
|
|
1301
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
1302
|
-
return {
|
|
1303
|
-
value: record.arg,
|
|
1304
|
-
done: context.done
|
|
1305
|
-
};
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
1309
|
-
}
|
|
1310
|
-
};
|
|
1311
|
-
}(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;
|
|
1312
1258
|
}
|
|
1313
|
-
|
|
1314
1259
|
function tryCatch(fn, obj, arg) {
|
|
1315
1260
|
try {
|
|
1316
1261
|
return {
|
|
@@ -1324,25 +1269,19 @@
|
|
|
1324
1269
|
};
|
|
1325
1270
|
}
|
|
1326
1271
|
}
|
|
1327
|
-
|
|
1328
1272
|
exports.wrap = wrap;
|
|
1329
1273
|
var ContinueSentinel = {};
|
|
1330
|
-
|
|
1331
1274
|
function Generator() {}
|
|
1332
|
-
|
|
1333
1275
|
function GeneratorFunction() {}
|
|
1334
|
-
|
|
1335
1276
|
function GeneratorFunctionPrototype() {}
|
|
1336
|
-
|
|
1337
1277
|
var IteratorPrototype = {};
|
|
1338
1278
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
1339
1279
|
return this;
|
|
1340
1280
|
});
|
|
1341
1281
|
var getProto = Object.getPrototypeOf,
|
|
1342
|
-
|
|
1282
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1343
1283
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
1344
1284
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1345
|
-
|
|
1346
1285
|
function defineIteratorMethods(prototype) {
|
|
1347
1286
|
["next", "throw", "return"].forEach(function (method) {
|
|
1348
1287
|
define(prototype, method, function (arg) {
|
|
@@ -1350,14 +1289,12 @@
|
|
|
1350
1289
|
});
|
|
1351
1290
|
});
|
|
1352
1291
|
}
|
|
1353
|
-
|
|
1354
1292
|
function AsyncIterator(generator, PromiseImpl) {
|
|
1355
1293
|
function invoke(method, arg, resolve, reject) {
|
|
1356
1294
|
var record = tryCatch(generator[method], generator, arg);
|
|
1357
|
-
|
|
1358
1295
|
if ("throw" !== record.type) {
|
|
1359
1296
|
var result = record.arg,
|
|
1360
|
-
|
|
1297
|
+
value = result.value;
|
|
1361
1298
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
1362
1299
|
invoke("next", value, resolve, reject);
|
|
1363
1300
|
}, function (err) {
|
|
@@ -1368,92 +1305,116 @@
|
|
|
1368
1305
|
return invoke("throw", error, resolve, reject);
|
|
1369
1306
|
});
|
|
1370
1307
|
}
|
|
1371
|
-
|
|
1372
1308
|
reject(record.arg);
|
|
1373
1309
|
}
|
|
1374
|
-
|
|
1375
1310
|
var previousPromise;
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
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);
|
|
1382
1353
|
}
|
|
1383
|
-
|
|
1384
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1385
1354
|
};
|
|
1386
1355
|
}
|
|
1387
|
-
|
|
1388
1356
|
function maybeInvokeDelegate(delegate, context) {
|
|
1389
1357
|
var method = delegate.iterator[context.method];
|
|
1390
|
-
|
|
1391
1358
|
if (undefined === method) {
|
|
1392
1359
|
if (context.delegate = null, "throw" === context.method) {
|
|
1393
1360
|
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
1394
1361
|
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
1395
1362
|
}
|
|
1396
|
-
|
|
1397
1363
|
return ContinueSentinel;
|
|
1398
1364
|
}
|
|
1399
|
-
|
|
1400
1365
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
1401
1366
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
1402
1367
|
var info = record.arg;
|
|
1403
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);
|
|
1404
1369
|
}
|
|
1405
|
-
|
|
1406
1370
|
function pushTryEntry(locs) {
|
|
1407
1371
|
var entry = {
|
|
1408
1372
|
tryLoc: locs[0]
|
|
1409
1373
|
};
|
|
1410
1374
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
1411
1375
|
}
|
|
1412
|
-
|
|
1413
1376
|
function resetTryEntry(entry) {
|
|
1414
1377
|
var record = entry.completion || {};
|
|
1415
1378
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
1416
1379
|
}
|
|
1417
|
-
|
|
1418
1380
|
function Context(tryLocsList) {
|
|
1419
1381
|
this.tryEntries = [{
|
|
1420
1382
|
tryLoc: "root"
|
|
1421
1383
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
1422
1384
|
}
|
|
1423
|
-
|
|
1424
1385
|
function values(iterable) {
|
|
1425
1386
|
if (iterable) {
|
|
1426
1387
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
1427
1388
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
1428
1389
|
if ("function" == typeof iterable.next) return iterable;
|
|
1429
|
-
|
|
1430
1390
|
if (!isNaN(iterable.length)) {
|
|
1431
1391
|
var i = -1,
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
};
|
|
1439
|
-
|
|
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
|
+
};
|
|
1440
1398
|
return next.next = next;
|
|
1441
1399
|
}
|
|
1442
1400
|
}
|
|
1443
|
-
|
|
1444
1401
|
return {
|
|
1445
1402
|
next: doneResult
|
|
1446
1403
|
};
|
|
1447
1404
|
}
|
|
1448
|
-
|
|
1449
1405
|
function doneResult() {
|
|
1450
1406
|
return {
|
|
1451
1407
|
value: undefined,
|
|
1452
1408
|
done: !0
|
|
1453
1409
|
};
|
|
1454
1410
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
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) {
|
|
1457
1418
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
1458
1419
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
1459
1420
|
}, exports.mark = function (genFun) {
|
|
@@ -1474,19 +1435,17 @@
|
|
|
1474
1435
|
return this;
|
|
1475
1436
|
}), define(Gp, "toString", function () {
|
|
1476
1437
|
return "[object Generator]";
|
|
1477
|
-
}), exports.keys = function (
|
|
1478
|
-
var
|
|
1479
|
-
|
|
1438
|
+
}), exports.keys = function (val) {
|
|
1439
|
+
var object = Object(val),
|
|
1440
|
+
keys = [];
|
|
1480
1441
|
for (var key in object) {
|
|
1481
1442
|
keys.push(key);
|
|
1482
1443
|
}
|
|
1483
|
-
|
|
1484
1444
|
return keys.reverse(), function next() {
|
|
1485
1445
|
for (; keys.length;) {
|
|
1486
1446
|
var key = keys.pop();
|
|
1487
1447
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
1488
1448
|
}
|
|
1489
|
-
|
|
1490
1449
|
return next.done = !0, next;
|
|
1491
1450
|
};
|
|
1492
1451
|
}, exports.values = values, Context.prototype = {
|
|
@@ -1505,20 +1464,16 @@
|
|
|
1505
1464
|
dispatchException: function dispatchException(exception) {
|
|
1506
1465
|
if (this.done) throw exception;
|
|
1507
1466
|
var context = this;
|
|
1508
|
-
|
|
1509
1467
|
function handle(loc, caught) {
|
|
1510
1468
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
1511
1469
|
}
|
|
1512
|
-
|
|
1513
1470
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1514
1471
|
var entry = this.tryEntries[i],
|
|
1515
|
-
|
|
1472
|
+
record = entry.completion;
|
|
1516
1473
|
if ("root" === entry.tryLoc) return handle("end");
|
|
1517
|
-
|
|
1518
1474
|
if (entry.tryLoc <= this.prev) {
|
|
1519
1475
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
1520
|
-
|
|
1521
|
-
|
|
1476
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1522
1477
|
if (hasCatch && hasFinally) {
|
|
1523
1478
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1524
1479
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -1534,13 +1489,11 @@
|
|
|
1534
1489
|
abrupt: function abrupt(type, arg) {
|
|
1535
1490
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1536
1491
|
var entry = this.tryEntries[i];
|
|
1537
|
-
|
|
1538
1492
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1539
1493
|
var finallyEntry = entry;
|
|
1540
1494
|
break;
|
|
1541
1495
|
}
|
|
1542
1496
|
}
|
|
1543
|
-
|
|
1544
1497
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
1545
1498
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1546
1499
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -1558,19 +1511,15 @@
|
|
|
1558
1511
|
catch: function _catch(tryLoc) {
|
|
1559
1512
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1560
1513
|
var entry = this.tryEntries[i];
|
|
1561
|
-
|
|
1562
1514
|
if (entry.tryLoc === tryLoc) {
|
|
1563
1515
|
var record = entry.completion;
|
|
1564
|
-
|
|
1565
1516
|
if ("throw" === record.type) {
|
|
1566
1517
|
var thrown = record.arg;
|
|
1567
1518
|
resetTryEntry(entry);
|
|
1568
1519
|
}
|
|
1569
|
-
|
|
1570
1520
|
return thrown;
|
|
1571
1521
|
}
|
|
1572
1522
|
}
|
|
1573
|
-
|
|
1574
1523
|
throw new Error("illegal catch attempt");
|
|
1575
1524
|
},
|
|
1576
1525
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -1582,7 +1531,6 @@
|
|
|
1582
1531
|
}
|
|
1583
1532
|
}, exports;
|
|
1584
1533
|
}
|
|
1585
|
-
|
|
1586
1534
|
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1587
1535
|
try {
|
|
1588
1536
|
var info = gen[key](arg);
|
|
@@ -1591,58 +1539,47 @@
|
|
|
1591
1539
|
reject(error);
|
|
1592
1540
|
return;
|
|
1593
1541
|
}
|
|
1594
|
-
|
|
1595
1542
|
if (info.done) {
|
|
1596
1543
|
resolve(value);
|
|
1597
1544
|
} else {
|
|
1598
1545
|
Promise.resolve(value).then(_next, _throw);
|
|
1599
1546
|
}
|
|
1600
1547
|
}
|
|
1601
|
-
|
|
1602
1548
|
function _asyncToGenerator$2(fn) {
|
|
1603
1549
|
return function () {
|
|
1604
1550
|
var self = this,
|
|
1605
|
-
|
|
1551
|
+
args = arguments;
|
|
1606
1552
|
return new Promise(function (resolve, reject) {
|
|
1607
1553
|
var gen = fn.apply(self, args);
|
|
1608
|
-
|
|
1609
1554
|
function _next(value) {
|
|
1610
1555
|
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
1611
1556
|
}
|
|
1612
|
-
|
|
1613
1557
|
function _throw(err) {
|
|
1614
1558
|
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1615
1559
|
}
|
|
1616
|
-
|
|
1617
1560
|
_next(undefined);
|
|
1618
1561
|
});
|
|
1619
1562
|
};
|
|
1620
1563
|
}
|
|
1621
|
-
|
|
1622
1564
|
function _extends() {
|
|
1623
1565
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1624
1566
|
for (var i = 1; i < arguments.length; i++) {
|
|
1625
1567
|
var source = arguments[i];
|
|
1626
|
-
|
|
1627
1568
|
for (var key in source) {
|
|
1628
1569
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1629
1570
|
target[key] = source[key];
|
|
1630
1571
|
}
|
|
1631
1572
|
}
|
|
1632
1573
|
}
|
|
1633
|
-
|
|
1634
1574
|
return target;
|
|
1635
1575
|
};
|
|
1636
1576
|
return _extends.apply(this, arguments);
|
|
1637
1577
|
}
|
|
1638
|
-
|
|
1639
1578
|
function _inheritsLoose$2(subClass, superClass) {
|
|
1640
1579
|
subClass.prototype = Object.create(superClass.prototype);
|
|
1641
1580
|
subClass.prototype.constructor = subClass;
|
|
1642
|
-
|
|
1643
1581
|
_setPrototypeOf$2(subClass, superClass);
|
|
1644
1582
|
}
|
|
1645
|
-
|
|
1646
1583
|
function _setPrototypeOf$2(o, p) {
|
|
1647
1584
|
_setPrototypeOf$2 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
1648
1585
|
o.__proto__ = p;
|
|
@@ -1650,78 +1587,77 @@
|
|
|
1650
1587
|
};
|
|
1651
1588
|
return _setPrototypeOf$2(o, p);
|
|
1652
1589
|
}
|
|
1653
|
-
|
|
1654
1590
|
var ElementSVG = function ElementSVG() {
|
|
1655
1591
|
this.$el = void 0;
|
|
1656
1592
|
this.$groupEl = void 0;
|
|
1657
1593
|
this.$hitTestingEl = void 0;
|
|
1658
1594
|
};
|
|
1659
|
-
|
|
1660
1595
|
ElementSVG.tag = 'c-svg-element';
|
|
1661
|
-
|
|
1662
1596
|
function updateImageElementAttribute($el, parsedStyle) {
|
|
1663
1597
|
var _parsedStyle$img = parsedStyle.img,
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1598
|
+
img = _parsedStyle$img === void 0 ? '' : _parsedStyle$img,
|
|
1599
|
+
width = parsedStyle.width,
|
|
1600
|
+
height = parsedStyle.height;
|
|
1667
1601
|
$el.setAttribute('x', '0');
|
|
1668
1602
|
$el.setAttribute('y', '0');
|
|
1669
|
-
|
|
1670
1603
|
if (isString(img)) {
|
|
1671
1604
|
$el.setAttribute('href', img);
|
|
1672
1605
|
} else if (img instanceof Image) {
|
|
1673
1606
|
if (!width) {
|
|
1674
|
-
$el.setAttribute('width', "" + img.width);
|
|
1607
|
+
$el.setAttribute('width', "" + img.width);
|
|
1608
|
+
// TODO: set renderable.boundsDirty
|
|
1675
1609
|
// this.attr('width', img.width);
|
|
1676
1610
|
}
|
|
1677
1611
|
|
|
1678
1612
|
if (!height) {
|
|
1679
|
-
$el.setAttribute('height', "" + img.height);
|
|
1613
|
+
$el.setAttribute('height', "" + img.height);
|
|
1614
|
+
// this.attr('height', img.height);
|
|
1680
1615
|
}
|
|
1681
1616
|
|
|
1682
1617
|
$el.setAttribute('href', img.src);
|
|
1683
|
-
} else if (
|
|
1618
|
+
} else if (
|
|
1619
|
+
// @ts-ignore
|
|
1684
1620
|
img instanceof HTMLElement && isString(img.nodeName) && img.nodeName.toUpperCase() === 'CANVAS') {
|
|
1685
|
-
$el.setAttribute('href', img.toDataURL());
|
|
1621
|
+
$el.setAttribute('href', img.toDataURL());
|
|
1622
|
+
// @ts-ignore
|
|
1686
1623
|
} else if (img instanceof ImageData) {
|
|
1687
|
-
var canvas = document.createElement('canvas');
|
|
1688
|
-
|
|
1689
|
-
canvas.setAttribute('width', "" + img.width);
|
|
1690
|
-
|
|
1624
|
+
var canvas = document.createElement('canvas');
|
|
1625
|
+
// @ts-ignore
|
|
1626
|
+
canvas.setAttribute('width', "" + img.width);
|
|
1627
|
+
// @ts-ignore
|
|
1691
1628
|
canvas.setAttribute('height', "" + img.height);
|
|
1692
1629
|
var context = canvas.getContext('2d');
|
|
1693
|
-
|
|
1694
1630
|
if (context) {
|
|
1695
1631
|
context.putImageData(img, 0, 0);
|
|
1696
|
-
|
|
1697
1632
|
if (!width) {
|
|
1698
1633
|
// @ts-ignore
|
|
1699
|
-
$el.setAttribute('width', "" + img.width);
|
|
1634
|
+
$el.setAttribute('width', "" + img.width);
|
|
1635
|
+
// this.attr('width', img.width);
|
|
1700
1636
|
}
|
|
1701
1637
|
|
|
1702
1638
|
if (!height) {
|
|
1703
1639
|
// @ts-ignore
|
|
1704
|
-
$el.setAttribute('height', "" + img.height);
|
|
1640
|
+
$el.setAttribute('height', "" + img.height);
|
|
1641
|
+
// this.attr('height', img.height);
|
|
1705
1642
|
}
|
|
1706
1643
|
|
|
1707
1644
|
$el.setAttribute('href', canvas.toDataURL());
|
|
1708
1645
|
}
|
|
1709
1646
|
}
|
|
1710
1647
|
}
|
|
1711
|
-
|
|
1712
1648
|
function updateLineElementAttribute($el, parsedStyle) {
|
|
1713
1649
|
var x1 = parsedStyle.x1,
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
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;
|
|
1725
1661
|
var startOffsetX = 0;
|
|
1726
1662
|
var startOffsetY = 0;
|
|
1727
1663
|
var endOffsetX = 0;
|
|
@@ -1729,7 +1665,6 @@
|
|
|
1729
1665
|
var rad = 0;
|
|
1730
1666
|
var x;
|
|
1731
1667
|
var y;
|
|
1732
|
-
|
|
1733
1668
|
if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
|
|
1734
1669
|
x = x2 - x1;
|
|
1735
1670
|
y = y2 - y1;
|
|
@@ -1737,32 +1672,29 @@
|
|
|
1737
1672
|
startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
|
|
1738
1673
|
startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
|
|
1739
1674
|
}
|
|
1740
|
-
|
|
1741
1675
|
if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
|
|
1742
1676
|
x = x1 - x2;
|
|
1743
1677
|
y = y1 - y2;
|
|
1744
1678
|
rad = Math.atan2(y, x);
|
|
1745
1679
|
endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
|
|
1746
1680
|
endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
|
|
1681
|
+
}
|
|
1682
|
+
// @see https://github.com/antvis/g/issues/1038
|
|
1750
1683
|
$el.setAttribute('x1', "" + (x1 - defX + startOffsetX));
|
|
1751
1684
|
$el.setAttribute('y1', "" + (y1 - defY + startOffsetY));
|
|
1752
1685
|
$el.setAttribute('x2', "" + (x2 - defX + endOffsetX));
|
|
1753
1686
|
$el.setAttribute('y2', "" + (y2 - defY + endOffsetY));
|
|
1754
1687
|
}
|
|
1755
|
-
|
|
1756
1688
|
function updatePathElementAttribute($el, parsedStyle) {
|
|
1757
1689
|
var path = parsedStyle.path,
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
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;
|
|
1766
1698
|
var startOffsetX = 0;
|
|
1767
1699
|
var startOffsetY = 0;
|
|
1768
1700
|
var endOffsetX = 0;
|
|
@@ -1770,49 +1702,39 @@
|
|
|
1770
1702
|
var rad = 0;
|
|
1771
1703
|
var x;
|
|
1772
1704
|
var y;
|
|
1773
|
-
|
|
1774
1705
|
if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
|
|
1775
1706
|
var _markerStart$parentNo = markerStart.parentNode.getStartTangent(),
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1707
|
+
p1 = _markerStart$parentNo[0],
|
|
1708
|
+
p2 = _markerStart$parentNo[1];
|
|
1779
1709
|
x = p1[0] - p2[0];
|
|
1780
1710
|
y = p1[1] - p2[1];
|
|
1781
1711
|
rad = Math.atan2(y, x);
|
|
1782
1712
|
startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
|
|
1783
1713
|
startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
|
|
1784
1714
|
}
|
|
1785
|
-
|
|
1786
|
-
var useMarkerEnd = false;
|
|
1787
|
-
|
|
1788
1715
|
if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
|
|
1789
1716
|
var _markerEnd$parentNode = markerEnd.parentNode.getEndTangent(),
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1717
|
+
_p = _markerEnd$parentNode[0],
|
|
1718
|
+
_p2 = _markerEnd$parentNode[1];
|
|
1793
1719
|
x = _p[0] - _p2[0];
|
|
1794
1720
|
y = _p[1] - _p2[1];
|
|
1795
1721
|
rad = Math.atan2(y, x);
|
|
1796
1722
|
endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
|
|
1797
1723
|
endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
|
|
1798
|
-
useMarkerEnd = true;
|
|
1799
1724
|
}
|
|
1800
|
-
|
|
1801
|
-
$el.setAttribute('d', gLite.translatePathToString(!useMarkerEnd ? path.absolutePath : path.curve, defX, defY, startOffsetX, startOffsetY, endOffsetX, endOffsetY));
|
|
1725
|
+
$el.setAttribute('d', gLite.translatePathToString(path.absolutePath, defX, defY, startOffsetX, startOffsetY, endOffsetX, endOffsetY));
|
|
1802
1726
|
}
|
|
1803
|
-
|
|
1804
1727
|
function updatePolylineElementAttribute($el, parsedStyle) {
|
|
1805
1728
|
var points = parsedStyle.points.points,
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
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;
|
|
1814
1737
|
var length = points.length;
|
|
1815
|
-
|
|
1816
1738
|
if (points && length >= 2) {
|
|
1817
1739
|
var startOffsetX = 0;
|
|
1818
1740
|
var startOffsetY = 0;
|
|
@@ -1821,7 +1743,6 @@
|
|
|
1821
1743
|
var rad = 0;
|
|
1822
1744
|
var x;
|
|
1823
1745
|
var y;
|
|
1824
|
-
|
|
1825
1746
|
if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
|
|
1826
1747
|
x = points[1][0] - points[0][0];
|
|
1827
1748
|
y = points[1][1] - points[0][1];
|
|
@@ -1829,7 +1750,6 @@
|
|
|
1829
1750
|
startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
|
|
1830
1751
|
startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
|
|
1831
1752
|
}
|
|
1832
|
-
|
|
1833
1753
|
if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
|
|
1834
1754
|
x = points[length - 2][0] - points[length - 1][0];
|
|
1835
1755
|
y = points[length - 2][1] - points[length - 1][1];
|
|
@@ -1837,11 +1757,9 @@
|
|
|
1837
1757
|
endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
|
|
1838
1758
|
endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
|
|
1839
1759
|
}
|
|
1840
|
-
|
|
1841
1760
|
$el.setAttribute('points', points.map(function (point, i) {
|
|
1842
1761
|
var offsetX = 0;
|
|
1843
1762
|
var offsetY = 0;
|
|
1844
|
-
|
|
1845
1763
|
if (i === 0) {
|
|
1846
1764
|
offsetX = startOffsetX;
|
|
1847
1765
|
offsetY = startOffsetY;
|
|
@@ -1849,171 +1767,46 @@
|
|
|
1849
1767
|
offsetX = endOffsetX;
|
|
1850
1768
|
offsetY = endOffsetY;
|
|
1851
1769
|
}
|
|
1852
|
-
|
|
1853
1770
|
return point[0] - defX + offsetX + "," + (point[1] - defY + offsetY);
|
|
1854
1771
|
}).join(' '));
|
|
1855
1772
|
}
|
|
1856
1773
|
}
|
|
1857
|
-
|
|
1858
1774
|
function updateRectElementAttribute($el, parsedStyle) {
|
|
1859
1775
|
var radius = parsedStyle.radius,
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1776
|
+
width = parsedStyle.width,
|
|
1777
|
+
height = parsedStyle.height;
|
|
1778
|
+
// CSSKeyword: auto
|
|
1863
1779
|
if (!isFinite(width) || !isFinite(height)) {
|
|
1864
|
-
return;
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
var
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
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(' ');
|
|
1888
|
-
}
|
|
1889
|
-
|
|
1890
|
-
$el.setAttribute('d', d);
|
|
1891
|
-
}
|
|
1892
|
-
/**
|
|
1893
|
-
* Common utilities
|
|
1894
|
-
* @module glMatrix
|
|
1895
|
-
*/
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
|
|
1899
|
-
if (!Math.hypot) Math.hypot = function () {
|
|
1900
|
-
var y = 0,
|
|
1901
|
-
i = arguments.length;
|
|
1902
|
-
|
|
1903
|
-
while (i--) {
|
|
1904
|
-
y += arguments[i] * arguments[i];
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
return Math.sqrt(y);
|
|
1908
|
-
};
|
|
1909
|
-
/**
|
|
1910
|
-
* 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
|
|
1911
|
-
* @module mat4
|
|
1912
|
-
*/
|
|
1913
|
-
|
|
1914
|
-
/**
|
|
1915
|
-
* Creates a new identity mat4
|
|
1916
|
-
*
|
|
1917
|
-
* @returns {mat4} a new 4x4 matrix
|
|
1918
|
-
*/
|
|
1919
|
-
|
|
1920
|
-
function create() {
|
|
1921
|
-
var out = new ARRAY_TYPE(16);
|
|
1922
|
-
|
|
1923
|
-
if (ARRAY_TYPE != Float32Array) {
|
|
1924
|
-
out[1] = 0;
|
|
1925
|
-
out[2] = 0;
|
|
1926
|
-
out[3] = 0;
|
|
1927
|
-
out[4] = 0;
|
|
1928
|
-
out[6] = 0;
|
|
1929
|
-
out[7] = 0;
|
|
1930
|
-
out[8] = 0;
|
|
1931
|
-
out[9] = 0;
|
|
1932
|
-
out[11] = 0;
|
|
1933
|
-
out[12] = 0;
|
|
1934
|
-
out[13] = 0;
|
|
1935
|
-
out[14] = 0;
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
out[0] = 1;
|
|
1939
|
-
out[5] = 1;
|
|
1940
|
-
out[10] = 1;
|
|
1941
|
-
out[15] = 1;
|
|
1942
|
-
return out;
|
|
1943
|
-
}
|
|
1944
|
-
/**
|
|
1945
|
-
* Inverts a mat4
|
|
1946
|
-
*
|
|
1947
|
-
* @param {mat4} out the receiving matrix
|
|
1948
|
-
* @param {ReadonlyMat4} a the source matrix
|
|
1949
|
-
* @returns {mat4} out
|
|
1950
|
-
*/
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
function invert(out, a) {
|
|
1954
|
-
var a00 = a[0],
|
|
1955
|
-
a01 = a[1],
|
|
1956
|
-
a02 = a[2],
|
|
1957
|
-
a03 = a[3];
|
|
1958
|
-
var a10 = a[4],
|
|
1959
|
-
a11 = a[5],
|
|
1960
|
-
a12 = a[6],
|
|
1961
|
-
a13 = a[7];
|
|
1962
|
-
var a20 = a[8],
|
|
1963
|
-
a21 = a[9],
|
|
1964
|
-
a22 = a[10],
|
|
1965
|
-
a23 = a[11];
|
|
1966
|
-
var a30 = a[12],
|
|
1967
|
-
a31 = a[13],
|
|
1968
|
-
a32 = a[14],
|
|
1969
|
-
a33 = a[15];
|
|
1970
|
-
var b00 = a00 * a11 - a01 * a10;
|
|
1971
|
-
var b01 = a00 * a12 - a02 * a10;
|
|
1972
|
-
var b02 = a00 * a13 - a03 * a10;
|
|
1973
|
-
var b03 = a01 * a12 - a02 * a11;
|
|
1974
|
-
var b04 = a01 * a13 - a03 * a11;
|
|
1975
|
-
var b05 = a02 * a13 - a03 * a12;
|
|
1976
|
-
var b06 = a20 * a31 - a21 * a30;
|
|
1977
|
-
var b07 = a20 * a32 - a22 * a30;
|
|
1978
|
-
var b08 = a20 * a33 - a23 * a30;
|
|
1979
|
-
var b09 = a21 * a32 - a22 * a31;
|
|
1980
|
-
var b10 = a21 * a33 - a23 * a31;
|
|
1981
|
-
var b11 = a22 * a33 - a23 * a32; // Calculate the determinant
|
|
1982
|
-
|
|
1983
|
-
var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
|
|
1984
|
-
|
|
1985
|
-
if (!det) {
|
|
1986
|
-
return null;
|
|
1987
|
-
}
|
|
1988
|
-
|
|
1989
|
-
det = 1.0 / det;
|
|
1990
|
-
out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
|
|
1991
|
-
out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
|
|
1992
|
-
out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
|
|
1993
|
-
out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
|
|
1994
|
-
out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
|
|
1995
|
-
out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
|
|
1996
|
-
out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
|
|
1997
|
-
out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
|
|
1998
|
-
out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
|
|
1999
|
-
out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
|
|
2000
|
-
out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
|
|
2001
|
-
out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
|
|
2002
|
-
out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
|
|
2003
|
-
out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
|
|
2004
|
-
out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
|
|
2005
|
-
out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
|
|
2006
|
-
return out;
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
var hasRadius = radius && radius.some(function (r) {
|
|
1783
|
+
return r !== 0;
|
|
1784
|
+
});
|
|
1785
|
+
var d = '';
|
|
1786
|
+
if (!hasRadius) {
|
|
1787
|
+
d = "M 0,0 l " + width + ",0 l 0," + height + " l" + -width + " 0 z";
|
|
1788
|
+
} else {
|
|
1789
|
+
var _radius$map = radius.map(function (r) {
|
|
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];
|
|
1796
|
+
var signX = width > 0 ? 1 : -1;
|
|
1797
|
+
var signY = height > 0 ? 1 : -1;
|
|
1798
|
+
// sweep-flag @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Paths#arcs
|
|
1799
|
+
var sweepFlag = signX + signY !== 0 ? 1 : 0;
|
|
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(' ');
|
|
1801
|
+
}
|
|
1802
|
+
$el.setAttribute('d', d);
|
|
2007
1803
|
}
|
|
2008
|
-
|
|
2009
1804
|
function createSVGElement(type, doc) {
|
|
2010
1805
|
return (doc || document).createElementNS('http://www.w3.org/2000/svg', type);
|
|
2011
1806
|
}
|
|
2012
|
-
|
|
2013
1807
|
function numberToLongString(x) {
|
|
2014
1808
|
return x.toFixed(6).replace('.000000', '');
|
|
2015
1809
|
}
|
|
2016
|
-
|
|
2017
1810
|
function convertHTML(str) {
|
|
2018
1811
|
var regex = /[&|<|>|"|']/g;
|
|
2019
1812
|
return str.replace(regex, function (match) {
|
|
@@ -2030,7 +1823,6 @@
|
|
|
2030
1823
|
}
|
|
2031
1824
|
});
|
|
2032
1825
|
}
|
|
2033
|
-
|
|
2034
1826
|
var SVG_ATTR_MAP = {
|
|
2035
1827
|
opacity: 'opacity',
|
|
2036
1828
|
fillStyle: 'fill',
|
|
@@ -2112,11 +1904,9 @@
|
|
|
2112
1904
|
*
|
|
2113
1905
|
* eg. g_svg_circle_345
|
|
2114
1906
|
*/
|
|
2115
|
-
|
|
2116
1907
|
var G_SVG_PREFIX = 'g-svg';
|
|
2117
1908
|
var CLIP_PATH_PREFIX = 'clip-path-';
|
|
2118
1909
|
var TEXT_PATH_PREFIX = 'text-path-';
|
|
2119
|
-
|
|
2120
1910
|
var SVGRendererPlugin = /*#__PURE__*/function () {
|
|
2121
1911
|
function SVGRendererPlugin(pluginOptions, defElementManager, context) {
|
|
2122
1912
|
this.pluginOptions = void 0;
|
|
@@ -2134,105 +1924,77 @@
|
|
|
2134
1924
|
/**
|
|
2135
1925
|
* <camera>
|
|
2136
1926
|
*/
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
1927
|
var _proto = SVGRendererPlugin.prototype;
|
|
2140
|
-
|
|
2141
1928
|
_proto.apply = function apply(context) {
|
|
2142
1929
|
var _this = this;
|
|
2143
|
-
|
|
2144
1930
|
var renderingService = context.renderingService,
|
|
2145
|
-
|
|
1931
|
+
renderingContext = context.renderingContext;
|
|
2146
1932
|
this.context = context;
|
|
2147
1933
|
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
2148
1934
|
var document = this.context.config.document;
|
|
2149
|
-
|
|
2150
1935
|
var handleMounted = function handleMounted(e) {
|
|
2151
|
-
var object = e.target;
|
|
2152
|
-
|
|
1936
|
+
var object = e.target;
|
|
1937
|
+
// create SVG DOM Node
|
|
2153
1938
|
_this.createSVGDom(document, object, _this.$camera);
|
|
2154
1939
|
};
|
|
2155
|
-
|
|
2156
1940
|
var handleUnmounted = function handleUnmounted(e) {
|
|
2157
1941
|
var object = e.target;
|
|
2158
|
-
|
|
2159
1942
|
_this.defElementManager.clear(object.entity);
|
|
2160
|
-
|
|
2161
1943
|
_this.clipPathUseMap.delete(object);
|
|
2162
|
-
|
|
2163
1944
|
_this.removeSVGDom(object);
|
|
2164
1945
|
};
|
|
2165
|
-
|
|
2166
1946
|
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
2167
|
-
var object = e.target;
|
|
1947
|
+
var object = e.target;
|
|
1948
|
+
// @see https://github.com/antvis/g/issues/994
|
|
2168
1949
|
// @ts-ignore
|
|
2169
|
-
|
|
2170
1950
|
if (!object.elementSVG) {
|
|
2171
1951
|
return;
|
|
2172
1952
|
}
|
|
2173
|
-
|
|
2174
1953
|
var attrName = e.attrName;
|
|
2175
|
-
|
|
2176
1954
|
var attribtues = _this.dirtyAttributes.get(object);
|
|
2177
|
-
|
|
2178
1955
|
if (!attribtues) {
|
|
2179
1956
|
_this.dirtyAttributes.set(object, []);
|
|
2180
|
-
|
|
2181
1957
|
attribtues = _this.dirtyAttributes.get(object);
|
|
2182
1958
|
}
|
|
2183
|
-
|
|
2184
1959
|
attribtues.push(attrName);
|
|
2185
1960
|
};
|
|
2186
|
-
|
|
2187
1961
|
var handleGeometryBoundsChanged = function handleGeometryBoundsChanged(e) {
|
|
2188
1962
|
var _object$elementSVG;
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
1963
|
+
var object = e.target;
|
|
1964
|
+
// @ts-ignore
|
|
2192
1965
|
var $el = (_object$elementSVG = object.elementSVG) === null || _object$elementSVG === void 0 ? void 0 : _object$elementSVG.$el;
|
|
2193
1966
|
var _object$parsedStyle = object.parsedStyle,
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
1967
|
+
fill = _object$parsedStyle.fill,
|
|
1968
|
+
stroke = _object$parsedStyle.stroke;
|
|
2197
1969
|
if (fill && !(fill instanceof gLite.CSSRGB)) {
|
|
2198
1970
|
_this.defElementManager.createOrUpdateGradientAndPattern(object, $el, fill, 'fill');
|
|
2199
1971
|
}
|
|
2200
|
-
|
|
2201
1972
|
if (stroke && !(stroke instanceof gLite.CSSRGB)) {
|
|
2202
1973
|
_this.defElementManager.createOrUpdateGradientAndPattern(object, $el, stroke, 'stroke');
|
|
2203
1974
|
}
|
|
2204
1975
|
};
|
|
2205
|
-
|
|
2206
1976
|
renderingService.hooks.init.tapPromise(SVGRendererPlugin.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
2207
1977
|
var _this$context$config, background, document, $svg;
|
|
2208
|
-
|
|
2209
1978
|
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
2210
1979
|
while (1) {
|
|
2211
1980
|
switch (_context.prev = _context.next) {
|
|
2212
1981
|
case 0:
|
|
2213
1982
|
_this$context$config = _this.context.config, background = _this$context$config.background, document = _this$context$config.document; // <defs>
|
|
2214
|
-
|
|
2215
1983
|
_this.defElementManager.init();
|
|
2216
|
-
|
|
2217
1984
|
$svg = _this.context.contextService.getContext();
|
|
2218
|
-
|
|
2219
1985
|
if (background) {
|
|
2220
1986
|
$svg.style.background = background;
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
|
-
|
|
1987
|
+
}
|
|
1988
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/color-interpolation-filters
|
|
2224
1989
|
$svg.setAttribute('color-interpolation-filters', 'sRGB');
|
|
2225
1990
|
_this.$camera = createSVGElement('g', document);
|
|
2226
1991
|
_this.$camera.id = G_SVG_PREFIX + "-camera";
|
|
2227
|
-
|
|
2228
1992
|
_this.applyTransform(_this.$camera, _this.context.camera.getOrthoMatrix());
|
|
2229
|
-
|
|
2230
1993
|
$svg.appendChild(_this.$camera);
|
|
2231
1994
|
canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
2232
1995
|
canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
2233
1996
|
canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
2234
1997
|
canvas.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleGeometryBoundsChanged);
|
|
2235
|
-
|
|
2236
1998
|
case 13:
|
|
2237
1999
|
case "end":
|
|
2238
2000
|
return _context.stop();
|
|
@@ -2248,25 +2010,23 @@
|
|
|
2248
2010
|
});
|
|
2249
2011
|
renderingService.hooks.render.tap(SVGRendererPlugin.tag, function (object) {
|
|
2250
2012
|
// if (!object.isCulled()) {
|
|
2251
|
-
_this.renderQueue.push(object);
|
|
2252
|
-
|
|
2013
|
+
_this.renderQueue.push(object);
|
|
2014
|
+
// }
|
|
2253
2015
|
});
|
|
2016
|
+
|
|
2254
2017
|
renderingService.hooks.beginFrame.tap(SVGRendererPlugin.tag, function () {
|
|
2255
2018
|
var doc = _this.context.config.document;
|
|
2256
|
-
|
|
2257
2019
|
if (_this.pendingReorderQueue.size) {
|
|
2258
2020
|
_this.pendingReorderQueue.forEach(function (object) {
|
|
2259
2021
|
var _object$elementSVG2;
|
|
2260
|
-
|
|
2261
2022
|
var children = ((object === null || object === void 0 ? void 0 : object.children) || []).slice();
|
|
2262
|
-
var $parentGroupEl =
|
|
2023
|
+
var $parentGroupEl =
|
|
2024
|
+
// @ts-ignore
|
|
2263
2025
|
object === null || object === void 0 ? void 0 : (_object$elementSVG2 = object.elementSVG) === null || _object$elementSVG2 === void 0 ? void 0 : _object$elementSVG2.$groupEl;
|
|
2264
|
-
|
|
2265
2026
|
if ($parentGroupEl) {
|
|
2266
2027
|
_this.reorderChildren(doc || document, $parentGroupEl, children || []);
|
|
2267
2028
|
}
|
|
2268
2029
|
});
|
|
2269
|
-
|
|
2270
2030
|
_this.pendingReorderQueue.clear();
|
|
2271
2031
|
}
|
|
2272
2032
|
});
|
|
@@ -2274,77 +2034,65 @@
|
|
|
2274
2034
|
if (renderingContext.renderReasons.has(gLite.RenderReason.CAMERA_CHANGED)) {
|
|
2275
2035
|
_this.applyTransform(_this.$camera, _this.context.camera.getOrthoMatrix());
|
|
2276
2036
|
}
|
|
2277
|
-
|
|
2278
2037
|
_this.renderQueue.forEach(function (object) {
|
|
2279
|
-
var _object$elementSVG3, _object$elementSVG4;
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
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
|
|
2284
2042
|
var $groupEl = (_object$elementSVG4 = object.elementSVG) === null || _object$elementSVG4 === void 0 ? void 0 : _object$elementSVG4.$groupEl;
|
|
2285
|
-
|
|
2286
2043
|
if ($el && $groupEl) {
|
|
2287
2044
|
// apply local RTS transformation to <group> wrapper
|
|
2288
2045
|
// account for anchor
|
|
2289
2046
|
var localTransform = object.getLocalTransform();
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2047
|
+
_this.applyTransform($groupEl, localTransform);
|
|
2048
|
+
// clipped shapes should also be informed
|
|
2294
2049
|
var $useRefs = _this.clipPathUseMap.get(object);
|
|
2295
|
-
|
|
2296
2050
|
if ($useRefs && $useRefs.length) {
|
|
2297
2051
|
$useRefs.forEach(function ($use) {
|
|
2298
|
-
|
|
2052
|
+
// <clipPath transform="matrix()"><circle /></clipPath>
|
|
2053
|
+
_this.applyTransform($use, object.getWorldTransform());
|
|
2054
|
+
// const parentInvert = mat4.invert(
|
|
2055
|
+
// mat4.create(),
|
|
2056
|
+
// (object as DisplayObject).getWorldTransform(),
|
|
2057
|
+
// );
|
|
2058
|
+
// this.applyTransform($clipPath, parentInvert);
|
|
2299
2059
|
});
|
|
2300
|
-
}
|
|
2301
|
-
|
|
2302
|
-
|
|
2060
|
+
}
|
|
2061
|
+
// finish rendering, clear dirty flag
|
|
2303
2062
|
object.renderable.dirty = false;
|
|
2304
|
-
}
|
|
2305
|
-
|
|
2306
|
-
|
|
2063
|
+
}
|
|
2064
|
+
// update dirty attributes
|
|
2307
2065
|
var attributes = _this.dirtyAttributes.get(object);
|
|
2308
|
-
|
|
2309
2066
|
if (attributes) {
|
|
2310
2067
|
attributes.forEach(function (attrName) {
|
|
2311
2068
|
if (attrName === 'zIndex') {
|
|
2312
2069
|
var _object$parentNode, _object$parentNode$el;
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2070
|
+
var parent = object.parentNode;
|
|
2071
|
+
// @ts-ignore
|
|
2316
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;
|
|
2317
|
-
|
|
2318
2073
|
var children = ((parent === null || parent === void 0 ? void 0 : parent.children) || []).slice();
|
|
2319
|
-
|
|
2320
2074
|
if (_$groupEl) {
|
|
2321
2075
|
_this.reorderChildren(document, _$groupEl, children);
|
|
2322
2076
|
}
|
|
2323
2077
|
} else if (attrName === 'increasedLineWidthForHitTesting') {
|
|
2324
2078
|
_this.createOrUpdateHitArea(object, $el, $groupEl);
|
|
2325
2079
|
}
|
|
2326
|
-
|
|
2327
2080
|
_this.updateAttribute(object, [attrName]);
|
|
2328
2081
|
});
|
|
2329
|
-
|
|
2330
2082
|
_this.dirtyAttributes.delete(object);
|
|
2331
2083
|
}
|
|
2332
2084
|
});
|
|
2333
|
-
|
|
2334
2085
|
_this.renderQueue = [];
|
|
2335
2086
|
});
|
|
2336
2087
|
};
|
|
2337
|
-
|
|
2338
2088
|
_proto.getId = function getId(object) {
|
|
2339
2089
|
return G_SVG_PREFIX + "-" + object.nodeName + "-" + object.entity;
|
|
2340
2090
|
};
|
|
2341
|
-
|
|
2342
2091
|
_proto.reorderChildren = function reorderChildren(doc, $groupEl, children) {
|
|
2343
2092
|
// need to reorder parent's children
|
|
2344
2093
|
children.sort(function (a, b) {
|
|
2345
2094
|
return a.sortable.renderOrder - b.sortable.renderOrder;
|
|
2346
2095
|
});
|
|
2347
|
-
|
|
2348
2096
|
if (children.length) {
|
|
2349
2097
|
// create empty fragment
|
|
2350
2098
|
var fragment = (doc || document).createDocumentFragment();
|
|
@@ -2352,7 +2100,6 @@
|
|
|
2352
2100
|
if (child.isConnected) {
|
|
2353
2101
|
// @ts-ignore
|
|
2354
2102
|
var $el = child.elementSVG.$groupEl;
|
|
2355
|
-
|
|
2356
2103
|
if ($el) {
|
|
2357
2104
|
fragment.appendChild($el);
|
|
2358
2105
|
}
|
|
@@ -2361,79 +2108,68 @@
|
|
|
2361
2108
|
$groupEl.appendChild(fragment);
|
|
2362
2109
|
}
|
|
2363
2110
|
};
|
|
2364
|
-
|
|
2365
2111
|
_proto.applyTransform = function applyTransform($el, rts) {
|
|
2366
2112
|
// use proper precision avoiding too long string in `transform`
|
|
2367
2113
|
// @see https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Transformations
|
|
2368
2114
|
$el.setAttribute('transform', "matrix(" + numberToLongString(rts[0]) + "," + numberToLongString(rts[1]) + "," + numberToLongString(rts[4]) + "," + numberToLongString(rts[5]) + "," + numberToLongString(rts[12]) + "," + numberToLongString(rts[13]) + ")");
|
|
2369
2115
|
};
|
|
2370
|
-
|
|
2371
2116
|
_proto.applyAttributes = function applyAttributes(object) {
|
|
2372
2117
|
// @ts-ignore
|
|
2373
2118
|
var elementSVG = object.elementSVG;
|
|
2374
2119
|
var $el = elementSVG === null || elementSVG === void 0 ? void 0 : elementSVG.$el;
|
|
2375
2120
|
var $groupEl = elementSVG === null || elementSVG === void 0 ? void 0 : elementSVG.$groupEl;
|
|
2376
|
-
|
|
2377
2121
|
if ($el && $groupEl) {
|
|
2378
2122
|
var nodeName = object.nodeName,
|
|
2379
|
-
|
|
2123
|
+
attributes = object.attributes;
|
|
2380
2124
|
$el.setAttribute('fill', 'none');
|
|
2381
|
-
|
|
2382
2125
|
if (nodeName === gLite.Shape.IMAGE) {
|
|
2383
2126
|
$el.setAttribute('preserveAspectRatio', 'none');
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
|
|
2127
|
+
}
|
|
2128
|
+
// apply attributes
|
|
2387
2129
|
this.updateAttribute(object, Object.keys(attributes));
|
|
2388
2130
|
}
|
|
2389
2131
|
};
|
|
2390
|
-
|
|
2391
2132
|
_proto.updateAttribute = function updateAttribute(object, attributes) {
|
|
2392
2133
|
var _this2 = this;
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2134
|
+
var document = this.context.config.document;
|
|
2135
|
+
// @ts-ignore
|
|
2396
2136
|
var _object$elementSVG5 = object.elementSVG,
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2137
|
+
$el = _object$elementSVG5.$el,
|
|
2138
|
+
$groupEl = _object$elementSVG5.$groupEl,
|
|
2139
|
+
$hitTestingEl = _object$elementSVG5.$hitTestingEl;
|
|
2400
2140
|
var parsedStyle = object.parsedStyle,
|
|
2401
|
-
|
|
2141
|
+
computedStyle = object.computedStyle;
|
|
2402
2142
|
var shouldUpdateElementAttribute = attributes.some(function (name) {
|
|
2403
|
-
return (
|
|
2143
|
+
return (
|
|
2144
|
+
// @ts-ignore
|
|
2404
2145
|
_this2.context.SVGElementLifeCycleContribution.shouldUpdateElementAttribute(object, name)
|
|
2405
2146
|
);
|
|
2406
|
-
});
|
|
2407
|
-
|
|
2147
|
+
});
|
|
2148
|
+
// need re-generate path
|
|
2408
2149
|
if (shouldUpdateElementAttribute && $el) {
|
|
2409
2150
|
[$el, $hitTestingEl].forEach(function ($el) {
|
|
2410
2151
|
if ($el) {
|
|
2411
2152
|
// @ts-ignore
|
|
2412
2153
|
_this2.context.SVGElementLifeCycleContribution.updateElementAttribute(object, $el);
|
|
2413
|
-
|
|
2414
2154
|
if (object.nodeName !== gLite.Shape.TEXT) {
|
|
2415
2155
|
_this2.updateAnchorWithTransform(object);
|
|
2416
2156
|
}
|
|
2417
2157
|
}
|
|
2418
2158
|
});
|
|
2419
|
-
}
|
|
2420
|
-
|
|
2421
|
-
|
|
2159
|
+
}
|
|
2160
|
+
// update common attributes
|
|
2422
2161
|
attributes.forEach(function (name) {
|
|
2423
2162
|
var _FORMAT_VALUE_MAP$nam, _propertyMetadataCach;
|
|
2424
|
-
|
|
2425
2163
|
var usedName = SVG_ATTR_MAP[name];
|
|
2426
2164
|
var computedValue = computedStyle[name];
|
|
2427
2165
|
var computedValueStr = computedValue && computedValue.toString();
|
|
2428
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;
|
|
2429
2167
|
var usedValue = parsedStyle[name];
|
|
2430
2168
|
var inherited = !!((_propertyMetadataCach = gLite.propertyMetadataCache[name]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.inh);
|
|
2431
|
-
|
|
2432
2169
|
if (!usedName) {
|
|
2433
2170
|
return;
|
|
2434
|
-
}
|
|
2435
|
-
|
|
2436
|
-
|
|
2171
|
+
}
|
|
2172
|
+
// <foreignObject>
|
|
2437
2173
|
if (object.nodeName === gLite.Shape.HTML) {
|
|
2438
2174
|
if (name === 'lineWidth') {
|
|
2439
2175
|
$el.style['border-width'] = (usedValue || 0) + "px";
|
|
@@ -2441,7 +2177,6 @@
|
|
|
2441
2177
|
$el.style['border-style'] = 'dashed';
|
|
2442
2178
|
}
|
|
2443
2179
|
}
|
|
2444
|
-
|
|
2445
2180
|
if (name === 'fill') {
|
|
2446
2181
|
if (object.nodeName === gLite.Shape.HTML) {
|
|
2447
2182
|
$el.style.background = usedValue.toString();
|
|
@@ -2495,72 +2230,62 @@
|
|
|
2495
2230
|
}
|
|
2496
2231
|
});
|
|
2497
2232
|
};
|
|
2498
|
-
|
|
2499
2233
|
_proto.createSVGDom = function createSVGDom(document, object, root, noWrapWithGroup) {
|
|
2500
2234
|
if (noWrapWithGroup === void 0) {
|
|
2501
2235
|
noWrapWithGroup = false;
|
|
2502
|
-
}
|
|
2236
|
+
}
|
|
2237
|
+
// create svg element
|
|
2503
2238
|
// @ts-ignore
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
object.elementSVG
|
|
2507
|
-
|
|
2508
|
-
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
|
|
2509
2243
|
// @ts-ignore
|
|
2510
|
-
|
|
2511
2244
|
var $el = this.context.SVGElementLifeCycleContribution.createElement(object);
|
|
2512
|
-
|
|
2513
2245
|
if ($el) {
|
|
2514
2246
|
var _object$parentNode$el2;
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2247
|
+
var $groupEl;
|
|
2248
|
+
// save $el on parsedStyle, which will be returned in getDomElement()
|
|
2518
2249
|
if (object.nodeName === gLite.Shape.HTML) {
|
|
2519
2250
|
object.parsedStyle.$el = $el;
|
|
2520
2251
|
}
|
|
2521
|
-
|
|
2522
2252
|
if (this.pluginOptions.outputSVGElementId) {
|
|
2523
2253
|
$el.id = this.getId(object);
|
|
2524
2254
|
}
|
|
2525
|
-
|
|
2526
2255
|
if (this.pluginOptions.outputSVGElementName && object.name) {
|
|
2527
2256
|
$el.setAttribute('name', object.name);
|
|
2528
2257
|
}
|
|
2529
|
-
|
|
2530
2258
|
if (($el.hasAttribute('data-wrapgroup') || $el.nodeName !== 'g') && !noWrapWithGroup) {
|
|
2531
2259
|
$groupEl = createSVGElement('g', document);
|
|
2532
2260
|
$groupEl.appendChild($el);
|
|
2533
2261
|
} else {
|
|
2534
2262
|
$groupEl = $el;
|
|
2535
2263
|
}
|
|
2536
|
-
|
|
2537
2264
|
svgElement.$el = $el;
|
|
2538
|
-
svgElement.$groupEl = $groupEl;
|
|
2539
|
-
|
|
2540
|
-
this.applyAttributes(object);
|
|
2541
|
-
|
|
2265
|
+
svgElement.$groupEl = $groupEl;
|
|
2266
|
+
// apply attributes at first time
|
|
2267
|
+
this.applyAttributes(object);
|
|
2268
|
+
// create hitArea if necessary
|
|
2542
2269
|
this.createOrUpdateHitArea(object, $el, $groupEl);
|
|
2543
|
-
var $parentGroupEl =
|
|
2270
|
+
var $parentGroupEl =
|
|
2271
|
+
// @ts-ignore
|
|
2544
2272
|
object.parentNode && ((_object$parentNode$el2 = object.parentNode.elementSVG) === null || _object$parentNode$el2 === void 0 ? void 0 : _object$parentNode$el2.$groupEl) || root;
|
|
2545
|
-
|
|
2546
2273
|
if ($parentGroupEl) {
|
|
2547
|
-
$parentGroupEl.appendChild($groupEl);
|
|
2548
|
-
|
|
2274
|
+
$parentGroupEl.appendChild($groupEl);
|
|
2275
|
+
// need reorder children later
|
|
2549
2276
|
this.pendingReorderQueue.add(object.parentNode);
|
|
2550
2277
|
}
|
|
2551
2278
|
}
|
|
2552
2279
|
};
|
|
2553
|
-
|
|
2554
2280
|
_proto.removeSVGDom = function removeSVGDom(object) {
|
|
2555
|
-
var _object$elementSVG6;
|
|
2556
|
-
|
|
2557
|
-
|
|
2281
|
+
var _object$elementSVG6;
|
|
2282
|
+
// @ts-ignore
|
|
2558
2283
|
var $groupEl = (_object$elementSVG6 = object.elementSVG) === null || _object$elementSVG6 === void 0 ? void 0 : _object$elementSVG6.$groupEl;
|
|
2559
|
-
|
|
2560
2284
|
if ($groupEl && $groupEl.parentNode) {
|
|
2561
|
-
$groupEl.parentNode.removeChild($groupEl);
|
|
2562
|
-
|
|
2563
|
-
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);
|
|
2564
2289
|
}
|
|
2565
2290
|
};
|
|
2566
2291
|
|
|
@@ -2568,30 +2293,27 @@
|
|
|
2568
2293
|
// @ts-ignore
|
|
2569
2294
|
var svgElement = object.elementSVG;
|
|
2570
2295
|
var $hitTestingEl = svgElement.$hitTestingEl;
|
|
2571
|
-
var increasedLineWidthForHitTesting = object.parsedStyle.increasedLineWidthForHitTesting;
|
|
2572
|
-
|
|
2296
|
+
var increasedLineWidthForHitTesting = object.parsedStyle.increasedLineWidthForHitTesting;
|
|
2297
|
+
// account for hitArea
|
|
2573
2298
|
if (increasedLineWidthForHitTesting) {
|
|
2574
2299
|
if (!$hitTestingEl) {
|
|
2575
2300
|
$hitTestingEl = $el.cloneNode();
|
|
2576
|
-
|
|
2577
2301
|
if (this.pluginOptions.outputSVGElementId) {
|
|
2578
2302
|
// use the entity suffix, so that `g-plugin-svg-picker` can extract
|
|
2579
2303
|
$hitTestingEl.id = G_SVG_PREFIX + "-" + object.nodeName + "-hittesting-" + object.entity;
|
|
2580
|
-
}
|
|
2581
|
-
|
|
2582
|
-
|
|
2304
|
+
}
|
|
2305
|
+
// clear attributes like `filter` `font-size`
|
|
2583
2306
|
['filter'].forEach(function (attribute) {
|
|
2584
2307
|
$hitTestingEl.removeAttribute(attribute);
|
|
2585
|
-
});
|
|
2586
|
-
|
|
2308
|
+
});
|
|
2309
|
+
// hitArea should be 'transparent' but not 'none'
|
|
2587
2310
|
var hasFill = $el.getAttribute('fill') !== 'none';
|
|
2588
2311
|
$hitTestingEl.setAttribute('fill', hasFill ? 'transparent' : 'none');
|
|
2589
2312
|
$hitTestingEl.setAttribute('stroke', 'transparent');
|
|
2590
2313
|
$groupEl.appendChild($hitTestingEl);
|
|
2591
2314
|
svgElement.$hitTestingEl = $hitTestingEl;
|
|
2592
|
-
}
|
|
2593
|
-
|
|
2594
|
-
|
|
2315
|
+
}
|
|
2316
|
+
// increase interactive line width
|
|
2595
2317
|
$hitTestingEl.setAttribute('stroke-width', "" + (increasedLineWidthForHitTesting + object.parsedStyle.lineWidth));
|
|
2596
2318
|
} else {
|
|
2597
2319
|
if ($hitTestingEl) {
|
|
@@ -2600,82 +2322,67 @@
|
|
|
2600
2322
|
}
|
|
2601
2323
|
}
|
|
2602
2324
|
};
|
|
2603
|
-
|
|
2604
2325
|
_proto.createOrUpdateInnerHTML = function createOrUpdateInnerHTML(doc, $el, usedValue) {
|
|
2605
2326
|
var $div = (doc || document).createElement('div');
|
|
2606
|
-
|
|
2607
2327
|
if (typeof usedValue === 'string') {
|
|
2608
2328
|
$div.innerHTML = usedValue;
|
|
2609
2329
|
} else {
|
|
2610
2330
|
$div.appendChild(usedValue);
|
|
2611
2331
|
}
|
|
2612
|
-
|
|
2613
2332
|
$el.innerHTML = '';
|
|
2614
2333
|
$el.appendChild($div);
|
|
2615
2334
|
};
|
|
2616
|
-
|
|
2617
2335
|
_proto.createOrUpdateClipOrTextPath = function createOrUpdateClipOrTextPath(document, clipPath, object, isTextPath) {
|
|
2618
2336
|
if (isTextPath === void 0) {
|
|
2619
2337
|
isTextPath = false;
|
|
2620
|
-
}
|
|
2621
|
-
|
|
2622
|
-
|
|
2338
|
+
}
|
|
2339
|
+
// @ts-ignore
|
|
2623
2340
|
var $groupEl = object.elementSVG.$groupEl;
|
|
2624
2341
|
var PREFIX = isTextPath ? TEXT_PATH_PREFIX : CLIP_PATH_PREFIX;
|
|
2625
2342
|
var attributeNameCamel = isTextPath ? 'g' : 'clipPath';
|
|
2626
2343
|
var attributeNameHyphen = isTextPath ? 'text-path' : 'clip-path';
|
|
2627
|
-
|
|
2628
2344
|
if (clipPath) {
|
|
2629
2345
|
var clipPathId = PREFIX + clipPath.entity + '-' + object.entity;
|
|
2630
2346
|
var $def = this.defElementManager.getDefElement();
|
|
2631
2347
|
var existed = $def.querySelector("#" + clipPathId);
|
|
2632
|
-
|
|
2633
2348
|
if (!existed) {
|
|
2634
2349
|
var $clipPath;
|
|
2635
|
-
|
|
2636
2350
|
if (isTextPath) {
|
|
2637
2351
|
// use <path> directly instead of wrapping with <g>
|
|
2638
|
-
this.createSVGDom(document, clipPath, null, true);
|
|
2639
|
-
|
|
2352
|
+
this.createSVGDom(document, clipPath, null, true);
|
|
2353
|
+
// @ts-ignore
|
|
2640
2354
|
$clipPath = clipPath.elementSVG.$el;
|
|
2641
2355
|
} else {
|
|
2642
2356
|
// the clipPath is allowed to be detached from canvas
|
|
2643
2357
|
if (!clipPath.isConnected) {
|
|
2644
2358
|
var $existedClipPath = $def.querySelector("#" + this.getId(clipPath));
|
|
2645
|
-
|
|
2646
2359
|
if (!$existedClipPath) {
|
|
2647
2360
|
this.createSVGDom(document, clipPath, $def, true);
|
|
2648
2361
|
}
|
|
2649
|
-
}
|
|
2650
|
-
|
|
2651
|
-
|
|
2362
|
+
}
|
|
2363
|
+
// create <clipPath> dom node
|
|
2652
2364
|
$clipPath = createSVGElement(attributeNameCamel, document);
|
|
2653
|
-
var $use = createSVGElement('use', document);
|
|
2654
|
-
|
|
2365
|
+
var $use = createSVGElement('use', document);
|
|
2366
|
+
// @ts-ignore
|
|
2655
2367
|
$use.setAttribute('href', "#" + clipPath.elementSVG.$el.id);
|
|
2656
2368
|
$clipPath.appendChild($use);
|
|
2657
2369
|
var $useRefs = this.clipPathUseMap.get(clipPath);
|
|
2658
|
-
|
|
2659
2370
|
if (!$useRefs) {
|
|
2660
2371
|
this.clipPathUseMap.set(clipPath, []);
|
|
2661
2372
|
$useRefs = this.clipPathUseMap.get(clipPath);
|
|
2662
2373
|
}
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2374
|
+
$useRefs.push($use);
|
|
2375
|
+
// <clipPath transform="matrix()"><circle /></clipPath>
|
|
2666
2376
|
this.applyTransform($use, clipPath.getWorldTransform());
|
|
2667
2377
|
var parentInvert = invert(create(), object.getWorldTransform());
|
|
2668
2378
|
this.applyTransform($clipPath, parentInvert);
|
|
2669
2379
|
}
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2380
|
+
$clipPath.id = clipPathId;
|
|
2381
|
+
// append it to <defs>
|
|
2673
2382
|
$def.appendChild($clipPath);
|
|
2674
|
-
}
|
|
2675
|
-
|
|
2676
|
-
|
|
2383
|
+
}
|
|
2384
|
+
// apply attributes
|
|
2677
2385
|
this.applyAttributes(clipPath);
|
|
2678
|
-
|
|
2679
2386
|
if (!isTextPath) {
|
|
2680
2387
|
// apply clipPath to $group
|
|
2681
2388
|
// @see https://github.com/antvis/g/issues/961
|
|
@@ -2690,32 +2397,26 @@
|
|
|
2690
2397
|
}
|
|
2691
2398
|
/**
|
|
2692
2399
|
* the origin is bounding box's top left corner
|
|
2693
|
-
|
|
2694
|
-
;
|
|
2695
|
-
|
|
2400
|
+
*/;
|
|
2696
2401
|
_proto.updateAnchorWithTransform = function updateAnchorWithTransform(object) {
|
|
2697
2402
|
var _object$elementSVG7, _object$elementSVG8;
|
|
2698
|
-
|
|
2699
2403
|
var bounds = object.getGeometryBounds();
|
|
2700
2404
|
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
2701
2405
|
var height = bounds && bounds.halfExtents[1] * 2 || 0;
|
|
2702
|
-
|
|
2703
2406
|
var _ref2 = object.parsedStyle || {},
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2407
|
+
anchor = _ref2.anchor;
|
|
2408
|
+
// @ts-ignore
|
|
2707
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) {
|
|
2708
2410
|
if ($el) {
|
|
2709
2411
|
var tx = -(anchor[0] * width);
|
|
2710
2412
|
var ty = -(anchor[1] * height);
|
|
2711
|
-
|
|
2712
2413
|
if (tx !== 0 || ty !== 0) {
|
|
2713
2414
|
// apply anchor to element's `transform` property
|
|
2714
|
-
$el.setAttribute('transform',
|
|
2415
|
+
$el.setAttribute('transform',
|
|
2416
|
+
// can't use percent unit like translate(-50%, -50%)
|
|
2715
2417
|
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/transform#translate
|
|
2716
2418
|
"translate(" + tx + "," + ty + ")");
|
|
2717
2419
|
}
|
|
2718
|
-
|
|
2719
2420
|
if (object.nodeName === gLite.Shape.CIRCLE || object.nodeName === gLite.Shape.ELLIPSE) {
|
|
2720
2421
|
$el.setAttribute('cx', "" + width / 2);
|
|
2721
2422
|
$el.setAttribute('cy', "" + height / 2);
|
|
@@ -2723,11 +2424,11 @@
|
|
|
2723
2424
|
}
|
|
2724
2425
|
});
|
|
2725
2426
|
};
|
|
2726
|
-
|
|
2727
2427
|
return SVGRendererPlugin;
|
|
2728
2428
|
}();
|
|
2729
|
-
|
|
2730
2429
|
SVGRendererPlugin.tag = 'SVGRenderer';
|
|
2430
|
+
|
|
2431
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/alignment-baseline
|
|
2731
2432
|
var BASELINE_MAP = {
|
|
2732
2433
|
top: 'before-edge',
|
|
2733
2434
|
middle: 'central',
|
|
@@ -2735,9 +2436,9 @@
|
|
|
2735
2436
|
alphabetic: 'alphabetic',
|
|
2736
2437
|
ideographic: 'ideographic',
|
|
2737
2438
|
hanging: 'hanging'
|
|
2738
|
-
};
|
|
2439
|
+
};
|
|
2440
|
+
// for FireFox
|
|
2739
2441
|
// @see https://github.com/plouc/nivo/issues/164
|
|
2740
|
-
|
|
2741
2442
|
var BASELINE_MAP_FOR_FIREFOX = {
|
|
2742
2443
|
top: 'text-before-edge',
|
|
2743
2444
|
middle: 'central',
|
|
@@ -2746,26 +2447,24 @@
|
|
|
2746
2447
|
ideographic: 'ideographic',
|
|
2747
2448
|
hanging: 'hanging'
|
|
2748
2449
|
};
|
|
2749
|
-
|
|
2750
2450
|
function updateTextElementAttribute($el, parsedStyle) {
|
|
2751
2451
|
var textBaseline = parsedStyle.textBaseline,
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
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;
|
|
2767
2467
|
var browser = detect();
|
|
2768
|
-
|
|
2769
2468
|
if (browser && browser.name === 'firefox') {
|
|
2770
2469
|
// compatible with FireFox browser, ref: https://github.com/antvis/g/issues/119
|
|
2771
2470
|
$el.setAttribute('dominant-baseline', BASELINE_MAP_FOR_FIREFOX[textBaseline] || 'alphabetic');
|
|
@@ -2773,47 +2472,39 @@
|
|
|
2773
2472
|
$el.setAttribute('dominant-baseline', BASELINE_MAP_FOR_FIREFOX[textBaseline]);
|
|
2774
2473
|
$el.setAttribute('alignment-baseline', BASELINE_MAP[textBaseline]);
|
|
2775
2474
|
}
|
|
2776
|
-
|
|
2777
2475
|
$el.setAttribute('paint-order', 'stroke');
|
|
2778
2476
|
var lines = metrics.lines,
|
|
2779
|
-
|
|
2780
|
-
|
|
2477
|
+
lineHeight = metrics.lineHeight,
|
|
2478
|
+
height = metrics.height;
|
|
2781
2479
|
var lineNum = lines.length;
|
|
2782
2480
|
var styleCSSText = '';
|
|
2783
|
-
|
|
2784
2481
|
if (dx !== 0 || dy !== 0) {
|
|
2785
2482
|
styleCSSText += "transform:translate(" + dx + "px, " + dy + "px);";
|
|
2786
2483
|
}
|
|
2787
|
-
|
|
2788
2484
|
if (textDecorationLine && textDecorationLine !== 'none') {
|
|
2789
2485
|
// use CSS text-decoration since the implementation in SVG is not good enough
|
|
2790
2486
|
styleCSSText += "text-decoration:" + textDecorationLine + " " + textDecorationStyle + " " + textDecorationColor + ";";
|
|
2791
2487
|
}
|
|
2792
|
-
|
|
2793
2488
|
if (styleCSSText) {
|
|
2794
2489
|
$el.setAttribute('style', styleCSSText);
|
|
2795
2490
|
}
|
|
2796
|
-
|
|
2797
2491
|
if (lineNum === 1) {
|
|
2798
2492
|
var textContent = convertHTML(lines[0]);
|
|
2799
|
-
$el.setAttribute('dx', "" + lineWidth / 2);
|
|
2493
|
+
$el.setAttribute('dx', "" + lineWidth / 2);
|
|
2494
|
+
// <textPath> only support one line
|
|
2800
2495
|
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/textPath
|
|
2801
|
-
|
|
2802
2496
|
if (textPath) {
|
|
2803
2497
|
// clear existed text content first
|
|
2804
|
-
$el.innerHTML = '';
|
|
2805
|
-
|
|
2498
|
+
$el.innerHTML = '';
|
|
2499
|
+
// append <textPath href="#MyPath">text</textPath>
|
|
2806
2500
|
var $textPath = createSVGElement('textPath', $el.ownerDocument);
|
|
2807
2501
|
$textPath.setAttribute('href', "#" + (TEXT_PATH_PREFIX + textPath.entity));
|
|
2808
|
-
|
|
2809
2502
|
if (textPathSide !== 'left') {
|
|
2810
2503
|
$textPath.setAttribute('side', textPathSide);
|
|
2811
2504
|
}
|
|
2812
|
-
|
|
2813
2505
|
if (textPathStartOffset !== 0) {
|
|
2814
2506
|
$textPath.setAttribute('startOffset', "" + textPathStartOffset);
|
|
2815
2507
|
}
|
|
2816
|
-
|
|
2817
2508
|
$textPath.innerHTML = textContent;
|
|
2818
2509
|
$el.appendChild($textPath);
|
|
2819
2510
|
} else {
|
|
@@ -2823,7 +2514,6 @@
|
|
|
2823
2514
|
$el.innerHTML = lines.map(function (line, i) {
|
|
2824
2515
|
var dx = lineWidth / 2;
|
|
2825
2516
|
var dy = 0;
|
|
2826
|
-
|
|
2827
2517
|
if (i === 0) {
|
|
2828
2518
|
// TODO: handle other textBaseline values
|
|
2829
2519
|
if (textBaseline === 'middle') {
|
|
@@ -2836,77 +2526,63 @@
|
|
|
2836
2526
|
} else {
|
|
2837
2527
|
dy = lineHeight;
|
|
2838
2528
|
}
|
|
2839
|
-
|
|
2840
2529
|
return "<tspan x=\"0\" dx=\"" + dx + "\" dy=\"" + dy + "\">" + convertHTML(line) + "</tspan>";
|
|
2841
2530
|
}).join('');
|
|
2842
2531
|
}
|
|
2843
2532
|
}
|
|
2844
|
-
|
|
2845
2533
|
var _SHAPE2TAGS, _SHAPE_UPDATE_DEPS;
|
|
2846
|
-
|
|
2847
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);
|
|
2848
|
-
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',
|
|
2849
2537
|
'dx', 'dy'], _SHAPE_UPDATE_DEPS);
|
|
2850
|
-
|
|
2851
2538
|
var DefaultElementLifeCycleContribution = /*#__PURE__*/function () {
|
|
2852
2539
|
function DefaultElementLifeCycleContribution(context) {
|
|
2853
2540
|
this.context = void 0;
|
|
2854
2541
|
this.context = context;
|
|
2855
2542
|
}
|
|
2856
|
-
|
|
2857
2543
|
var _proto = DefaultElementLifeCycleContribution.prototype;
|
|
2858
|
-
|
|
2859
2544
|
_proto.createElement = function createElement(object) {
|
|
2860
2545
|
var doc = this.context.config.document;
|
|
2861
2546
|
var type = SHAPE2TAGS[object.nodeName] || 'g';
|
|
2862
2547
|
return createSVGElement(type, doc || document);
|
|
2863
2548
|
};
|
|
2864
|
-
|
|
2865
2549
|
_proto.destroyElement = function destroyElement(object, $el) {};
|
|
2866
|
-
|
|
2867
2550
|
_proto.shouldUpdateElementAttribute = function shouldUpdateElementAttribute(object, attributeName) {
|
|
2868
2551
|
var nodeName = object.nodeName;
|
|
2869
2552
|
return (SHAPE_UPDATE_DEPS[nodeName] || []).indexOf(attributeName) > -1;
|
|
2870
2553
|
};
|
|
2871
|
-
|
|
2872
2554
|
_proto.updateElementAttribute = function updateElementAttribute(object) {
|
|
2873
2555
|
// @ts-ignore
|
|
2874
2556
|
var $el = object.elementSVG.$el;
|
|
2875
2557
|
var nodeName = object.nodeName,
|
|
2876
|
-
|
|
2877
|
-
|
|
2558
|
+
parsedStyle = object.parsedStyle;
|
|
2878
2559
|
switch (nodeName) {
|
|
2879
2560
|
case gLite.Shape.IMAGE:
|
|
2880
2561
|
{
|
|
2881
2562
|
updateImageElementAttribute($el, parsedStyle);
|
|
2882
2563
|
break;
|
|
2883
2564
|
}
|
|
2884
|
-
|
|
2885
2565
|
case gLite.Shape.RECT:
|
|
2886
2566
|
{
|
|
2887
2567
|
updateRectElementAttribute($el, parsedStyle);
|
|
2888
2568
|
break;
|
|
2889
2569
|
}
|
|
2890
|
-
|
|
2891
2570
|
case gLite.Shape.LINE:
|
|
2892
2571
|
{
|
|
2893
2572
|
updateLineElementAttribute($el, parsedStyle);
|
|
2894
2573
|
break;
|
|
2895
2574
|
}
|
|
2896
|
-
|
|
2897
2575
|
case gLite.Shape.POLYGON:
|
|
2898
2576
|
case gLite.Shape.POLYLINE:
|
|
2899
2577
|
{
|
|
2900
2578
|
updatePolylineElementAttribute($el, parsedStyle);
|
|
2901
2579
|
break;
|
|
2902
2580
|
}
|
|
2903
|
-
|
|
2904
2581
|
case gLite.Shape.PATH:
|
|
2905
2582
|
{
|
|
2906
2583
|
updatePathElementAttribute($el, parsedStyle);
|
|
2907
2584
|
break;
|
|
2908
2585
|
}
|
|
2909
|
-
|
|
2910
2586
|
case gLite.Shape.TEXT:
|
|
2911
2587
|
{
|
|
2912
2588
|
updateTextElementAttribute($el, parsedStyle);
|
|
@@ -2914,38 +2590,32 @@
|
|
|
2914
2590
|
}
|
|
2915
2591
|
}
|
|
2916
2592
|
};
|
|
2917
|
-
|
|
2918
2593
|
return DefaultElementLifeCycleContribution;
|
|
2919
2594
|
}();
|
|
2920
|
-
|
|
2921
2595
|
var FILTER_PREFIX = 'g-filter-';
|
|
2922
2596
|
/**
|
|
2923
2597
|
* use SVG filters, eg. blur, brightness, contrast...
|
|
2924
2598
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/filter
|
|
2925
2599
|
*/
|
|
2926
|
-
|
|
2927
2600
|
function createOrUpdateFilter(document, $def, object, $el, filters) {
|
|
2928
2601
|
// eg. filter="url(#f1) url(#f2)"
|
|
2929
2602
|
var filterName = FILTER_PREFIX + object.entity;
|
|
2930
2603
|
var $existedFilters = $def.querySelectorAll("[name=" + filterName + "]");
|
|
2931
|
-
|
|
2932
2604
|
if ($existedFilters.length) {
|
|
2933
2605
|
$existedFilters.forEach(function ($filter) {
|
|
2934
2606
|
$def.removeChild($filter);
|
|
2935
2607
|
});
|
|
2936
2608
|
}
|
|
2937
|
-
|
|
2938
2609
|
if (filters.length === 0) {
|
|
2939
2610
|
// 'none'
|
|
2940
2611
|
$el === null || $el === void 0 ? void 0 : $el.removeAttribute('filter');
|
|
2941
2612
|
} else {
|
|
2942
2613
|
var filterIds = filters.map(function (_ref, i) {
|
|
2943
2614
|
var name = _ref.name,
|
|
2944
|
-
|
|
2945
|
-
var $filter = createSVGElement('filter', document);
|
|
2946
|
-
|
|
2615
|
+
params = _ref.params;
|
|
2616
|
+
var $filter = createSVGElement('filter', document);
|
|
2617
|
+
// @see https://github.com/antvis/g/issues/1025
|
|
2947
2618
|
$filter.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
2948
|
-
|
|
2949
2619
|
if (name === 'blur') {
|
|
2950
2620
|
createBlur(document, $filter, params);
|
|
2951
2621
|
} else if (name === 'brightness') {
|
|
@@ -2965,13 +2635,12 @@
|
|
|
2965
2635
|
} else if (name === 'invert') {
|
|
2966
2636
|
createInvert(document, $filter, params);
|
|
2967
2637
|
}
|
|
2968
|
-
|
|
2969
2638
|
$filter.id = filterName + "-" + i;
|
|
2970
2639
|
$filter.setAttribute('name', filterName);
|
|
2971
2640
|
$def.appendChild($filter);
|
|
2972
2641
|
return $filter.id;
|
|
2973
|
-
});
|
|
2974
|
-
|
|
2642
|
+
});
|
|
2643
|
+
// @see https://github.com/antvis/G/issues/1114
|
|
2975
2644
|
setTimeout(function () {
|
|
2976
2645
|
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', filterIds.map(function (filterId) {
|
|
2977
2646
|
return "url(#" + filterId + ")";
|
|
@@ -2979,43 +2648,36 @@
|
|
|
2979
2648
|
});
|
|
2980
2649
|
}
|
|
2981
2650
|
}
|
|
2982
|
-
|
|
2983
2651
|
function convertToAbsoluteValue(param) {
|
|
2984
2652
|
return param.unit === gLite.UnitType.kPercentage ? param.value / 100 : param.value;
|
|
2985
2653
|
}
|
|
2986
2654
|
/**
|
|
2987
2655
|
* @see https://drafts.fxtf.org/filter-effects/#blurEquivalent
|
|
2988
2656
|
*/
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
2657
|
function createBlur(document, $filter, params) {
|
|
2992
2658
|
var $feGaussianBlur = createSVGElement('feGaussianBlur', document);
|
|
2993
2659
|
$feGaussianBlur.setAttribute('in', 'SourceGraphic');
|
|
2994
2660
|
$feGaussianBlur.setAttribute('stdDeviation', "" + params[0].value);
|
|
2995
2661
|
$filter.appendChild($feGaussianBlur);
|
|
2996
2662
|
}
|
|
2997
|
-
|
|
2998
2663
|
function createFeComponentTransfer(document, $filter, _ref2) {
|
|
2999
2664
|
var type = _ref2.type,
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
2665
|
+
slope = _ref2.slope,
|
|
2666
|
+
intercept = _ref2.intercept,
|
|
2667
|
+
tableValues = _ref2.tableValues;
|
|
3003
2668
|
var $feComponentTransfer = createSVGElement('feComponentTransfer', document);
|
|
3004
2669
|
[createSVGElement('feFuncR', document), createSVGElement('feFuncG', document), createSVGElement('feFuncB', document)].forEach(function ($feFunc) {
|
|
3005
2670
|
$feFunc.setAttribute('type', type);
|
|
3006
|
-
|
|
3007
2671
|
if (type === 'table') {
|
|
3008
2672
|
$feFunc.setAttribute('tableValues', "" + tableValues);
|
|
3009
2673
|
} else {
|
|
3010
2674
|
$feFunc.setAttribute('slope', "" + slope);
|
|
3011
2675
|
$feFunc.setAttribute('intercept', "" + intercept);
|
|
3012
2676
|
}
|
|
3013
|
-
|
|
3014
2677
|
$feComponentTransfer.appendChild($feFunc);
|
|
3015
2678
|
});
|
|
3016
2679
|
$filter.appendChild($feComponentTransfer);
|
|
3017
2680
|
}
|
|
3018
|
-
|
|
3019
2681
|
function createContrast(document, $filter, params) {
|
|
3020
2682
|
var slope = convertToAbsoluteValue(params[0]);
|
|
3021
2683
|
createFeComponentTransfer(document, $filter, {
|
|
@@ -3024,7 +2686,6 @@
|
|
|
3024
2686
|
intercept: -(0.5 * slope) + 0.5
|
|
3025
2687
|
});
|
|
3026
2688
|
}
|
|
3027
|
-
|
|
3028
2689
|
function createInvert(document, $filter, params) {
|
|
3029
2690
|
var amount = convertToAbsoluteValue(params[0]);
|
|
3030
2691
|
createFeComponentTransfer(document, $filter, {
|
|
@@ -3032,7 +2693,6 @@
|
|
|
3032
2693
|
tableValues: amount + " " + (1 - amount)
|
|
3033
2694
|
});
|
|
3034
2695
|
}
|
|
3035
|
-
|
|
3036
2696
|
function createBrightness(document, $filter, params) {
|
|
3037
2697
|
var slope = convertToAbsoluteValue(params[0]);
|
|
3038
2698
|
createFeComponentTransfer(document, $filter, {
|
|
@@ -3041,7 +2701,6 @@
|
|
|
3041
2701
|
intercept: 0
|
|
3042
2702
|
});
|
|
3043
2703
|
}
|
|
3044
|
-
|
|
3045
2704
|
function createSaturate(document, $filter, params) {
|
|
3046
2705
|
var amount = convertToAbsoluteValue(params[0]);
|
|
3047
2706
|
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
@@ -3049,19 +2708,17 @@
|
|
|
3049
2708
|
$feColorMatrix.setAttribute('values', "" + amount);
|
|
3050
2709
|
$filter.appendChild($feColorMatrix);
|
|
3051
2710
|
}
|
|
3052
|
-
|
|
3053
2711
|
function createHueRotate(document, $filter, params) {
|
|
3054
2712
|
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
3055
2713
|
$feColorMatrix.setAttribute('type', 'hueRotate');
|
|
3056
2714
|
$feColorMatrix.setAttribute('values', "" + params[0].to(gLite.UnitType.kDegrees).value);
|
|
3057
2715
|
$filter.appendChild($feColorMatrix);
|
|
3058
2716
|
}
|
|
3059
|
-
|
|
3060
2717
|
function createDropShadow(document, $filter, params) {
|
|
3061
2718
|
var shadowOffsetX = params[0].value;
|
|
3062
2719
|
var shadowOffsetY = params[1].value;
|
|
3063
|
-
var shadowBlur = params[2].value;
|
|
3064
|
-
|
|
2720
|
+
var shadowBlur = params[2].value;
|
|
2721
|
+
// @ts-ignore
|
|
3065
2722
|
var shadowColor = params[3].formatted;
|
|
3066
2723
|
var $feGaussianBlur = createSVGElement('feGaussianBlur', document);
|
|
3067
2724
|
$feGaussianBlur.setAttribute('in', 'SourceAlpha');
|
|
@@ -3087,7 +2744,6 @@
|
|
|
3087
2744
|
$feMerge.appendChild($feMergeNode1);
|
|
3088
2745
|
$feMerge.appendChild($feMergeNode2);
|
|
3089
2746
|
}
|
|
3090
|
-
|
|
3091
2747
|
function createFeColorMatrix(document, $filter, matrix) {
|
|
3092
2748
|
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
3093
2749
|
$feColorMatrix.setAttribute('type', 'matrix');
|
|
@@ -3097,32 +2753,25 @@
|
|
|
3097
2753
|
/**
|
|
3098
2754
|
* @see https://drafts.fxtf.org/filter-effects/#grayscaleEquivalent
|
|
3099
2755
|
*/
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
2756
|
function createGrayscale(document, $filter, params) {
|
|
3103
2757
|
var amount = convertToAbsoluteValue(params[0]);
|
|
3104
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]);
|
|
3105
2759
|
}
|
|
3106
2760
|
/**
|
|
3107
2761
|
* @see https://drafts.fxtf.org/filter-effects/#sepiaEquivalent
|
|
3108
|
-
*/
|
|
3109
|
-
|
|
3110
|
-
|
|
2762
|
+
*/
|
|
3111
2763
|
function createSepia(document, $filter, params) {
|
|
3112
2764
|
var amount = convertToAbsoluteValue(params[0]);
|
|
3113
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]);
|
|
3114
2766
|
}
|
|
3115
|
-
|
|
3116
2767
|
var PATTERN_PREFIX = 'g-pattern-';
|
|
3117
2768
|
var cacheKey2IDMap = {};
|
|
3118
2769
|
var counter = 0;
|
|
3119
|
-
|
|
3120
2770
|
function createOrUpdateGradientAndPattern(document, $def, object, $el, parsedColor, name, createImage) {
|
|
3121
2771
|
// eg. clipPath don't have fill/stroke
|
|
3122
2772
|
if (!parsedColor) {
|
|
3123
2773
|
return '';
|
|
3124
2774
|
}
|
|
3125
|
-
|
|
3126
2775
|
if (parsedColor instanceof gLite.CSSRGB) {
|
|
3127
2776
|
// keep using currentColor @see https://github.com/d3/d3-axis/issues/49
|
|
3128
2777
|
if (object.style[name] === 'currentColor') {
|
|
@@ -3132,9 +2781,9 @@
|
|
|
3132
2781
|
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, parsedColor.isNone ? 'none' : parsedColor.toString());
|
|
3133
2782
|
}
|
|
3134
2783
|
} else if (gLite.isPattern(parsedColor)) {
|
|
3135
|
-
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>
|
|
3136
2786
|
// @see https://stackoverflow.com/a/7723115
|
|
3137
|
-
|
|
3138
2787
|
$el.style[name] = "url(#" + patternId + ")";
|
|
3139
2788
|
return patternId;
|
|
3140
2789
|
} else {
|
|
@@ -3150,36 +2799,30 @@
|
|
|
3150
2799
|
return filterId;
|
|
3151
2800
|
}
|
|
3152
2801
|
}
|
|
3153
|
-
|
|
3154
2802
|
return '';
|
|
3155
2803
|
}
|
|
3156
|
-
|
|
3157
2804
|
function generateCacheKey(src, options) {
|
|
3158
2805
|
if (options === void 0) {
|
|
3159
2806
|
options = {};
|
|
3160
2807
|
}
|
|
3161
|
-
|
|
3162
2808
|
var cacheKey = '';
|
|
3163
|
-
|
|
3164
2809
|
if (src instanceof gLite.CSSGradientValue) {
|
|
3165
2810
|
var type = src.type,
|
|
3166
|
-
|
|
3167
|
-
|
|
2811
|
+
value = src.value;
|
|
3168
2812
|
if (type === gLite.GradientType.LinearGradient || type === gLite.GradientType.RadialGradient) {
|
|
3169
2813
|
// @ts-ignore
|
|
3170
2814
|
var _value$options = _extends({}, value, options),
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
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;
|
|
3180
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) {
|
|
3181
2824
|
var offset = _ref.offset,
|
|
3182
|
-
|
|
2825
|
+
color = _ref.color;
|
|
3183
2826
|
return "" + offset + color;
|
|
3184
2827
|
}).join('-');
|
|
3185
2828
|
}
|
|
@@ -3190,25 +2833,20 @@
|
|
|
3190
2833
|
cacheKey = "pattern-" + counter;
|
|
3191
2834
|
}
|
|
3192
2835
|
}
|
|
3193
|
-
|
|
3194
2836
|
if (cacheKey) {
|
|
3195
2837
|
if (!cacheKey2IDMap[cacheKey]) {
|
|
3196
2838
|
cacheKey2IDMap[cacheKey] = PATTERN_PREFIX + ("" + counter++);
|
|
3197
2839
|
}
|
|
3198
2840
|
}
|
|
3199
|
-
|
|
3200
2841
|
return cacheKey2IDMap[cacheKey];
|
|
3201
2842
|
}
|
|
3202
|
-
|
|
3203
2843
|
function createOrUpdatePattern(document, $def, object, pattern, createImage) {
|
|
3204
2844
|
var patternId = generateCacheKey(pattern);
|
|
3205
2845
|
var $existed = $def.querySelector("#" + patternId);
|
|
3206
|
-
|
|
3207
2846
|
if (!$existed) {
|
|
3208
2847
|
var image = pattern.image,
|
|
3209
|
-
|
|
2848
|
+
repetition = pattern.repetition;
|
|
3210
2849
|
var imageURL = '';
|
|
3211
|
-
|
|
3212
2850
|
if (isString(image)) {
|
|
3213
2851
|
imageURL = image;
|
|
3214
2852
|
} else {
|
|
@@ -3220,7 +2858,6 @@
|
|
|
3220
2858
|
} else ;
|
|
3221
2859
|
}
|
|
3222
2860
|
}
|
|
3223
|
-
|
|
3224
2861
|
if (imageURL) {
|
|
3225
2862
|
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/pattern
|
|
3226
2863
|
var $pattern = createSVGElement('pattern', document);
|
|
@@ -3228,37 +2865,30 @@
|
|
|
3228
2865
|
var $image = createSVGElement('image', document);
|
|
3229
2866
|
$pattern.appendChild($image);
|
|
3230
2867
|
$pattern.id = patternId;
|
|
3231
|
-
$def.appendChild($pattern);
|
|
2868
|
+
$def.appendChild($pattern);
|
|
2869
|
+
// use href instead of xlink:href
|
|
3232
2870
|
// @see https://stackoverflow.com/a/13379007
|
|
3233
|
-
|
|
3234
2871
|
$image.setAttribute('href', imageURL);
|
|
3235
2872
|
var img;
|
|
3236
|
-
|
|
3237
2873
|
if (createImage) {
|
|
3238
2874
|
img = createImage(imageURL);
|
|
3239
2875
|
} else if (gLite.isBrowser) {
|
|
3240
2876
|
img = new window.Image();
|
|
3241
2877
|
}
|
|
3242
|
-
|
|
3243
2878
|
if (!imageURL.match(/^data:/i)) {
|
|
3244
2879
|
img.crossOrigin = 'Anonymous';
|
|
3245
2880
|
$image.setAttribute('crossorigin', 'anonymous');
|
|
3246
2881
|
}
|
|
3247
|
-
|
|
3248
2882
|
img.src = imageURL;
|
|
3249
|
-
|
|
3250
2883
|
var onload = function onload() {
|
|
3251
2884
|
$pattern.setAttribute('x', '0');
|
|
3252
2885
|
$pattern.setAttribute('y', '0');
|
|
3253
|
-
|
|
3254
2886
|
var _object$getGeometryBo = object.getGeometryBounds(),
|
|
3255
|
-
|
|
2887
|
+
halfExtents = _object$getGeometryBo.halfExtents;
|
|
2888
|
+
// There is no equivalent to CSS no-repeat for SVG patterns
|
|
3256
2889
|
// @see https://stackoverflow.com/a/33481956
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
2890
|
var patternWidth = img.width;
|
|
3260
2891
|
var patternHeight = img.height;
|
|
3261
|
-
|
|
3262
2892
|
if (repetition === 'repeat-x') {
|
|
3263
2893
|
patternHeight = halfExtents[1] * 2;
|
|
3264
2894
|
} else if (repetition === 'repeat-y') {
|
|
@@ -3267,7 +2897,6 @@
|
|
|
3267
2897
|
patternWidth = halfExtents[0] * 2;
|
|
3268
2898
|
patternHeight = halfExtents[1] * 2;
|
|
3269
2899
|
}
|
|
3270
|
-
|
|
3271
2900
|
$pattern.setAttribute('width', "" + patternWidth);
|
|
3272
2901
|
$pattern.setAttribute('height', "" + patternHeight);
|
|
3273
2902
|
$image.setAttribute('x', '0');
|
|
@@ -3275,20 +2904,17 @@
|
|
|
3275
2904
|
$image.setAttribute('width', "" + img.width);
|
|
3276
2905
|
$image.setAttribute('height', "" + img.height);
|
|
3277
2906
|
};
|
|
3278
|
-
|
|
3279
2907
|
if (img.complete) {
|
|
3280
2908
|
onload();
|
|
3281
2909
|
} else {
|
|
3282
|
-
img.onload = onload;
|
|
3283
|
-
|
|
2910
|
+
img.onload = onload;
|
|
2911
|
+
// Fix onload() bug in IE9
|
|
3284
2912
|
img.src = img.src;
|
|
3285
2913
|
}
|
|
3286
2914
|
}
|
|
3287
2915
|
}
|
|
3288
|
-
|
|
3289
2916
|
return patternId;
|
|
3290
2917
|
}
|
|
3291
|
-
|
|
3292
2918
|
function createOrUpdateGradient(document, object, $def, $el, parsedColor) {
|
|
3293
2919
|
var bounds = object.getGeometryBounds();
|
|
3294
2920
|
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
@@ -3298,70 +2924,63 @@
|
|
|
3298
2924
|
height: height
|
|
3299
2925
|
});
|
|
3300
2926
|
var $existed = $def.querySelector("#" + gradientId);
|
|
3301
|
-
|
|
3302
2927
|
if (!$existed) {
|
|
3303
2928
|
// <linearGradient> <radialGradient>
|
|
3304
2929
|
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/linearGradient
|
|
3305
2930
|
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/radialGradient
|
|
3306
|
-
$existed = createSVGElement(parsedColor.type === gLite.GradientType.LinearGradient ? 'linearGradient' : 'radialGradient', document);
|
|
3307
|
-
|
|
3308
|
-
$existed.setAttribute('gradientUnits', 'userSpaceOnUse');
|
|
3309
|
-
|
|
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
|
|
3310
2935
|
var innerHTML = '';
|
|
3311
|
-
parsedColor.value.steps
|
|
2936
|
+
parsedColor.value.steps
|
|
2937
|
+
// sort by offset @see https://github.com/antvis/G/issues/1171
|
|
3312
2938
|
.sort(function (a, b) {
|
|
3313
2939
|
return a.offset.value - b.offset.value;
|
|
3314
2940
|
}).forEach(function (_ref2) {
|
|
3315
2941
|
var offset = _ref2.offset,
|
|
3316
|
-
|
|
3317
|
-
|
|
2942
|
+
color = _ref2.color;
|
|
2943
|
+
// TODO: support absolute unit like `px`
|
|
3318
2944
|
innerHTML += "<stop offset=\"" + offset.value / 100 + "\" stop-color=\"" + color + "\"></stop>";
|
|
3319
2945
|
});
|
|
3320
2946
|
$existed.innerHTML = innerHTML;
|
|
3321
2947
|
$existed.id = gradientId;
|
|
3322
2948
|
$def.appendChild($existed);
|
|
3323
2949
|
}
|
|
3324
|
-
|
|
3325
2950
|
if (parsedColor.type === gLite.GradientType.LinearGradient) {
|
|
3326
2951
|
var angle = parsedColor.value.angle;
|
|
3327
|
-
|
|
3328
2952
|
var _computeLinearGradien = gLite.computeLinearGradient(width, height, angle),
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
2953
|
+
x1 = _computeLinearGradien.x1,
|
|
2954
|
+
y1 = _computeLinearGradien.y1,
|
|
2955
|
+
x2 = _computeLinearGradien.x2,
|
|
2956
|
+
y2 = _computeLinearGradien.y2;
|
|
3334
2957
|
$existed.setAttribute('x1', "" + x1);
|
|
3335
2958
|
$existed.setAttribute('y1', "" + y1);
|
|
3336
2959
|
$existed.setAttribute('x2', "" + x2);
|
|
3337
|
-
$existed.setAttribute('y2', "" + y2);
|
|
2960
|
+
$existed.setAttribute('y2', "" + y2);
|
|
2961
|
+
// $existed.setAttribute('gradientTransform', `rotate(${angle})`);
|
|
3338
2962
|
} else {
|
|
3339
2963
|
var _parsedColor$value = parsedColor.value,
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
2964
|
+
cx = _parsedColor$value.cx,
|
|
2965
|
+
cy = _parsedColor$value.cy,
|
|
2966
|
+
size = _parsedColor$value.size;
|
|
3344
2967
|
var _computeRadialGradien = gLite.computeRadialGradient(width, height, cx, cy, size),
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
2968
|
+
x = _computeRadialGradien.x,
|
|
2969
|
+
y = _computeRadialGradien.y,
|
|
2970
|
+
r = _computeRadialGradien.r;
|
|
3349
2971
|
$existed.setAttribute('cx', "" + x);
|
|
3350
2972
|
$existed.setAttribute('cy', "" + y);
|
|
3351
2973
|
$existed.setAttribute('r', "" + r);
|
|
3352
2974
|
}
|
|
3353
|
-
|
|
3354
2975
|
return gradientId;
|
|
3355
2976
|
}
|
|
3356
|
-
|
|
3357
2977
|
function createOrUpdateMultiGradient(document, object, $def, $el, gradients) {
|
|
3358
2978
|
var filterId = FILTER_PREFIX + object.entity + '-gradient';
|
|
3359
2979
|
var $existed = $def.querySelector("#" + filterId);
|
|
3360
|
-
|
|
3361
2980
|
if (!$existed) {
|
|
3362
2981
|
$existed = createSVGElement('filter', document);
|
|
3363
|
-
$existed.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
3364
|
-
|
|
2982
|
+
$existed.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
2983
|
+
// @see https://github.com/antvis/g/issues/1025
|
|
3365
2984
|
$existed.setAttribute('x', '0%');
|
|
3366
2985
|
$existed.setAttribute('y', '0%');
|
|
3367
2986
|
$existed.setAttribute('width', '100%');
|
|
@@ -3378,8 +2997,6 @@
|
|
|
3378
2997
|
<feComposite in="blendedGrad" in2="SourceGraphic" operator="in"/>
|
|
3379
2998
|
</filter>
|
|
3380
2999
|
*/
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
3000
|
var blended = 0;
|
|
3384
3001
|
gradients.forEach(function (gradient, i) {
|
|
3385
3002
|
var gradientId = createOrUpdateGradient(document, object, $def, $el, gradient);
|
|
@@ -3396,13 +3013,12 @@
|
|
|
3396
3013
|
$feImage.setAttribute('href', "#" + rectId);
|
|
3397
3014
|
$feImage.setAttribute('result', filterId + "-" + i);
|
|
3398
3015
|
$existed.appendChild($feImage);
|
|
3399
|
-
|
|
3400
3016
|
if (i > 0) {
|
|
3401
3017
|
var $feBlend = createSVGElement('feBlend', document);
|
|
3402
3018
|
$feBlend.setAttribute('in', i === 1 ? filterId + "-" + (i - 1) : filterId + "-blended-" + (blended - 1));
|
|
3403
3019
|
$feBlend.setAttribute('in2', filterId + "-" + i);
|
|
3404
|
-
$feBlend.setAttribute('result', filterId + "-blended-" + blended++);
|
|
3405
|
-
|
|
3020
|
+
$feBlend.setAttribute('result', filterId + "-blended-" + blended++);
|
|
3021
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/blend-mode
|
|
3406
3022
|
$feBlend.setAttribute('mode', 'multiply');
|
|
3407
3023
|
$existed.appendChild($feBlend);
|
|
3408
3024
|
}
|
|
@@ -3414,36 +3030,31 @@
|
|
|
3414
3030
|
$existed.appendChild($feComposite);
|
|
3415
3031
|
return filterId;
|
|
3416
3032
|
}
|
|
3417
|
-
|
|
3418
3033
|
var FILTER_DROPSHADOW_PREFIX = 'g-filter-dropshadow-';
|
|
3419
3034
|
/**
|
|
3420
3035
|
* use SVG filters
|
|
3421
3036
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/filter
|
|
3422
3037
|
*/
|
|
3423
|
-
|
|
3424
3038
|
function createOrUpdateShadow(document, $def, object, $el, name) {
|
|
3425
3039
|
var _object$parsedStyle = object.parsedStyle,
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
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;
|
|
3431
3045
|
var hasShadow = !isNil(shadowColor) && shadowBlur > 0;
|
|
3432
3046
|
var shadowId = FILTER_DROPSHADOW_PREFIX + object.entity;
|
|
3433
3047
|
var $existedFilter = $def.querySelector("#" + shadowId);
|
|
3434
|
-
|
|
3435
3048
|
if ($existedFilter) {
|
|
3436
3049
|
var existedShadowType = $existedFilter.getAttribute('data-type');
|
|
3437
|
-
|
|
3438
3050
|
if (existedShadowType !== shadowType || !hasShadow) {
|
|
3439
3051
|
// remove existed shadow
|
|
3440
3052
|
$existedFilter.remove();
|
|
3441
3053
|
$existedFilter = null;
|
|
3442
3054
|
}
|
|
3443
|
-
}
|
|
3055
|
+
}
|
|
3056
|
+
// <Group> also has shadowType as its default value
|
|
3444
3057
|
// only apply shadow when blur > 0
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
3058
|
if (hasShadow) {
|
|
3448
3059
|
// use filter <feDropShadow>
|
|
3449
3060
|
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow
|
|
@@ -3452,11 +3063,9 @@
|
|
|
3452
3063
|
$el === null || $el === void 0 ? void 0 : $el.removeAttribute('filter');
|
|
3453
3064
|
return;
|
|
3454
3065
|
}
|
|
3455
|
-
|
|
3456
3066
|
if (!$existedFilter) {
|
|
3457
3067
|
$existedFilter = createSVGElement('filter', document);
|
|
3458
3068
|
$existedFilter.setAttribute('data-type', shadowType);
|
|
3459
|
-
|
|
3460
3069
|
if (shadowType === 'outer') {
|
|
3461
3070
|
var $feDropShadow = createSVGElement('feDropShadow', document);
|
|
3462
3071
|
$feDropShadow.setAttribute('dx', "" + (shadowOffsetX || 0) / 2);
|
|
@@ -3500,19 +3109,16 @@
|
|
|
3500
3109
|
$feMerge.appendChild($feMergeNode);
|
|
3501
3110
|
$feMerge.appendChild($feMergeNode2);
|
|
3502
3111
|
}
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3112
|
+
$existedFilter.id = shadowId;
|
|
3113
|
+
// @see https://github.com/antvis/g/issues/1025
|
|
3506
3114
|
$existedFilter.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
3507
3115
|
$def.appendChild($existedFilter);
|
|
3508
3116
|
return;
|
|
3509
3117
|
}
|
|
3510
|
-
|
|
3511
3118
|
if (shadowType === 'inner') {
|
|
3512
3119
|
var _$feGaussianBlur = $existedFilter.children[1];
|
|
3513
3120
|
var _$feOffset = $existedFilter.children[2];
|
|
3514
3121
|
var _$feFlood = $existedFilter.children[3];
|
|
3515
|
-
|
|
3516
3122
|
if (name === 'shadowColor') {
|
|
3517
3123
|
_$feFlood.setAttribute('flood-color', shadowColor.toString());
|
|
3518
3124
|
} else if (name === 'shadowBlur') {
|
|
@@ -3527,7 +3133,6 @@
|
|
|
3527
3133
|
}
|
|
3528
3134
|
} else if (shadowType === 'outer') {
|
|
3529
3135
|
var _$feDropShadow = $existedFilter.children[0];
|
|
3530
|
-
|
|
3531
3136
|
if (name === 'shadowColor') {
|
|
3532
3137
|
_$feDropShadow.setAttribute('flood-color', shadowColor.toString());
|
|
3533
3138
|
} else if (name === 'shadowBlur') {
|
|
@@ -3542,9 +3147,7 @@
|
|
|
3542
3147
|
}
|
|
3543
3148
|
}
|
|
3544
3149
|
}
|
|
3545
|
-
|
|
3546
3150
|
var urlRegexp = /url\(#(.*)\)/;
|
|
3547
|
-
|
|
3548
3151
|
var DefElementManager = /*#__PURE__*/function () {
|
|
3549
3152
|
function DefElementManager(context) {
|
|
3550
3153
|
this.context = void 0;
|
|
@@ -3555,123 +3158,98 @@
|
|
|
3555
3158
|
/**
|
|
3556
3159
|
* container for <gradient> <clipPath>...
|
|
3557
3160
|
*/
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
3161
|
var _proto = DefElementManager.prototype;
|
|
3561
|
-
|
|
3562
3162
|
_proto.getDefElement = function getDefElement() {
|
|
3563
3163
|
return this.$def;
|
|
3564
3164
|
};
|
|
3565
|
-
|
|
3566
3165
|
_proto.init = function init() {
|
|
3567
3166
|
var document = this.context.config.document;
|
|
3568
3167
|
var $svg = this.context.contextService.getContext();
|
|
3569
3168
|
this.$def = createSVGElement('defs', document);
|
|
3570
3169
|
$svg.appendChild(this.$def);
|
|
3571
3170
|
};
|
|
3572
|
-
|
|
3573
3171
|
_proto.clear = function clear(entity) {
|
|
3574
3172
|
var _this = this;
|
|
3575
|
-
|
|
3576
3173
|
Object.keys(this.gradientCache).forEach(function (id) {
|
|
3577
3174
|
_this.clearUnusedDefElement(_this.gradientCache, id, entity);
|
|
3578
3175
|
});
|
|
3579
3176
|
};
|
|
3580
|
-
|
|
3581
3177
|
_proto.clearUnusedDefElement = function clearUnusedDefElement(cache, id, entity) {
|
|
3582
3178
|
if (cache[id] && cache[id].size === 1 && cache[id].has(entity)) {
|
|
3583
3179
|
var targetElement = this.$def.querySelector("#" + id);
|
|
3584
|
-
|
|
3585
3180
|
if (targetElement) {
|
|
3586
3181
|
this.$def.removeChild(targetElement);
|
|
3587
3182
|
}
|
|
3588
3183
|
}
|
|
3589
3184
|
};
|
|
3590
|
-
|
|
3591
3185
|
_proto.createOrUpdateGradientAndPattern = function createOrUpdateGradientAndPattern$1(object, $el, parsedColor, name) {
|
|
3592
3186
|
var _this$context$config = this.context.config,
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3187
|
+
doc = _this$context$config.document,
|
|
3188
|
+
createImage = _this$context$config.createImage;
|
|
3596
3189
|
if ($el) {
|
|
3597
|
-
var _$el$getAttribute;
|
|
3598
|
-
|
|
3599
|
-
|
|
3190
|
+
var _$el$getAttribute;
|
|
3191
|
+
// `url(#${gradientId})`
|
|
3600
3192
|
var matches = (_$el$getAttribute = $el.getAttribute(name)) === null || _$el$getAttribute === void 0 ? void 0 : _$el$getAttribute.match(urlRegexp);
|
|
3601
|
-
|
|
3602
3193
|
if (matches && matches.length > 1) {
|
|
3603
3194
|
this.clearUnusedDefElement(this.gradientCache, matches[1], object.entity);
|
|
3604
3195
|
}
|
|
3605
|
-
|
|
3606
3196
|
var newDefElementId = createOrUpdateGradientAndPattern(doc || document, this.$def, object, $el, parsedColor, name, createImage);
|
|
3607
|
-
|
|
3608
3197
|
if (!this.gradientCache[newDefElementId]) {
|
|
3609
3198
|
this.gradientCache[newDefElementId] = new Set();
|
|
3610
3199
|
}
|
|
3611
|
-
|
|
3612
3200
|
this.gradientCache[newDefElementId].add(object.entity);
|
|
3613
3201
|
}
|
|
3614
3202
|
};
|
|
3615
|
-
|
|
3616
3203
|
_proto.createOrUpdateShadow = function createOrUpdateShadow$1(object, $el, name) {
|
|
3617
3204
|
var doc = this.context.config.document;
|
|
3618
3205
|
createOrUpdateShadow(doc || document, this.$def, object, $el, name);
|
|
3619
3206
|
};
|
|
3620
|
-
|
|
3621
3207
|
_proto.createOrUpdateFilter = function createOrUpdateFilter$1(object, $el, filters) {
|
|
3622
3208
|
var doc = this.context.config.document;
|
|
3623
3209
|
createOrUpdateFilter(doc || document, this.$def, object, $el, filters);
|
|
3624
3210
|
};
|
|
3625
|
-
|
|
3626
3211
|
return DefElementManager;
|
|
3627
3212
|
}();
|
|
3628
|
-
|
|
3629
3213
|
var Plugin$1 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
3630
3214
|
_inheritsLoose$2(Plugin, _AbstractRendererPlug);
|
|
3631
|
-
|
|
3632
3215
|
function Plugin(options) {
|
|
3633
3216
|
var _this;
|
|
3634
|
-
|
|
3635
3217
|
if (options === void 0) {
|
|
3636
3218
|
options = {};
|
|
3637
3219
|
}
|
|
3638
|
-
|
|
3639
3220
|
_this = _AbstractRendererPlug.call(this) || this;
|
|
3640
3221
|
_this.options = void 0;
|
|
3641
3222
|
_this.name = 'svg-renderer';
|
|
3642
3223
|
_this.options = options;
|
|
3643
3224
|
return _this;
|
|
3644
3225
|
}
|
|
3645
|
-
|
|
3646
3226
|
var _proto = Plugin.prototype;
|
|
3647
|
-
|
|
3648
3227
|
_proto.init = function init() {
|
|
3649
3228
|
var _this$options = this.options,
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
var defElementManager = new DefElementManager(this.context);
|
|
3653
|
-
|
|
3654
|
-
var defaultElementLifeCycleContribution = new DefaultElementLifeCycleContribution(this.context);
|
|
3655
|
-
|
|
3656
|
-
this.context.defaultElementLifeCycleContribution = defaultElementLifeCycleContribution;
|
|
3657
|
-
|
|
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
|
|
3658
3237
|
this.context.SVGElementLifeCycleContribution = defaultElementLifeCycleContribution;
|
|
3659
3238
|
var SVGRendererPluginOptions = {
|
|
3660
3239
|
outputSVGElementId: !isNil(outputSVGElementId) ? !!outputSVGElementId : true,
|
|
3661
3240
|
outputSVGElementName: !isNil(outputSVGElementName) ? !!outputSVGElementName : true
|
|
3662
3241
|
};
|
|
3663
|
-
this.addRenderingPlugin(
|
|
3242
|
+
this.addRenderingPlugin(
|
|
3243
|
+
// @ts-ignore
|
|
3664
3244
|
new SVGRendererPlugin(SVGRendererPluginOptions, defElementManager, this.context));
|
|
3665
3245
|
};
|
|
3666
|
-
|
|
3667
3246
|
_proto.destroy = function destroy() {
|
|
3668
|
-
this.removeAllRenderingPlugins();
|
|
3669
|
-
|
|
3670
|
-
delete this.context.defaultElementLifeCycleContribution;
|
|
3671
|
-
|
|
3247
|
+
this.removeAllRenderingPlugins();
|
|
3248
|
+
// @ts-ignore
|
|
3249
|
+
delete this.context.defaultElementLifeCycleContribution;
|
|
3250
|
+
// @ts-ignore
|
|
3672
3251
|
delete this.context.SVGElementLifeCycleContribution;
|
|
3673
3252
|
};
|
|
3674
|
-
|
|
3675
3253
|
return Plugin;
|
|
3676
3254
|
}(gLite.AbstractRendererPlugin);
|
|
3677
3255
|
|
|
@@ -3698,19 +3276,19 @@
|
|
|
3698
3276
|
});
|
|
3699
3277
|
|
|
3700
3278
|
function _regeneratorRuntime$3() {
|
|
3701
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3702
3279
|
_regeneratorRuntime$3 = function _regeneratorRuntime() {
|
|
3703
3280
|
return exports;
|
|
3704
3281
|
};
|
|
3705
|
-
|
|
3706
3282
|
var exports = {},
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
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";
|
|
3714
3292
|
function define(obj, key, value) {
|
|
3715
3293
|
return Object.defineProperty(obj, key, {
|
|
3716
3294
|
value: value,
|
|
@@ -3719,7 +3297,6 @@
|
|
|
3719
3297
|
writable: !0
|
|
3720
3298
|
}), obj[key];
|
|
3721
3299
|
}
|
|
3722
|
-
|
|
3723
3300
|
try {
|
|
3724
3301
|
define({}, "");
|
|
3725
3302
|
} catch (err) {
|
|
@@ -3727,54 +3304,14 @@
|
|
|
3727
3304
|
return obj[key] = value;
|
|
3728
3305
|
};
|
|
3729
3306
|
}
|
|
3730
|
-
|
|
3731
3307
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
3732
3308
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
return generator
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
3739
|
-
|
|
3740
|
-
if ("completed" === state) {
|
|
3741
|
-
if ("throw" === method) throw arg;
|
|
3742
|
-
return doneResult();
|
|
3743
|
-
}
|
|
3744
|
-
|
|
3745
|
-
for (context.method = method, context.arg = arg;;) {
|
|
3746
|
-
var delegate = context.delegate;
|
|
3747
|
-
|
|
3748
|
-
if (delegate) {
|
|
3749
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
3750
|
-
|
|
3751
|
-
if (delegateResult) {
|
|
3752
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
3753
|
-
return delegateResult;
|
|
3754
|
-
}
|
|
3755
|
-
}
|
|
3756
|
-
|
|
3757
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
3758
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
3759
|
-
context.dispatchException(context.arg);
|
|
3760
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
3761
|
-
state = "executing";
|
|
3762
|
-
var record = tryCatch(innerFn, self, context);
|
|
3763
|
-
|
|
3764
|
-
if ("normal" === record.type) {
|
|
3765
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
3766
|
-
return {
|
|
3767
|
-
value: record.arg,
|
|
3768
|
-
done: context.done
|
|
3769
|
-
};
|
|
3770
|
-
}
|
|
3771
|
-
|
|
3772
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
3773
|
-
}
|
|
3774
|
-
};
|
|
3775
|
-
}(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;
|
|
3776
3314
|
}
|
|
3777
|
-
|
|
3778
3315
|
function tryCatch(fn, obj, arg) {
|
|
3779
3316
|
try {
|
|
3780
3317
|
return {
|
|
@@ -3788,25 +3325,19 @@
|
|
|
3788
3325
|
};
|
|
3789
3326
|
}
|
|
3790
3327
|
}
|
|
3791
|
-
|
|
3792
3328
|
exports.wrap = wrap;
|
|
3793
3329
|
var ContinueSentinel = {};
|
|
3794
|
-
|
|
3795
3330
|
function Generator() {}
|
|
3796
|
-
|
|
3797
3331
|
function GeneratorFunction() {}
|
|
3798
|
-
|
|
3799
3332
|
function GeneratorFunctionPrototype() {}
|
|
3800
|
-
|
|
3801
3333
|
var IteratorPrototype = {};
|
|
3802
3334
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
3803
3335
|
return this;
|
|
3804
3336
|
});
|
|
3805
3337
|
var getProto = Object.getPrototypeOf,
|
|
3806
|
-
|
|
3338
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
3807
3339
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
3808
3340
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
3809
|
-
|
|
3810
3341
|
function defineIteratorMethods(prototype) {
|
|
3811
3342
|
["next", "throw", "return"].forEach(function (method) {
|
|
3812
3343
|
define(prototype, method, function (arg) {
|
|
@@ -3814,14 +3345,12 @@
|
|
|
3814
3345
|
});
|
|
3815
3346
|
});
|
|
3816
3347
|
}
|
|
3817
|
-
|
|
3818
3348
|
function AsyncIterator(generator, PromiseImpl) {
|
|
3819
3349
|
function invoke(method, arg, resolve, reject) {
|
|
3820
3350
|
var record = tryCatch(generator[method], generator, arg);
|
|
3821
|
-
|
|
3822
3351
|
if ("throw" !== record.type) {
|
|
3823
3352
|
var result = record.arg,
|
|
3824
|
-
|
|
3353
|
+
value = result.value;
|
|
3825
3354
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
3826
3355
|
invoke("next", value, resolve, reject);
|
|
3827
3356
|
}, function (err) {
|
|
@@ -3832,92 +3361,116 @@
|
|
|
3832
3361
|
return invoke("throw", error, resolve, reject);
|
|
3833
3362
|
});
|
|
3834
3363
|
}
|
|
3835
|
-
|
|
3836
3364
|
reject(record.arg);
|
|
3837
3365
|
}
|
|
3838
|
-
|
|
3839
3366
|
var previousPromise;
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
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);
|
|
3846
3409
|
}
|
|
3847
|
-
|
|
3848
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
3849
3410
|
};
|
|
3850
3411
|
}
|
|
3851
|
-
|
|
3852
3412
|
function maybeInvokeDelegate(delegate, context) {
|
|
3853
3413
|
var method = delegate.iterator[context.method];
|
|
3854
|
-
|
|
3855
3414
|
if (undefined === method) {
|
|
3856
3415
|
if (context.delegate = null, "throw" === context.method) {
|
|
3857
3416
|
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
3858
3417
|
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
3859
3418
|
}
|
|
3860
|
-
|
|
3861
3419
|
return ContinueSentinel;
|
|
3862
3420
|
}
|
|
3863
|
-
|
|
3864
3421
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
3865
3422
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
3866
3423
|
var info = record.arg;
|
|
3867
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);
|
|
3868
3425
|
}
|
|
3869
|
-
|
|
3870
3426
|
function pushTryEntry(locs) {
|
|
3871
3427
|
var entry = {
|
|
3872
3428
|
tryLoc: locs[0]
|
|
3873
3429
|
};
|
|
3874
3430
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
3875
3431
|
}
|
|
3876
|
-
|
|
3877
3432
|
function resetTryEntry(entry) {
|
|
3878
3433
|
var record = entry.completion || {};
|
|
3879
3434
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
3880
3435
|
}
|
|
3881
|
-
|
|
3882
3436
|
function Context(tryLocsList) {
|
|
3883
3437
|
this.tryEntries = [{
|
|
3884
3438
|
tryLoc: "root"
|
|
3885
3439
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
3886
3440
|
}
|
|
3887
|
-
|
|
3888
3441
|
function values(iterable) {
|
|
3889
3442
|
if (iterable) {
|
|
3890
3443
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
3891
3444
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
3892
3445
|
if ("function" == typeof iterable.next) return iterable;
|
|
3893
|
-
|
|
3894
3446
|
if (!isNaN(iterable.length)) {
|
|
3895
3447
|
var i = -1,
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
};
|
|
3903
|
-
|
|
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
|
+
};
|
|
3904
3454
|
return next.next = next;
|
|
3905
3455
|
}
|
|
3906
3456
|
}
|
|
3907
|
-
|
|
3908
3457
|
return {
|
|
3909
3458
|
next: doneResult
|
|
3910
3459
|
};
|
|
3911
3460
|
}
|
|
3912
|
-
|
|
3913
3461
|
function doneResult() {
|
|
3914
3462
|
return {
|
|
3915
3463
|
value: undefined,
|
|
3916
3464
|
done: !0
|
|
3917
3465
|
};
|
|
3918
3466
|
}
|
|
3919
|
-
|
|
3920
|
-
|
|
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) {
|
|
3921
3474
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
3922
3475
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
3923
3476
|
}, exports.mark = function (genFun) {
|
|
@@ -3938,19 +3491,17 @@
|
|
|
3938
3491
|
return this;
|
|
3939
3492
|
}), define(Gp, "toString", function () {
|
|
3940
3493
|
return "[object Generator]";
|
|
3941
|
-
}), exports.keys = function (
|
|
3942
|
-
var
|
|
3943
|
-
|
|
3494
|
+
}), exports.keys = function (val) {
|
|
3495
|
+
var object = Object(val),
|
|
3496
|
+
keys = [];
|
|
3944
3497
|
for (var key in object) {
|
|
3945
3498
|
keys.push(key);
|
|
3946
3499
|
}
|
|
3947
|
-
|
|
3948
3500
|
return keys.reverse(), function next() {
|
|
3949
3501
|
for (; keys.length;) {
|
|
3950
3502
|
var key = keys.pop();
|
|
3951
3503
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
3952
3504
|
}
|
|
3953
|
-
|
|
3954
3505
|
return next.done = !0, next;
|
|
3955
3506
|
};
|
|
3956
3507
|
}, exports.values = values, Context.prototype = {
|
|
@@ -3969,20 +3520,16 @@
|
|
|
3969
3520
|
dispatchException: function dispatchException(exception) {
|
|
3970
3521
|
if (this.done) throw exception;
|
|
3971
3522
|
var context = this;
|
|
3972
|
-
|
|
3973
3523
|
function handle(loc, caught) {
|
|
3974
3524
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
3975
3525
|
}
|
|
3976
|
-
|
|
3977
3526
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3978
3527
|
var entry = this.tryEntries[i],
|
|
3979
|
-
|
|
3528
|
+
record = entry.completion;
|
|
3980
3529
|
if ("root" === entry.tryLoc) return handle("end");
|
|
3981
|
-
|
|
3982
3530
|
if (entry.tryLoc <= this.prev) {
|
|
3983
3531
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
3984
|
-
|
|
3985
|
-
|
|
3532
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
3986
3533
|
if (hasCatch && hasFinally) {
|
|
3987
3534
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
3988
3535
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -3998,13 +3545,11 @@
|
|
|
3998
3545
|
abrupt: function abrupt(type, arg) {
|
|
3999
3546
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
4000
3547
|
var entry = this.tryEntries[i];
|
|
4001
|
-
|
|
4002
3548
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
4003
3549
|
var finallyEntry = entry;
|
|
4004
3550
|
break;
|
|
4005
3551
|
}
|
|
4006
3552
|
}
|
|
4007
|
-
|
|
4008
3553
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
4009
3554
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
4010
3555
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -4022,19 +3567,15 @@
|
|
|
4022
3567
|
catch: function _catch(tryLoc) {
|
|
4023
3568
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
4024
3569
|
var entry = this.tryEntries[i];
|
|
4025
|
-
|
|
4026
3570
|
if (entry.tryLoc === tryLoc) {
|
|
4027
3571
|
var record = entry.completion;
|
|
4028
|
-
|
|
4029
3572
|
if ("throw" === record.type) {
|
|
4030
3573
|
var thrown = record.arg;
|
|
4031
3574
|
resetTryEntry(entry);
|
|
4032
3575
|
}
|
|
4033
|
-
|
|
4034
3576
|
return thrown;
|
|
4035
3577
|
}
|
|
4036
3578
|
}
|
|
4037
|
-
|
|
4038
3579
|
throw new Error("illegal catch attempt");
|
|
4039
3580
|
},
|
|
4040
3581
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -4046,7 +3587,6 @@
|
|
|
4046
3587
|
}
|
|
4047
3588
|
}, exports;
|
|
4048
3589
|
}
|
|
4049
|
-
|
|
4050
3590
|
function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4051
3591
|
try {
|
|
4052
3592
|
var info = gen[key](arg);
|
|
@@ -4055,41 +3595,33 @@
|
|
|
4055
3595
|
reject(error);
|
|
4056
3596
|
return;
|
|
4057
3597
|
}
|
|
4058
|
-
|
|
4059
3598
|
if (info.done) {
|
|
4060
3599
|
resolve(value);
|
|
4061
3600
|
} else {
|
|
4062
3601
|
Promise.resolve(value).then(_next, _throw);
|
|
4063
3602
|
}
|
|
4064
3603
|
}
|
|
4065
|
-
|
|
4066
3604
|
function _asyncToGenerator$3(fn) {
|
|
4067
3605
|
return function () {
|
|
4068
3606
|
var self = this,
|
|
4069
|
-
|
|
3607
|
+
args = arguments;
|
|
4070
3608
|
return new Promise(function (resolve, reject) {
|
|
4071
3609
|
var gen = fn.apply(self, args);
|
|
4072
|
-
|
|
4073
3610
|
function _next(value) {
|
|
4074
3611
|
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
|
|
4075
3612
|
}
|
|
4076
|
-
|
|
4077
3613
|
function _throw(err) {
|
|
4078
3614
|
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
|
|
4079
3615
|
}
|
|
4080
|
-
|
|
4081
3616
|
_next(undefined);
|
|
4082
3617
|
});
|
|
4083
3618
|
};
|
|
4084
3619
|
}
|
|
4085
|
-
|
|
4086
3620
|
function _inheritsLoose$3(subClass, superClass) {
|
|
4087
3621
|
subClass.prototype = Object.create(superClass.prototype);
|
|
4088
3622
|
subClass.prototype.constructor = subClass;
|
|
4089
|
-
|
|
4090
3623
|
_setPrototypeOf$3(subClass, superClass);
|
|
4091
3624
|
}
|
|
4092
|
-
|
|
4093
3625
|
function _setPrototypeOf$3(o, p) {
|
|
4094
3626
|
_setPrototypeOf$3 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
4095
3627
|
o.__proto__ = p;
|
|
@@ -4097,7 +3629,6 @@
|
|
|
4097
3629
|
};
|
|
4098
3630
|
return _setPrototypeOf$3(o, p);
|
|
4099
3631
|
}
|
|
4100
|
-
|
|
4101
3632
|
function _unsupportedIterableToArray(o, minLen) {
|
|
4102
3633
|
if (!o) return;
|
|
4103
3634
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -4106,21 +3637,16 @@
|
|
|
4106
3637
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
4107
3638
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
4108
3639
|
}
|
|
4109
|
-
|
|
4110
3640
|
function _arrayLikeToArray(arr, len) {
|
|
4111
3641
|
if (len == null || len > arr.length) len = arr.length;
|
|
4112
|
-
|
|
4113
3642
|
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
4114
3643
|
arr2[i] = arr[i];
|
|
4115
3644
|
}
|
|
4116
|
-
|
|
4117
3645
|
return arr2;
|
|
4118
3646
|
}
|
|
4119
|
-
|
|
4120
3647
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
4121
3648
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
4122
3649
|
if (it) return (it = it.call(o)).next.bind(it);
|
|
4123
|
-
|
|
4124
3650
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
4125
3651
|
if (it) o = it;
|
|
4126
3652
|
var i = 0;
|
|
@@ -4134,27 +3660,22 @@
|
|
|
4134
3660
|
};
|
|
4135
3661
|
};
|
|
4136
3662
|
}
|
|
4137
|
-
|
|
4138
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.");
|
|
4139
3664
|
}
|
|
3665
|
+
|
|
4140
3666
|
/**
|
|
4141
3667
|
* pick shape(s) with Mouse/Touch event
|
|
4142
3668
|
*
|
|
4143
3669
|
* 1. find AABB with r-tree
|
|
4144
3670
|
* 2. use elementFromPoint
|
|
4145
3671
|
*/
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
3672
|
var SVGPickerPlugin = /*#__PURE__*/function () {
|
|
4149
3673
|
function SVGPickerPlugin() {}
|
|
4150
|
-
|
|
4151
3674
|
var _proto = SVGPickerPlugin.prototype;
|
|
4152
|
-
|
|
4153
3675
|
_proto.apply = function apply(context) {
|
|
4154
3676
|
var _this = this;
|
|
4155
|
-
|
|
4156
3677
|
var doc = context.config.document,
|
|
4157
|
-
|
|
3678
|
+
renderingService = context.renderingService;
|
|
4158
3679
|
renderingService.hooks.pick.tapPromise(SVGPickerPlugin.tag, /*#__PURE__*/function () {
|
|
4159
3680
|
var _ref = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee(result) {
|
|
4160
3681
|
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
@@ -4162,7 +3683,6 @@
|
|
|
4162
3683
|
switch (_context.prev = _context.next) {
|
|
4163
3684
|
case 0:
|
|
4164
3685
|
return _context.abrupt("return", _this.pick(doc, result));
|
|
4165
|
-
|
|
4166
3686
|
case 1:
|
|
4167
3687
|
case "end":
|
|
4168
3688
|
return _context.stop();
|
|
@@ -4170,7 +3690,6 @@
|
|
|
4170
3690
|
}
|
|
4171
3691
|
}, _callee);
|
|
4172
3692
|
}));
|
|
4173
|
-
|
|
4174
3693
|
return function (_x) {
|
|
4175
3694
|
return _ref.apply(this, arguments);
|
|
4176
3695
|
};
|
|
@@ -4179,28 +3698,24 @@
|
|
|
4179
3698
|
return _this.pick(doc, result);
|
|
4180
3699
|
});
|
|
4181
3700
|
};
|
|
4182
|
-
|
|
4183
3701
|
_proto.pick = function pick(doc, result) {
|
|
4184
3702
|
var topmost = result.topmost,
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
3703
|
+
_result$position = result.position,
|
|
3704
|
+
clientX = _result$position.clientX,
|
|
3705
|
+
clientY = _result$position.clientY;
|
|
4189
3706
|
try {
|
|
4190
|
-
var targets = [];
|
|
4191
|
-
|
|
3707
|
+
var targets = [];
|
|
3708
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/elementsFromPoint
|
|
4192
3709
|
for (var _iterator = _createForOfIteratorHelperLoose((doc || document).elementsFromPoint(clientX, clientY)), _step; !(_step = _iterator()).done;) {
|
|
4193
|
-
var element = _step.value;
|
|
4194
|
-
|
|
3710
|
+
var element = _step.value;
|
|
3711
|
+
// eg. g_svg_circle_345
|
|
4195
3712
|
var id = element && element.getAttribute('id');
|
|
4196
|
-
|
|
4197
3713
|
if (id && id.startsWith(G_SVG_PREFIX)) {
|
|
4198
3714
|
var index = id.lastIndexOf('-');
|
|
4199
|
-
var target = gLite.runtime.displayObjectPool.getByEntity(id.substring(index + 1));
|
|
4200
|
-
|
|
3715
|
+
var target = gLite.runtime.displayObjectPool.getByEntity(id.substring(index + 1));
|
|
3716
|
+
// don't need to account for `visibility` since DOM API already does
|
|
4201
3717
|
if (target && target.isInteractive()) {
|
|
4202
3718
|
targets.push(target);
|
|
4203
|
-
|
|
4204
3719
|
if (topmost) {
|
|
4205
3720
|
result.picked = targets;
|
|
4206
3721
|
return result;
|
|
@@ -4208,45 +3723,33 @@
|
|
|
4208
3723
|
}
|
|
4209
3724
|
}
|
|
4210
3725
|
}
|
|
4211
|
-
|
|
4212
3726
|
result.picked = targets;
|
|
4213
3727
|
} catch (e) {
|
|
4214
3728
|
result.picked = [];
|
|
4215
3729
|
}
|
|
4216
|
-
|
|
4217
3730
|
return result;
|
|
4218
3731
|
};
|
|
4219
|
-
|
|
4220
3732
|
return SVGPickerPlugin;
|
|
4221
3733
|
}();
|
|
4222
|
-
|
|
4223
3734
|
SVGPickerPlugin.tag = 'SVGPicker';
|
|
4224
|
-
|
|
4225
3735
|
var Plugin$2 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
4226
3736
|
_inheritsLoose$3(Plugin, _AbstractRendererPlug);
|
|
4227
|
-
|
|
4228
3737
|
function Plugin() {
|
|
4229
3738
|
var _this;
|
|
4230
|
-
|
|
4231
3739
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4232
3740
|
args[_key] = arguments[_key];
|
|
4233
3741
|
}
|
|
4234
|
-
|
|
4235
3742
|
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
4236
3743
|
_this.name = 'svg-picker';
|
|
4237
3744
|
return _this;
|
|
4238
3745
|
}
|
|
4239
|
-
|
|
4240
3746
|
var _proto = Plugin.prototype;
|
|
4241
|
-
|
|
4242
3747
|
_proto.init = function init() {
|
|
4243
3748
|
this.addRenderingPlugin(new SVGPickerPlugin());
|
|
4244
3749
|
};
|
|
4245
|
-
|
|
4246
3750
|
_proto.destroy = function destroy() {
|
|
4247
3751
|
this.removeAllRenderingPlugins();
|
|
4248
3752
|
};
|
|
4249
|
-
|
|
4250
3753
|
return Plugin;
|
|
4251
3754
|
}(gLite.AbstractRendererPlugin);
|
|
4252
3755
|
|
|
@@ -4263,38 +3766,30 @@
|
|
|
4263
3766
|
this.canvasConfig = void 0;
|
|
4264
3767
|
this.canvasConfig = context.config;
|
|
4265
3768
|
}
|
|
4266
|
-
|
|
4267
3769
|
var _proto = SVGContextService.prototype;
|
|
4268
|
-
|
|
4269
3770
|
_proto.init = /*#__PURE__*/function () {
|
|
4270
3771
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
4271
3772
|
var _this$canvasConfig, container, doc, devicePixelRatio, $namespace, dpr;
|
|
4272
|
-
|
|
4273
3773
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4274
3774
|
while (1) {
|
|
4275
3775
|
switch (_context.prev = _context.next) {
|
|
4276
3776
|
case 0:
|
|
4277
3777
|
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document, devicePixelRatio = _this$canvasConfig.devicePixelRatio; // create container
|
|
4278
|
-
|
|
4279
3778
|
this.$container = isString(container) ? (doc || document).getElementById(container) : container;
|
|
4280
|
-
|
|
4281
3779
|
if (this.$container) {
|
|
4282
3780
|
if (!this.$container.style.position) {
|
|
4283
3781
|
this.$container.style.position = 'relative';
|
|
4284
3782
|
}
|
|
4285
|
-
|
|
4286
3783
|
$namespace = createSVGElement('svg', doc);
|
|
4287
3784
|
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
4288
3785
|
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
4289
3786
|
this.$container.appendChild($namespace);
|
|
4290
3787
|
this.$namespace = $namespace;
|
|
4291
|
-
}
|
|
4292
|
-
|
|
4293
|
-
|
|
3788
|
+
}
|
|
3789
|
+
// use user-defined dpr first
|
|
4294
3790
|
dpr = devicePixelRatio || gLite.isBrowser && window.devicePixelRatio || 1;
|
|
4295
3791
|
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
4296
3792
|
this.dpr = dpr;
|
|
4297
|
-
|
|
4298
3793
|
case 6:
|
|
4299
3794
|
case "end":
|
|
4300
3795
|
return _context.stop();
|
|
@@ -4302,40 +3797,31 @@
|
|
|
4302
3797
|
}
|
|
4303
3798
|
}, _callee, this);
|
|
4304
3799
|
}));
|
|
4305
|
-
|
|
4306
3800
|
function init() {
|
|
4307
3801
|
return _init.apply(this, arguments);
|
|
4308
3802
|
}
|
|
4309
|
-
|
|
4310
3803
|
return init;
|
|
4311
3804
|
}() // @ts-ignore
|
|
4312
3805
|
;
|
|
4313
|
-
|
|
4314
3806
|
_proto.getDomElement = function getDomElement() {
|
|
4315
3807
|
return this.$namespace;
|
|
4316
3808
|
};
|
|
4317
|
-
|
|
4318
3809
|
_proto.getContext = function getContext() {
|
|
4319
3810
|
return this.$namespace;
|
|
4320
3811
|
};
|
|
4321
|
-
|
|
4322
3812
|
_proto.getDPR = function getDPR() {
|
|
4323
3813
|
return this.dpr;
|
|
4324
3814
|
};
|
|
4325
|
-
|
|
4326
3815
|
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
4327
3816
|
var _this$$namespace;
|
|
4328
|
-
|
|
4329
3817
|
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
4330
3818
|
};
|
|
4331
|
-
|
|
4332
3819
|
_proto.destroy = function destroy() {
|
|
4333
3820
|
// destroy context
|
|
4334
3821
|
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
4335
3822
|
this.$container.removeChild(this.$namespace);
|
|
4336
3823
|
}
|
|
4337
3824
|
};
|
|
4338
|
-
|
|
4339
3825
|
_proto.resize = function resize(width, height) {
|
|
4340
3826
|
// SVG should ignore DPR
|
|
4341
3827
|
if (this.$namespace) {
|
|
@@ -4343,13 +3829,11 @@
|
|
|
4343
3829
|
this.$namespace.setAttribute('height', "" + height);
|
|
4344
3830
|
}
|
|
4345
3831
|
};
|
|
4346
|
-
|
|
4347
3832
|
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
|
|
4348
3833
|
if (this.$container) {
|
|
4349
3834
|
this.$container.style.cursor = cursor;
|
|
4350
3835
|
}
|
|
4351
3836
|
};
|
|
4352
|
-
|
|
4353
3837
|
_proto.toDataURL = /*#__PURE__*/function () {
|
|
4354
3838
|
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
4355
3839
|
var cloneNode, svgDocType, svgDoc;
|
|
@@ -4357,13 +3841,11 @@
|
|
|
4357
3841
|
while (1) {
|
|
4358
3842
|
switch (_context2.prev = _context2.next) {
|
|
4359
3843
|
case 0:
|
|
4360
|
-
|
|
4361
3844
|
cloneNode = this.$namespace.cloneNode(true);
|
|
4362
3845
|
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
4363
3846
|
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
4364
3847
|
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
4365
3848
|
return _context2.abrupt("return", "data:image/svg+xml;charset=utf8," + encodeURIComponent(new XMLSerializer().serializeToString(svgDoc)));
|
|
4366
|
-
|
|
4367
3849
|
case 6:
|
|
4368
3850
|
case "end":
|
|
4369
3851
|
return _context2.stop();
|
|
@@ -4371,71 +3853,52 @@
|
|
|
4371
3853
|
}
|
|
4372
3854
|
}, _callee2, this);
|
|
4373
3855
|
}));
|
|
4374
|
-
|
|
4375
3856
|
function toDataURL(_x) {
|
|
4376
3857
|
return _toDataURL.apply(this, arguments);
|
|
4377
3858
|
}
|
|
4378
|
-
|
|
4379
3859
|
return toDataURL;
|
|
4380
3860
|
}();
|
|
4381
|
-
|
|
4382
3861
|
return SVGContextService;
|
|
4383
3862
|
}();
|
|
4384
3863
|
|
|
4385
3864
|
var ContextRegisterPlugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
4386
3865
|
_inheritsLoose(ContextRegisterPlugin, _AbstractRendererPlug);
|
|
4387
|
-
|
|
4388
3866
|
function ContextRegisterPlugin() {
|
|
4389
3867
|
var _this;
|
|
4390
|
-
|
|
4391
3868
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4392
3869
|
args[_key] = arguments[_key];
|
|
4393
3870
|
}
|
|
4394
|
-
|
|
4395
3871
|
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
4396
3872
|
_this.name = 'svg-context-register';
|
|
4397
3873
|
return _this;
|
|
4398
3874
|
}
|
|
4399
|
-
|
|
4400
3875
|
var _proto = ContextRegisterPlugin.prototype;
|
|
4401
|
-
|
|
4402
3876
|
_proto.init = function init() {
|
|
4403
3877
|
// @ts-ignore
|
|
4404
3878
|
this.context.ContextService = SVGContextService;
|
|
4405
3879
|
};
|
|
4406
|
-
|
|
4407
3880
|
_proto.destroy = function destroy() {
|
|
4408
3881
|
delete this.context.ContextService;
|
|
4409
3882
|
};
|
|
4410
|
-
|
|
4411
3883
|
return ContextRegisterPlugin;
|
|
4412
3884
|
}(gLite.AbstractRendererPlugin);
|
|
4413
3885
|
|
|
4414
3886
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
4415
3887
|
_inheritsLoose(Renderer, _AbstractRenderer);
|
|
4416
|
-
|
|
4417
3888
|
function Renderer(config) {
|
|
4418
3889
|
var _this;
|
|
4419
|
-
|
|
4420
3890
|
if (config === void 0) {
|
|
4421
3891
|
config = {};
|
|
4422
3892
|
}
|
|
4423
|
-
|
|
4424
3893
|
_this = _AbstractRenderer.call(this, config) || this;
|
|
4425
|
-
|
|
4426
3894
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
4427
|
-
|
|
4428
3895
|
_this.registerPlugin(new Plugin$1({
|
|
4429
3896
|
outputSVGElementId: config.outputSVGElementId
|
|
4430
3897
|
}));
|
|
4431
|
-
|
|
4432
3898
|
_this.registerPlugin(new Plugin());
|
|
4433
|
-
|
|
4434
3899
|
_this.registerPlugin(new Plugin$2());
|
|
4435
|
-
|
|
4436
3900
|
return _this;
|
|
4437
3901
|
}
|
|
4438
|
-
|
|
4439
3902
|
return Renderer;
|
|
4440
3903
|
}(gLite.AbstractRenderer);
|
|
4441
3904
|
|