@antv/g-svg 1.8.46 → 1.8.47
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 +122 -126
- package/dist/index.js +122 -126
- package/dist/index.umd.js +235 -225
- package/dist/index.umd.min.js +1 -1
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
|
@@ -526,9 +526,7 @@
|
|
|
526
526
|
if (!isNaN(iterable.length)) {
|
|
527
527
|
var i = -1,
|
|
528
528
|
next = function next() {
|
|
529
|
-
for (; ++i < iterable.length;)
|
|
530
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
531
|
-
}
|
|
529
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
532
530
|
return next.value = undefined, next.done = !0, next;
|
|
533
531
|
};
|
|
534
532
|
return next.next = next;
|
|
@@ -574,9 +572,7 @@
|
|
|
574
572
|
}), exports.keys = function (val) {
|
|
575
573
|
var object = Object(val),
|
|
576
574
|
keys = [];
|
|
577
|
-
for (var key in object)
|
|
578
|
-
keys.push(key);
|
|
579
|
-
}
|
|
575
|
+
for (var key in object) keys.push(key);
|
|
580
576
|
return keys.reverse(), function next() {
|
|
581
577
|
for (; keys.length;) {
|
|
582
578
|
var key = keys.pop();
|
|
@@ -587,9 +583,7 @@
|
|
|
587
583
|
}, exports.values = values, Context.prototype = {
|
|
588
584
|
constructor: Context,
|
|
589
585
|
reset: function reset(skipTempReset) {
|
|
590
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this)
|
|
591
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
592
|
-
}
|
|
586
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
593
587
|
},
|
|
594
588
|
stop: function stop() {
|
|
595
589
|
this.done = !0;
|
|
@@ -722,7 +716,8 @@
|
|
|
722
716
|
_proto.apply = function apply(context, runtime) {
|
|
723
717
|
var _this = this;
|
|
724
718
|
var renderingService = context.renderingService,
|
|
725
|
-
renderingContext = context.renderingContext
|
|
719
|
+
renderingContext = context.renderingContext,
|
|
720
|
+
config = context.config;
|
|
726
721
|
this.context = context;
|
|
727
722
|
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
728
723
|
// const SUPPORT_ONLY_TOUCH = canvas.supportsTouchEvents && MOBILE_REGEX.test(navigator.userAgent);
|
|
@@ -747,6 +742,9 @@
|
|
|
747
742
|
var onPointerWheel = function onPointerWheel(ev) {
|
|
748
743
|
renderingService.hooks.pointerWheel.call(ev);
|
|
749
744
|
};
|
|
745
|
+
var onClick = function onClick(ev) {
|
|
746
|
+
renderingService.hooks.click.call(ev);
|
|
747
|
+
};
|
|
750
748
|
var addPointerEventListener = function addPointerEventListener($el) {
|
|
751
749
|
runtime.globalThis.document.addEventListener('pointermove', onPointerMove, true);
|
|
752
750
|
$el.addEventListener('pointerdown', onPointerDown, true);
|
|
@@ -790,36 +788,37 @@
|
|
|
790
788
|
renderingService.hooks.init.tapPromise(DOMInteractionPlugin.tag, /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
791
789
|
var $el;
|
|
792
790
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
793
|
-
while (1) {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
791
|
+
while (1) switch (_context.prev = _context.next) {
|
|
792
|
+
case 0:
|
|
793
|
+
$el = _this.context.contextService.getDomElement(); // @ts-ignore
|
|
794
|
+
if (runtime.globalThis.navigator.msPointerEnabled) {
|
|
795
|
+
// @ts-ignore
|
|
796
|
+
$el.style.msContentZooming = 'none';
|
|
797
|
+
// @ts-ignore
|
|
798
|
+
$el.style.msTouchAction = 'none';
|
|
799
|
+
} else if (canvas.supportsPointerEvents) {
|
|
800
|
+
$el.style.touchAction = 'none';
|
|
801
|
+
}
|
|
802
|
+
if (canvas.supportsPointerEvents) {
|
|
803
|
+
addPointerEventListener($el);
|
|
804
|
+
} else {
|
|
805
|
+
addMouseEventListener($el);
|
|
806
|
+
}
|
|
807
|
+
if (canvas.supportsTouchEvents) {
|
|
808
|
+
addTouchEventListener($el);
|
|
809
|
+
}
|
|
810
|
+
if (config.useNativeClickEvent) {
|
|
811
|
+
$el.addEventListener('click', onClick, true);
|
|
812
|
+
}
|
|
813
|
+
// use passive event listeners
|
|
814
|
+
// @see https://zhuanlan.zhihu.com/p/24555031
|
|
815
|
+
$el.addEventListener('wheel', onPointerWheel, {
|
|
816
|
+
passive: true,
|
|
817
|
+
capture: true
|
|
818
|
+
});
|
|
819
|
+
case 6:
|
|
820
|
+
case "end":
|
|
821
|
+
return _context.stop();
|
|
823
822
|
}
|
|
824
823
|
}, _callee);
|
|
825
824
|
})));
|
|
@@ -842,6 +841,9 @@
|
|
|
842
841
|
if (canvas.supportsTouchEvents) {
|
|
843
842
|
removeTouchEventListener($el);
|
|
844
843
|
}
|
|
844
|
+
if (config.useNativeClickEvent) {
|
|
845
|
+
$el.removeEventListener('click', onClick, true);
|
|
846
|
+
}
|
|
845
847
|
$el.removeEventListener('wheel', onPointerWheel, true);
|
|
846
848
|
});
|
|
847
849
|
};
|
|
@@ -1181,9 +1183,7 @@
|
|
|
1181
1183
|
if (!isNaN(iterable.length)) {
|
|
1182
1184
|
var i = -1,
|
|
1183
1185
|
next = function next() {
|
|
1184
|
-
for (; ++i < iterable.length;)
|
|
1185
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1186
|
-
}
|
|
1186
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1187
1187
|
return next.value = undefined, next.done = !0, next;
|
|
1188
1188
|
};
|
|
1189
1189
|
return next.next = next;
|
|
@@ -1229,9 +1229,7 @@
|
|
|
1229
1229
|
}), exports.keys = function (val) {
|
|
1230
1230
|
var object = Object(val),
|
|
1231
1231
|
keys = [];
|
|
1232
|
-
for (var key in object)
|
|
1233
|
-
keys.push(key);
|
|
1234
|
-
}
|
|
1232
|
+
for (var key in object) keys.push(key);
|
|
1235
1233
|
return keys.reverse(), function next() {
|
|
1236
1234
|
for (; keys.length;) {
|
|
1237
1235
|
var key = keys.pop();
|
|
@@ -1242,9 +1240,7 @@
|
|
|
1242
1240
|
}, exports.values = values, Context.prototype = {
|
|
1243
1241
|
constructor: Context,
|
|
1244
1242
|
reset: function reset(skipTempReset) {
|
|
1245
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this)
|
|
1246
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
1247
|
-
}
|
|
1243
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
1248
1244
|
},
|
|
1249
1245
|
stop: function stop() {
|
|
1250
1246
|
this.done = !0;
|
|
@@ -1379,8 +1375,20 @@
|
|
|
1379
1375
|
return _setPrototypeOf$2(o, p);
|
|
1380
1376
|
}
|
|
1381
1377
|
var ElementSVG = function ElementSVG() {
|
|
1378
|
+
/**
|
|
1379
|
+
* basic element, eg. <circle>|<ellipse>
|
|
1380
|
+
*/
|
|
1382
1381
|
this.$el = void 0;
|
|
1382
|
+
/**
|
|
1383
|
+
* group wrapper for basic element, eg. <g><circle /></g>.
|
|
1384
|
+
* if current element is <g>, same as `$el`
|
|
1385
|
+
*/
|
|
1383
1386
|
this.$groupEl = void 0;
|
|
1387
|
+
/**
|
|
1388
|
+
* hitArea:
|
|
1389
|
+
* $groupEl -> $el
|
|
1390
|
+
* -> $hitTestingEl
|
|
1391
|
+
*/
|
|
1384
1392
|
this.$hitTestingEl = void 0;
|
|
1385
1393
|
};
|
|
1386
1394
|
ElementSVG.tag = 'c-svg-element';
|
|
@@ -1703,18 +1711,36 @@
|
|
|
1703
1711
|
this.pluginOptions = void 0;
|
|
1704
1712
|
this.defElementManager = void 0;
|
|
1705
1713
|
this.context = void 0;
|
|
1714
|
+
/**
|
|
1715
|
+
* <camera>
|
|
1716
|
+
*/
|
|
1706
1717
|
this.$camera = void 0;
|
|
1718
|
+
/**
|
|
1719
|
+
* render at the end of frame
|
|
1720
|
+
*/
|
|
1707
1721
|
this.renderQueue = [];
|
|
1722
|
+
/**
|
|
1723
|
+
* dirty attributes at the end of frame
|
|
1724
|
+
*/
|
|
1708
1725
|
this.dirtyAttributes = new WeakMap();
|
|
1726
|
+
/**
|
|
1727
|
+
* reorder after mounted
|
|
1728
|
+
*/
|
|
1709
1729
|
this.pendingReorderQueue = new Set();
|
|
1730
|
+
/**
|
|
1731
|
+
* <use> elements in <clipPath>, which should be sync with clipPath
|
|
1732
|
+
*
|
|
1733
|
+
* @example
|
|
1734
|
+
* <clipPath transform="matrix(1,0,0,1,-100,-155)" id="clip-path-0-2">
|
|
1735
|
+
* <use href="#g_svg_circle_0" transform="matrix(1.477115,0,0,1.477115,150,150)">
|
|
1736
|
+
* </use>
|
|
1737
|
+
* </clipPath>
|
|
1738
|
+
*/
|
|
1710
1739
|
this.clipPathUseMap = new WeakMap();
|
|
1711
1740
|
this.pluginOptions = pluginOptions;
|
|
1712
1741
|
this.defElementManager = defElementManager;
|
|
1713
1742
|
this.context = context;
|
|
1714
1743
|
}
|
|
1715
|
-
/**
|
|
1716
|
-
* <camera>
|
|
1717
|
-
*/
|
|
1718
1744
|
var _proto = SVGRendererPlugin.prototype;
|
|
1719
1745
|
_proto.apply = function apply(context) {
|
|
1720
1746
|
var _this = this;
|
|
@@ -1800,30 +1826,28 @@
|
|
|
1800
1826
|
renderingService.hooks.init.tapPromise(SVGRendererPlugin.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
1801
1827
|
var _this$context$config, background, document, $svg;
|
|
1802
1828
|
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
1803
|
-
while (1) {
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
return _context.stop();
|
|
1826
|
-
}
|
|
1829
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1830
|
+
case 0:
|
|
1831
|
+
_this$context$config = _this.context.config, background = _this$context$config.background, document = _this$context$config.document; // <defs>
|
|
1832
|
+
_this.defElementManager.init();
|
|
1833
|
+
$svg = _this.context.contextService.getContext();
|
|
1834
|
+
if (background) {
|
|
1835
|
+
$svg.style.background = background;
|
|
1836
|
+
}
|
|
1837
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/color-interpolation-filters
|
|
1838
|
+
$svg.setAttribute('color-interpolation-filters', 'sRGB');
|
|
1839
|
+
_this.$camera = createSVGElement('g', document);
|
|
1840
|
+
_this.$camera.id = G_SVG_PREFIX + "-camera";
|
|
1841
|
+
_this.applyTransform(_this.$camera, _this.context.camera.getOrthoMatrix());
|
|
1842
|
+
$svg.appendChild(_this.$camera);
|
|
1843
|
+
canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
1844
|
+
canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
1845
|
+
canvas.addEventListener(gLite.ElementEvent.REPARENT, handleReparent);
|
|
1846
|
+
canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
1847
|
+
canvas.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleGeometryBoundsChanged);
|
|
1848
|
+
case 14:
|
|
1849
|
+
case "end":
|
|
1850
|
+
return _context.stop();
|
|
1827
1851
|
}
|
|
1828
1852
|
}, _callee);
|
|
1829
1853
|
})));
|
|
@@ -3056,13 +3080,13 @@
|
|
|
3056
3080
|
var DefElementManager = /*#__PURE__*/function () {
|
|
3057
3081
|
function DefElementManager(context) {
|
|
3058
3082
|
this.context = void 0;
|
|
3083
|
+
/**
|
|
3084
|
+
* container for <gradient> <clipPath>...
|
|
3085
|
+
*/
|
|
3059
3086
|
this.$def = void 0;
|
|
3060
3087
|
this.gradientCache = {};
|
|
3061
3088
|
this.context = context;
|
|
3062
3089
|
}
|
|
3063
|
-
/**
|
|
3064
|
-
* container for <gradient> <clipPath>...
|
|
3065
|
-
*/
|
|
3066
3090
|
var _proto = DefElementManager.prototype;
|
|
3067
3091
|
_proto.getDefElement = function getDefElement() {
|
|
3068
3092
|
return this.$def;
|
|
@@ -3354,9 +3378,7 @@
|
|
|
3354
3378
|
if (!isNaN(iterable.length)) {
|
|
3355
3379
|
var i = -1,
|
|
3356
3380
|
next = function next() {
|
|
3357
|
-
for (; ++i < iterable.length;)
|
|
3358
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
3359
|
-
}
|
|
3381
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
3360
3382
|
return next.value = undefined, next.done = !0, next;
|
|
3361
3383
|
};
|
|
3362
3384
|
return next.next = next;
|
|
@@ -3402,9 +3424,7 @@
|
|
|
3402
3424
|
}), exports.keys = function (val) {
|
|
3403
3425
|
var object = Object(val),
|
|
3404
3426
|
keys = [];
|
|
3405
|
-
for (var key in object)
|
|
3406
|
-
keys.push(key);
|
|
3407
|
-
}
|
|
3427
|
+
for (var key in object) keys.push(key);
|
|
3408
3428
|
return keys.reverse(), function next() {
|
|
3409
3429
|
for (; keys.length;) {
|
|
3410
3430
|
var key = keys.pop();
|
|
@@ -3415,9 +3435,7 @@
|
|
|
3415
3435
|
}, exports.values = values, Context.prototype = {
|
|
3416
3436
|
constructor: Context,
|
|
3417
3437
|
reset: function reset(skipTempReset) {
|
|
3418
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this)
|
|
3419
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
3420
|
-
}
|
|
3438
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
3421
3439
|
},
|
|
3422
3440
|
stop: function stop() {
|
|
3423
3441
|
this.done = !0;
|
|
@@ -3547,9 +3565,7 @@
|
|
|
3547
3565
|
}
|
|
3548
3566
|
function _arrayLikeToArray(arr, len) {
|
|
3549
3567
|
if (len == null || len > arr.length) len = arr.length;
|
|
3550
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
3551
|
-
arr2[i] = arr[i];
|
|
3552
|
-
}
|
|
3568
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3553
3569
|
return arr2;
|
|
3554
3570
|
}
|
|
3555
3571
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
@@ -3587,14 +3603,12 @@
|
|
|
3587
3603
|
renderingService.hooks.pick.tapPromise(SVGPickerPlugin.tag, /*#__PURE__*/function () {
|
|
3588
3604
|
var _ref = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee(result) {
|
|
3589
3605
|
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
3590
|
-
while (1) {
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
return _context.stop();
|
|
3597
|
-
}
|
|
3606
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3607
|
+
case 0:
|
|
3608
|
+
return _context.abrupt("return", _this.pick(runtime, doc, result));
|
|
3609
|
+
case 1:
|
|
3610
|
+
case "end":
|
|
3611
|
+
return _context.stop();
|
|
3598
3612
|
}
|
|
3599
3613
|
}, _callee);
|
|
3600
3614
|
}));
|
|
@@ -3685,29 +3699,27 @@
|
|
|
3685
3699
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3686
3700
|
var _this$canvasConfig, container, doc, devicePixelRatio, $namespace, dpr;
|
|
3687
3701
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3688
|
-
while (1) {
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
if (this.$container) {
|
|
3694
|
-
|
|
3695
|
-
this.$container.style.position = 'relative';
|
|
3696
|
-
}
|
|
3697
|
-
$namespace = createSVGElement('svg', doc);
|
|
3698
|
-
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
3699
|
-
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
3700
|
-
this.$container.appendChild($namespace);
|
|
3701
|
-
this.$namespace = $namespace;
|
|
3702
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3703
|
+
case 0:
|
|
3704
|
+
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document, devicePixelRatio = _this$canvasConfig.devicePixelRatio; // create container
|
|
3705
|
+
this.$container = isString(container) ? (doc || document).getElementById(container) : container;
|
|
3706
|
+
if (this.$container) {
|
|
3707
|
+
if (!this.$container.style.position) {
|
|
3708
|
+
this.$container.style.position = 'relative';
|
|
3702
3709
|
}
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
this.
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3710
|
+
$namespace = createSVGElement('svg', doc);
|
|
3711
|
+
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
3712
|
+
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
3713
|
+
this.$container.appendChild($namespace);
|
|
3714
|
+
this.$namespace = $namespace;
|
|
3715
|
+
}
|
|
3716
|
+
// use user-defined dpr first
|
|
3717
|
+
dpr = devicePixelRatio || gLite.isBrowser && window.devicePixelRatio || 1;
|
|
3718
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
3719
|
+
this.dpr = dpr;
|
|
3720
|
+
case 6:
|
|
3721
|
+
case "end":
|
|
3722
|
+
return _context.stop();
|
|
3711
3723
|
}
|
|
3712
3724
|
}, _callee, this);
|
|
3713
3725
|
}));
|
|
@@ -3775,113 +3787,111 @@
|
|
|
3775
3787
|
var _this = this;
|
|
3776
3788
|
var cloneNode, doc, animationCounter, $style, svgDocType, svgDoc;
|
|
3777
3789
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3778
|
-
while (1) {
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
if (
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
groupAttributes.push(attributeName);
|
|
3816
|
-
}
|
|
3817
|
-
var inherited = !!((_propertyMetadataCach = gLite.propertyMetadataCache[attributeName]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.inh);
|
|
3818
|
-
if (inherited) {
|
|
3819
|
-
groupAttributes.push(attributeName);
|
|
3820
|
-
} else if (attributeName !== 'transform') {
|
|
3821
|
-
selfAttributes.push(attributeName);
|
|
3822
|
-
}
|
|
3823
|
-
});
|
|
3824
|
-
if (groupAttributes.length) {
|
|
3825
|
-
var keyframesWithGroup = keyframes.map(function (keyframe) {
|
|
3826
|
-
var offset = keyframe.offset,
|
|
3827
|
-
composite = keyframe.composite,
|
|
3828
|
-
computedOffset = keyframe.computedOffset,
|
|
3829
|
-
easing = keyframe.easing,
|
|
3830
|
-
transformOrigin = keyframe.transformOrigin,
|
|
3831
|
-
rest = _objectWithoutPropertiesLoose(keyframe, _excluded3);
|
|
3832
|
-
var ret = {
|
|
3833
|
-
offset: offset,
|
|
3834
|
-
composite: composite,
|
|
3835
|
-
computedOffset: computedOffset,
|
|
3836
|
-
easing: easing
|
|
3837
|
-
};
|
|
3838
|
-
Object.keys(rest).forEach(function (attributeName) {
|
|
3839
|
-
if (groupAttributes.includes(attributeName)) {
|
|
3840
|
-
ret[attributeName] = keyframe[attributeName];
|
|
3841
|
-
}
|
|
3842
|
-
});
|
|
3843
|
-
return ret;
|
|
3844
|
-
});
|
|
3845
|
-
groupCssText += _this.generateCSSText("a" + animationCounter++, groupSelector, keyframesWithGroup, animation.effect.getComputedTiming(), {
|
|
3846
|
-
transform: svgElement.$groupEl.getAttribute('transform')
|
|
3847
|
-
});
|
|
3790
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3791
|
+
case 0:
|
|
3792
|
+
cloneNode = this.$namespace.cloneNode(true);
|
|
3793
|
+
doc = this.canvasConfig.document;
|
|
3794
|
+
animationCounter = 0;
|
|
3795
|
+
$style = null;
|
|
3796
|
+
this.context.renderingContext.root.forEach(function (object) {
|
|
3797
|
+
var animations = object.getAnimations();
|
|
3798
|
+
if (animations.length) {
|
|
3799
|
+
if (!$style) {
|
|
3800
|
+
// export animations to <style>, using CSS Transformation
|
|
3801
|
+
$style = (doc || document).createElement('style');
|
|
3802
|
+
cloneNode.appendChild($style);
|
|
3803
|
+
}
|
|
3804
|
+
// @ts-ignore
|
|
3805
|
+
var svgElement = object.elementSVG;
|
|
3806
|
+
var selfSelector = "#" + svgElement.$el.id;
|
|
3807
|
+
var groupSelector = "#" + svgElement.$groupEl.id;
|
|
3808
|
+
var selfCssText = '';
|
|
3809
|
+
var groupCssText = '';
|
|
3810
|
+
animations.forEach(function (animation) {
|
|
3811
|
+
var keyframes = animation.effect.getKeyframes();
|
|
3812
|
+
// split attributes into self and group
|
|
3813
|
+
if (keyframes.length) {
|
|
3814
|
+
var selfAttributes = [];
|
|
3815
|
+
var groupAttributes = [];
|
|
3816
|
+
var _keyframes$ = keyframes[0],
|
|
3817
|
+
offset = _keyframes$.offset,
|
|
3818
|
+
composite = _keyframes$.composite,
|
|
3819
|
+
computedOffset = _keyframes$.computedOffset,
|
|
3820
|
+
easing = _keyframes$.easing,
|
|
3821
|
+
transformOrigin = _keyframes$.transformOrigin,
|
|
3822
|
+
rest = _objectWithoutPropertiesLoose(_keyframes$, _excluded2);
|
|
3823
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
3824
|
+
var _propertyMetadataCach;
|
|
3825
|
+
if (attributeName === 'transform') {
|
|
3826
|
+
groupAttributes.push(attributeName);
|
|
3848
3827
|
}
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
easing = keyframe.easing,
|
|
3855
|
-
transformOrigin = keyframe.transformOrigin,
|
|
3856
|
-
rest = _objectWithoutPropertiesLoose(keyframe, _excluded4);
|
|
3857
|
-
var ret = {
|
|
3858
|
-
offset: offset,
|
|
3859
|
-
composite: composite,
|
|
3860
|
-
computedOffset: computedOffset,
|
|
3861
|
-
easing: easing
|
|
3862
|
-
};
|
|
3863
|
-
Object.keys(rest).forEach(function (attributeName) {
|
|
3864
|
-
if (selfAttributes.includes(attributeName)) {
|
|
3865
|
-
ret[attributeName] = keyframe[attributeName];
|
|
3866
|
-
}
|
|
3867
|
-
});
|
|
3868
|
-
return ret;
|
|
3869
|
-
});
|
|
3870
|
-
selfCssText += _this.generateCSSText("a" + animationCounter++, selfSelector, keyframesWithSelf, animation.effect.getComputedTiming());
|
|
3828
|
+
var inherited = !!((_propertyMetadataCach = gLite.propertyMetadataCache[attributeName]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.inh);
|
|
3829
|
+
if (inherited) {
|
|
3830
|
+
groupAttributes.push(attributeName);
|
|
3831
|
+
} else if (attributeName !== 'transform') {
|
|
3832
|
+
selfAttributes.push(attributeName);
|
|
3871
3833
|
}
|
|
3834
|
+
});
|
|
3835
|
+
if (groupAttributes.length) {
|
|
3836
|
+
var keyframesWithGroup = keyframes.map(function (keyframe) {
|
|
3837
|
+
var offset = keyframe.offset,
|
|
3838
|
+
composite = keyframe.composite,
|
|
3839
|
+
computedOffset = keyframe.computedOffset,
|
|
3840
|
+
easing = keyframe.easing,
|
|
3841
|
+
transformOrigin = keyframe.transformOrigin,
|
|
3842
|
+
rest = _objectWithoutPropertiesLoose(keyframe, _excluded3);
|
|
3843
|
+
var ret = {
|
|
3844
|
+
offset: offset,
|
|
3845
|
+
composite: composite,
|
|
3846
|
+
computedOffset: computedOffset,
|
|
3847
|
+
easing: easing
|
|
3848
|
+
};
|
|
3849
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
3850
|
+
if (groupAttributes.includes(attributeName)) {
|
|
3851
|
+
ret[attributeName] = keyframe[attributeName];
|
|
3852
|
+
}
|
|
3853
|
+
});
|
|
3854
|
+
return ret;
|
|
3855
|
+
});
|
|
3856
|
+
groupCssText += _this.generateCSSText("a" + animationCounter++, groupSelector, keyframesWithGroup, animation.effect.getComputedTiming(), {
|
|
3857
|
+
transform: svgElement.$groupEl.getAttribute('transform')
|
|
3858
|
+
});
|
|
3872
3859
|
}
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3860
|
+
if (selfAttributes.length) {
|
|
3861
|
+
var keyframesWithSelf = keyframes.map(function (keyframe) {
|
|
3862
|
+
var offset = keyframe.offset,
|
|
3863
|
+
composite = keyframe.composite,
|
|
3864
|
+
computedOffset = keyframe.computedOffset,
|
|
3865
|
+
easing = keyframe.easing,
|
|
3866
|
+
transformOrigin = keyframe.transformOrigin,
|
|
3867
|
+
rest = _objectWithoutPropertiesLoose(keyframe, _excluded4);
|
|
3868
|
+
var ret = {
|
|
3869
|
+
offset: offset,
|
|
3870
|
+
composite: composite,
|
|
3871
|
+
computedOffset: computedOffset,
|
|
3872
|
+
easing: easing
|
|
3873
|
+
};
|
|
3874
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
3875
|
+
if (selfAttributes.includes(attributeName)) {
|
|
3876
|
+
ret[attributeName] = keyframe[attributeName];
|
|
3877
|
+
}
|
|
3878
|
+
});
|
|
3879
|
+
return ret;
|
|
3880
|
+
});
|
|
3881
|
+
selfCssText += _this.generateCSSText("a" + animationCounter++, selfSelector, keyframesWithSelf, animation.effect.getComputedTiming());
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
});
|
|
3885
|
+
$style.textContent += selfCssText + groupCssText;
|
|
3886
|
+
}
|
|
3887
|
+
});
|
|
3888
|
+
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
3889
|
+
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
3890
|
+
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
3891
|
+
return _context2.abrupt("return", "data:image/svg+xml;charset=utf8," + encodeURIComponent(new XMLSerializer().serializeToString(svgDoc)));
|
|
3892
|
+
case 10:
|
|
3893
|
+
case "end":
|
|
3894
|
+
return _context2.stop();
|
|
3885
3895
|
}
|
|
3886
3896
|
}, _callee2, this);
|
|
3887
3897
|
}));
|