@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.js
CHANGED
|
@@ -33,20 +33,19 @@ var SVGPicker__namespace = /*#__PURE__*/_interopNamespace(SVGPicker);
|
|
|
33
33
|
var SVGRenderer__namespace = /*#__PURE__*/_interopNamespace(SVGRenderer);
|
|
34
34
|
|
|
35
35
|
function _regeneratorRuntime() {
|
|
36
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
37
|
-
|
|
38
36
|
_regeneratorRuntime = function () {
|
|
39
37
|
return exports;
|
|
40
38
|
};
|
|
41
|
-
|
|
42
39
|
var exports = {},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
Op = Object.prototype,
|
|
41
|
+
hasOwn = Op.hasOwnProperty,
|
|
42
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
43
|
+
obj[key] = desc.value;
|
|
44
|
+
},
|
|
45
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
46
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
47
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
48
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
50
49
|
function define(obj, key, value) {
|
|
51
50
|
return Object.defineProperty(obj, key, {
|
|
52
51
|
value: value,
|
|
@@ -55,7 +54,6 @@ function _regeneratorRuntime() {
|
|
|
55
54
|
writable: !0
|
|
56
55
|
}), obj[key];
|
|
57
56
|
}
|
|
58
|
-
|
|
59
57
|
try {
|
|
60
58
|
define({}, "");
|
|
61
59
|
} catch (err) {
|
|
@@ -63,54 +61,14 @@ function _regeneratorRuntime() {
|
|
|
63
61
|
return obj[key] = value;
|
|
64
62
|
};
|
|
65
63
|
}
|
|
66
|
-
|
|
67
64
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
68
65
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return generator
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
75
|
-
|
|
76
|
-
if ("completed" === state) {
|
|
77
|
-
if ("throw" === method) throw arg;
|
|
78
|
-
return doneResult();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
for (context.method = method, context.arg = arg;;) {
|
|
82
|
-
var delegate = context.delegate;
|
|
83
|
-
|
|
84
|
-
if (delegate) {
|
|
85
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
86
|
-
|
|
87
|
-
if (delegateResult) {
|
|
88
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
89
|
-
return delegateResult;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
94
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
95
|
-
context.dispatchException(context.arg);
|
|
96
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
97
|
-
state = "executing";
|
|
98
|
-
var record = tryCatch(innerFn, self, context);
|
|
99
|
-
|
|
100
|
-
if ("normal" === record.type) {
|
|
101
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
102
|
-
return {
|
|
103
|
-
value: record.arg,
|
|
104
|
-
done: context.done
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}(innerFn, self, context), generator;
|
|
66
|
+
generator = Object.create(protoGenerator.prototype),
|
|
67
|
+
context = new Context(tryLocsList || []);
|
|
68
|
+
return defineProperty(generator, "_invoke", {
|
|
69
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
70
|
+
}), generator;
|
|
112
71
|
}
|
|
113
|
-
|
|
114
72
|
function tryCatch(fn, obj, arg) {
|
|
115
73
|
try {
|
|
116
74
|
return {
|
|
@@ -124,25 +82,19 @@ function _regeneratorRuntime() {
|
|
|
124
82
|
};
|
|
125
83
|
}
|
|
126
84
|
}
|
|
127
|
-
|
|
128
85
|
exports.wrap = wrap;
|
|
129
86
|
var ContinueSentinel = {};
|
|
130
|
-
|
|
131
87
|
function Generator() {}
|
|
132
|
-
|
|
133
88
|
function GeneratorFunction() {}
|
|
134
|
-
|
|
135
89
|
function GeneratorFunctionPrototype() {}
|
|
136
|
-
|
|
137
90
|
var IteratorPrototype = {};
|
|
138
91
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
139
92
|
return this;
|
|
140
93
|
});
|
|
141
94
|
var getProto = Object.getPrototypeOf,
|
|
142
|
-
|
|
95
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
143
96
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
144
97
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
145
|
-
|
|
146
98
|
function defineIteratorMethods(prototype) {
|
|
147
99
|
["next", "throw", "return"].forEach(function (method) {
|
|
148
100
|
define(prototype, method, function (arg) {
|
|
@@ -150,14 +102,12 @@ function _regeneratorRuntime() {
|
|
|
150
102
|
});
|
|
151
103
|
});
|
|
152
104
|
}
|
|
153
|
-
|
|
154
105
|
function AsyncIterator(generator, PromiseImpl) {
|
|
155
106
|
function invoke(method, arg, resolve, reject) {
|
|
156
107
|
var record = tryCatch(generator[method], generator, arg);
|
|
157
|
-
|
|
158
108
|
if ("throw" !== record.type) {
|
|
159
109
|
var result = record.arg,
|
|
160
|
-
|
|
110
|
+
value = result.value;
|
|
161
111
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
162
112
|
invoke("next", value, resolve, reject);
|
|
163
113
|
}, function (err) {
|
|
@@ -168,90 +118,114 @@ function _regeneratorRuntime() {
|
|
|
168
118
|
return invoke("throw", error, resolve, reject);
|
|
169
119
|
});
|
|
170
120
|
}
|
|
171
|
-
|
|
172
121
|
reject(record.arg);
|
|
173
122
|
}
|
|
174
|
-
|
|
175
123
|
var previousPromise;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
124
|
+
defineProperty(this, "_invoke", {
|
|
125
|
+
value: function (method, arg) {
|
|
126
|
+
function callInvokeWithMethodAndArg() {
|
|
127
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
128
|
+
invoke(method, arg, resolve, reject);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
136
|
+
var state = "suspendedStart";
|
|
137
|
+
return function (method, arg) {
|
|
138
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
139
|
+
if ("completed" === state) {
|
|
140
|
+
if ("throw" === method) throw arg;
|
|
141
|
+
return doneResult();
|
|
142
|
+
}
|
|
143
|
+
for (context.method = method, context.arg = arg;;) {
|
|
144
|
+
var delegate = context.delegate;
|
|
145
|
+
if (delegate) {
|
|
146
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
147
|
+
if (delegateResult) {
|
|
148
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
149
|
+
return delegateResult;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
153
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
154
|
+
context.dispatchException(context.arg);
|
|
155
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
156
|
+
state = "executing";
|
|
157
|
+
var record = tryCatch(innerFn, self, context);
|
|
158
|
+
if ("normal" === record.type) {
|
|
159
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
160
|
+
return {
|
|
161
|
+
value: record.arg,
|
|
162
|
+
done: context.done
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
182
166
|
}
|
|
183
|
-
|
|
184
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
185
167
|
};
|
|
186
168
|
}
|
|
187
|
-
|
|
188
169
|
function maybeInvokeDelegate(delegate, context) {
|
|
189
170
|
var method = delegate.iterator[context.method];
|
|
190
|
-
|
|
191
171
|
if (undefined === method) {
|
|
192
172
|
if (context.delegate = null, "throw" === context.method) {
|
|
193
173
|
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
194
174
|
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
195
175
|
}
|
|
196
|
-
|
|
197
176
|
return ContinueSentinel;
|
|
198
177
|
}
|
|
199
|
-
|
|
200
178
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
201
179
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
202
180
|
var info = record.arg;
|
|
203
181
|
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);
|
|
204
182
|
}
|
|
205
|
-
|
|
206
183
|
function pushTryEntry(locs) {
|
|
207
184
|
var entry = {
|
|
208
185
|
tryLoc: locs[0]
|
|
209
186
|
};
|
|
210
187
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
211
188
|
}
|
|
212
|
-
|
|
213
189
|
function resetTryEntry(entry) {
|
|
214
190
|
var record = entry.completion || {};
|
|
215
191
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
216
192
|
}
|
|
217
|
-
|
|
218
193
|
function Context(tryLocsList) {
|
|
219
194
|
this.tryEntries = [{
|
|
220
195
|
tryLoc: "root"
|
|
221
196
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
222
197
|
}
|
|
223
|
-
|
|
224
198
|
function values(iterable) {
|
|
225
199
|
if (iterable) {
|
|
226
200
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
227
201
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
228
202
|
if ("function" == typeof iterable.next) return iterable;
|
|
229
|
-
|
|
230
203
|
if (!isNaN(iterable.length)) {
|
|
231
204
|
var i = -1,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
};
|
|
237
|
-
|
|
205
|
+
next = function next() {
|
|
206
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
207
|
+
return next.value = undefined, next.done = !0, next;
|
|
208
|
+
};
|
|
238
209
|
return next.next = next;
|
|
239
210
|
}
|
|
240
211
|
}
|
|
241
|
-
|
|
242
212
|
return {
|
|
243
213
|
next: doneResult
|
|
244
214
|
};
|
|
245
215
|
}
|
|
246
|
-
|
|
247
216
|
function doneResult() {
|
|
248
217
|
return {
|
|
249
218
|
value: undefined,
|
|
250
219
|
done: !0
|
|
251
220
|
};
|
|
252
221
|
}
|
|
253
|
-
|
|
254
|
-
|
|
222
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
223
|
+
value: GeneratorFunctionPrototype,
|
|
224
|
+
configurable: !0
|
|
225
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
226
|
+
value: GeneratorFunction,
|
|
227
|
+
configurable: !0
|
|
228
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
255
229
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
256
230
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
257
231
|
}, exports.mark = function (genFun) {
|
|
@@ -272,17 +246,15 @@ function _regeneratorRuntime() {
|
|
|
272
246
|
return this;
|
|
273
247
|
}), define(Gp, "toString", function () {
|
|
274
248
|
return "[object Generator]";
|
|
275
|
-
}), exports.keys = function (
|
|
276
|
-
var
|
|
277
|
-
|
|
249
|
+
}), exports.keys = function (val) {
|
|
250
|
+
var object = Object(val),
|
|
251
|
+
keys = [];
|
|
278
252
|
for (var key in object) keys.push(key);
|
|
279
|
-
|
|
280
253
|
return keys.reverse(), function next() {
|
|
281
254
|
for (; keys.length;) {
|
|
282
255
|
var key = keys.pop();
|
|
283
256
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
284
257
|
}
|
|
285
|
-
|
|
286
258
|
return next.done = !0, next;
|
|
287
259
|
};
|
|
288
260
|
}, exports.values = values, Context.prototype = {
|
|
@@ -299,20 +271,16 @@ function _regeneratorRuntime() {
|
|
|
299
271
|
dispatchException: function (exception) {
|
|
300
272
|
if (this.done) throw exception;
|
|
301
273
|
var context = this;
|
|
302
|
-
|
|
303
274
|
function handle(loc, caught) {
|
|
304
275
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
305
276
|
}
|
|
306
|
-
|
|
307
277
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
308
278
|
var entry = this.tryEntries[i],
|
|
309
|
-
|
|
279
|
+
record = entry.completion;
|
|
310
280
|
if ("root" === entry.tryLoc) return handle("end");
|
|
311
|
-
|
|
312
281
|
if (entry.tryLoc <= this.prev) {
|
|
313
282
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
314
|
-
|
|
315
|
-
|
|
283
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
316
284
|
if (hasCatch && hasFinally) {
|
|
317
285
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
318
286
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -328,13 +296,11 @@ function _regeneratorRuntime() {
|
|
|
328
296
|
abrupt: function (type, arg) {
|
|
329
297
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
330
298
|
var entry = this.tryEntries[i];
|
|
331
|
-
|
|
332
299
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
333
300
|
var finallyEntry = entry;
|
|
334
301
|
break;
|
|
335
302
|
}
|
|
336
303
|
}
|
|
337
|
-
|
|
338
304
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
339
305
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
340
306
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -352,19 +318,15 @@ function _regeneratorRuntime() {
|
|
|
352
318
|
catch: function (tryLoc) {
|
|
353
319
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
354
320
|
var entry = this.tryEntries[i];
|
|
355
|
-
|
|
356
321
|
if (entry.tryLoc === tryLoc) {
|
|
357
322
|
var record = entry.completion;
|
|
358
|
-
|
|
359
323
|
if ("throw" === record.type) {
|
|
360
324
|
var thrown = record.arg;
|
|
361
325
|
resetTryEntry(entry);
|
|
362
326
|
}
|
|
363
|
-
|
|
364
327
|
return thrown;
|
|
365
328
|
}
|
|
366
329
|
}
|
|
367
|
-
|
|
368
330
|
throw new Error("illegal catch attempt");
|
|
369
331
|
},
|
|
370
332
|
delegateYield: function (iterable, resultName, nextLoc) {
|
|
@@ -376,7 +338,6 @@ function _regeneratorRuntime() {
|
|
|
376
338
|
}
|
|
377
339
|
}, exports;
|
|
378
340
|
}
|
|
379
|
-
|
|
380
341
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
381
342
|
try {
|
|
382
343
|
var info = gen[key](arg);
|
|
@@ -385,41 +346,33 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
385
346
|
reject(error);
|
|
386
347
|
return;
|
|
387
348
|
}
|
|
388
|
-
|
|
389
349
|
if (info.done) {
|
|
390
350
|
resolve(value);
|
|
391
351
|
} else {
|
|
392
352
|
Promise.resolve(value).then(_next, _throw);
|
|
393
353
|
}
|
|
394
354
|
}
|
|
395
|
-
|
|
396
355
|
function _asyncToGenerator(fn) {
|
|
397
356
|
return function () {
|
|
398
357
|
var self = this,
|
|
399
|
-
|
|
358
|
+
args = arguments;
|
|
400
359
|
return new Promise(function (resolve, reject) {
|
|
401
360
|
var gen = fn.apply(self, args);
|
|
402
|
-
|
|
403
361
|
function _next(value) {
|
|
404
362
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
405
363
|
}
|
|
406
|
-
|
|
407
364
|
function _throw(err) {
|
|
408
365
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
409
366
|
}
|
|
410
|
-
|
|
411
367
|
_next(undefined);
|
|
412
368
|
});
|
|
413
369
|
};
|
|
414
370
|
}
|
|
415
|
-
|
|
416
371
|
function _inheritsLoose(subClass, superClass) {
|
|
417
372
|
subClass.prototype = Object.create(superClass.prototype);
|
|
418
373
|
subClass.prototype.constructor = subClass;
|
|
419
|
-
|
|
420
374
|
_setPrototypeOf(subClass, superClass);
|
|
421
375
|
}
|
|
422
|
-
|
|
423
376
|
function _setPrototypeOf(o, p) {
|
|
424
377
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
425
378
|
o.__proto__ = p;
|
|
@@ -436,38 +389,30 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
436
389
|
this.canvasConfig = void 0;
|
|
437
390
|
this.canvasConfig = context.config;
|
|
438
391
|
}
|
|
439
|
-
|
|
440
392
|
var _proto = SVGContextService.prototype;
|
|
441
|
-
|
|
442
393
|
_proto.init = /*#__PURE__*/function () {
|
|
443
394
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
444
395
|
var _this$canvasConfig, container, doc, devicePixelRatio, $namespace, dpr;
|
|
445
|
-
|
|
446
396
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
447
397
|
while (1) {
|
|
448
398
|
switch (_context.prev = _context.next) {
|
|
449
399
|
case 0:
|
|
450
400
|
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document, devicePixelRatio = _this$canvasConfig.devicePixelRatio; // create container
|
|
451
|
-
|
|
452
401
|
this.$container = util.isString(container) ? (doc || document).getElementById(container) : container;
|
|
453
|
-
|
|
454
402
|
if (this.$container) {
|
|
455
403
|
if (!this.$container.style.position) {
|
|
456
404
|
this.$container.style.position = 'relative';
|
|
457
405
|
}
|
|
458
|
-
|
|
459
406
|
$namespace = SVGRenderer.createSVGElement('svg', doc);
|
|
460
407
|
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
461
408
|
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
462
409
|
this.$container.appendChild($namespace);
|
|
463
410
|
this.$namespace = $namespace;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
|
|
411
|
+
}
|
|
412
|
+
// use user-defined dpr first
|
|
467
413
|
dpr = devicePixelRatio || gLite.isBrowser && window.devicePixelRatio || 1;
|
|
468
414
|
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
469
415
|
this.dpr = dpr;
|
|
470
|
-
|
|
471
416
|
case 6:
|
|
472
417
|
case "end":
|
|
473
418
|
return _context.stop();
|
|
@@ -475,40 +420,31 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
475
420
|
}
|
|
476
421
|
}, _callee, this);
|
|
477
422
|
}));
|
|
478
|
-
|
|
479
423
|
function init() {
|
|
480
424
|
return _init.apply(this, arguments);
|
|
481
425
|
}
|
|
482
|
-
|
|
483
426
|
return init;
|
|
484
427
|
}() // @ts-ignore
|
|
485
428
|
;
|
|
486
|
-
|
|
487
429
|
_proto.getDomElement = function getDomElement() {
|
|
488
430
|
return this.$namespace;
|
|
489
431
|
};
|
|
490
|
-
|
|
491
432
|
_proto.getContext = function getContext() {
|
|
492
433
|
return this.$namespace;
|
|
493
434
|
};
|
|
494
|
-
|
|
495
435
|
_proto.getDPR = function getDPR() {
|
|
496
436
|
return this.dpr;
|
|
497
437
|
};
|
|
498
|
-
|
|
499
438
|
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
500
439
|
var _this$$namespace;
|
|
501
|
-
|
|
502
440
|
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
503
441
|
};
|
|
504
|
-
|
|
505
442
|
_proto.destroy = function destroy() {
|
|
506
443
|
// destroy context
|
|
507
444
|
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
508
445
|
this.$container.removeChild(this.$namespace);
|
|
509
446
|
}
|
|
510
447
|
};
|
|
511
|
-
|
|
512
448
|
_proto.resize = function resize(width, height) {
|
|
513
449
|
// SVG should ignore DPR
|
|
514
450
|
if (this.$namespace) {
|
|
@@ -516,13 +452,11 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
516
452
|
this.$namespace.setAttribute('height', "" + height);
|
|
517
453
|
}
|
|
518
454
|
};
|
|
519
|
-
|
|
520
455
|
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
|
|
521
456
|
if (this.$container) {
|
|
522
457
|
this.$container.style.cursor = cursor;
|
|
523
458
|
}
|
|
524
459
|
};
|
|
525
|
-
|
|
526
460
|
_proto.toDataURL = /*#__PURE__*/function () {
|
|
527
461
|
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
528
462
|
var cloneNode, svgDocType, svgDoc;
|
|
@@ -530,13 +464,11 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
530
464
|
while (1) {
|
|
531
465
|
switch (_context2.prev = _context2.next) {
|
|
532
466
|
case 0:
|
|
533
|
-
|
|
534
467
|
cloneNode = this.$namespace.cloneNode(true);
|
|
535
468
|
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
536
469
|
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
537
470
|
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
538
471
|
return _context2.abrupt("return", "data:image/svg+xml;charset=utf8," + encodeURIComponent(new XMLSerializer().serializeToString(svgDoc)));
|
|
539
|
-
|
|
540
472
|
case 6:
|
|
541
473
|
case "end":
|
|
542
474
|
return _context2.stop();
|
|
@@ -544,71 +476,52 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
544
476
|
}
|
|
545
477
|
}, _callee2, this);
|
|
546
478
|
}));
|
|
547
|
-
|
|
548
479
|
function toDataURL(_x) {
|
|
549
480
|
return _toDataURL.apply(this, arguments);
|
|
550
481
|
}
|
|
551
|
-
|
|
552
482
|
return toDataURL;
|
|
553
483
|
}();
|
|
554
|
-
|
|
555
484
|
return SVGContextService;
|
|
556
485
|
}();
|
|
557
486
|
|
|
558
487
|
var ContextRegisterPlugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
559
488
|
_inheritsLoose(ContextRegisterPlugin, _AbstractRendererPlug);
|
|
560
|
-
|
|
561
489
|
function ContextRegisterPlugin() {
|
|
562
490
|
var _this;
|
|
563
|
-
|
|
564
491
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
565
492
|
args[_key] = arguments[_key];
|
|
566
493
|
}
|
|
567
|
-
|
|
568
494
|
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
569
495
|
_this.name = 'svg-context-register';
|
|
570
496
|
return _this;
|
|
571
497
|
}
|
|
572
|
-
|
|
573
498
|
var _proto = ContextRegisterPlugin.prototype;
|
|
574
|
-
|
|
575
499
|
_proto.init = function init() {
|
|
576
500
|
// @ts-ignore
|
|
577
501
|
this.context.ContextService = SVGContextService;
|
|
578
502
|
};
|
|
579
|
-
|
|
580
503
|
_proto.destroy = function destroy() {
|
|
581
504
|
delete this.context.ContextService;
|
|
582
505
|
};
|
|
583
|
-
|
|
584
506
|
return ContextRegisterPlugin;
|
|
585
507
|
}(gLite.AbstractRendererPlugin);
|
|
586
508
|
|
|
587
509
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
588
510
|
_inheritsLoose(Renderer, _AbstractRenderer);
|
|
589
|
-
|
|
590
511
|
function Renderer(config) {
|
|
591
512
|
var _this;
|
|
592
|
-
|
|
593
513
|
if (config === void 0) {
|
|
594
514
|
config = {};
|
|
595
515
|
}
|
|
596
|
-
|
|
597
516
|
_this = _AbstractRenderer.call(this, config) || this;
|
|
598
|
-
|
|
599
517
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
600
|
-
|
|
601
518
|
_this.registerPlugin(new SVGRenderer.Plugin({
|
|
602
519
|
outputSVGElementId: config.outputSVGElementId
|
|
603
520
|
}));
|
|
604
|
-
|
|
605
521
|
_this.registerPlugin(new DomInteraction.Plugin());
|
|
606
|
-
|
|
607
522
|
_this.registerPlugin(new SVGPicker.Plugin());
|
|
608
|
-
|
|
609
523
|
return _this;
|
|
610
524
|
}
|
|
611
|
-
|
|
612
525
|
return Renderer;
|
|
613
526
|
}(gLite.AbstractRenderer);
|
|
614
527
|
|