@antv/g-svg 1.8.28 → 1.8.29
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 +224 -106
- package/dist/index.js +224 -106
- package/dist/index.umd.js +1644 -1054
- package/dist/index.umd.min.js +1 -1
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
|
@@ -305,6 +305,15 @@
|
|
|
305
305
|
}
|
|
306
306
|
}, exports;
|
|
307
307
|
}
|
|
308
|
+
function _typeof(obj) {
|
|
309
|
+
"@babel/helpers - typeof";
|
|
310
|
+
|
|
311
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
312
|
+
return typeof obj;
|
|
313
|
+
} : function (obj) {
|
|
314
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
315
|
+
}, _typeof(obj);
|
|
316
|
+
}
|
|
308
317
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
309
318
|
try {
|
|
310
319
|
var info = gen[key](arg);
|
|
@@ -335,10 +344,49 @@
|
|
|
335
344
|
});
|
|
336
345
|
};
|
|
337
346
|
}
|
|
338
|
-
function
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
347
|
+
function _classCallCheck(instance, Constructor) {
|
|
348
|
+
if (!(instance instanceof Constructor)) {
|
|
349
|
+
throw new TypeError("Cannot call a class as a function");
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function _defineProperties(target, props) {
|
|
353
|
+
for (var i = 0; i < props.length; i++) {
|
|
354
|
+
var descriptor = props[i];
|
|
355
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
356
|
+
descriptor.configurable = true;
|
|
357
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
358
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
362
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
363
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
364
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
365
|
+
writable: false
|
|
366
|
+
});
|
|
367
|
+
return Constructor;
|
|
368
|
+
}
|
|
369
|
+
function _inherits(subClass, superClass) {
|
|
370
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
371
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
372
|
+
}
|
|
373
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
374
|
+
constructor: {
|
|
375
|
+
value: subClass,
|
|
376
|
+
writable: true,
|
|
377
|
+
configurable: true
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
Object.defineProperty(subClass, "prototype", {
|
|
381
|
+
writable: false
|
|
382
|
+
});
|
|
383
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
384
|
+
}
|
|
385
|
+
function _getPrototypeOf(o) {
|
|
386
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
387
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
388
|
+
};
|
|
389
|
+
return _getPrototypeOf(o);
|
|
342
390
|
}
|
|
343
391
|
function _setPrototypeOf(o, p) {
|
|
344
392
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
@@ -347,6 +395,59 @@
|
|
|
347
395
|
};
|
|
348
396
|
return _setPrototypeOf(o, p);
|
|
349
397
|
}
|
|
398
|
+
function _isNativeReflectConstruct() {
|
|
399
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
400
|
+
if (Reflect.construct.sham) return false;
|
|
401
|
+
if (typeof Proxy === "function") return true;
|
|
402
|
+
try {
|
|
403
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
404
|
+
return true;
|
|
405
|
+
} catch (e) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function _assertThisInitialized(self) {
|
|
410
|
+
if (self === void 0) {
|
|
411
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
412
|
+
}
|
|
413
|
+
return self;
|
|
414
|
+
}
|
|
415
|
+
function _possibleConstructorReturn(self, call) {
|
|
416
|
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
417
|
+
return call;
|
|
418
|
+
} else if (call !== void 0) {
|
|
419
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
420
|
+
}
|
|
421
|
+
return _assertThisInitialized(self);
|
|
422
|
+
}
|
|
423
|
+
function _createSuper(Derived) {
|
|
424
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
425
|
+
return function _createSuperInternal() {
|
|
426
|
+
var Super = _getPrototypeOf(Derived),
|
|
427
|
+
result;
|
|
428
|
+
if (hasNativeReflectConstruct) {
|
|
429
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
430
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
431
|
+
} else {
|
|
432
|
+
result = Super.apply(this, arguments);
|
|
433
|
+
}
|
|
434
|
+
return _possibleConstructorReturn(this, result);
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
function _toPrimitive(input, hint) {
|
|
438
|
+
if (typeof input !== "object" || input === null) return input;
|
|
439
|
+
var prim = input[Symbol.toPrimitive];
|
|
440
|
+
if (prim !== undefined) {
|
|
441
|
+
var res = prim.call(input, hint || "default");
|
|
442
|
+
if (typeof res !== "object") return res;
|
|
443
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
444
|
+
}
|
|
445
|
+
return (hint === "string" ? String : Number)(input);
|
|
446
|
+
}
|
|
447
|
+
function _toPropertyKey(arg) {
|
|
448
|
+
var key = _toPrimitive(arg, "string");
|
|
449
|
+
return typeof key === "symbol" ? key : String(key);
|
|
450
|
+
}
|
|
350
451
|
|
|
351
452
|
function _regeneratorRuntime$1() {
|
|
352
453
|
_regeneratorRuntime$1 = function _regeneratorRuntime() {
|
|
@@ -424,7 +525,7 @@
|
|
|
424
525
|
if ("throw" !== record.type) {
|
|
425
526
|
var result = record.arg,
|
|
426
527
|
value = result.value;
|
|
427
|
-
return value && "object" ==
|
|
528
|
+
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
428
529
|
invoke("next", value, resolve, reject);
|
|
429
530
|
}, function (err) {
|
|
430
531
|
invoke("throw", err, resolve, reject);
|
|
@@ -685,10 +786,49 @@
|
|
|
685
786
|
});
|
|
686
787
|
};
|
|
687
788
|
}
|
|
688
|
-
function
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
789
|
+
function _classCallCheck$1(instance, Constructor) {
|
|
790
|
+
if (!(instance instanceof Constructor)) {
|
|
791
|
+
throw new TypeError("Cannot call a class as a function");
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
function _defineProperties$1(target, props) {
|
|
795
|
+
for (var i = 0; i < props.length; i++) {
|
|
796
|
+
var descriptor = props[i];
|
|
797
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
798
|
+
descriptor.configurable = true;
|
|
799
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
800
|
+
Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
function _createClass$1(Constructor, protoProps, staticProps) {
|
|
804
|
+
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
805
|
+
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
806
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
807
|
+
writable: false
|
|
808
|
+
});
|
|
809
|
+
return Constructor;
|
|
810
|
+
}
|
|
811
|
+
function _inherits$1(subClass, superClass) {
|
|
812
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
813
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
814
|
+
}
|
|
815
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
816
|
+
constructor: {
|
|
817
|
+
value: subClass,
|
|
818
|
+
writable: true,
|
|
819
|
+
configurable: true
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
Object.defineProperty(subClass, "prototype", {
|
|
823
|
+
writable: false
|
|
824
|
+
});
|
|
825
|
+
if (superClass) _setPrototypeOf$1(subClass, superClass);
|
|
826
|
+
}
|
|
827
|
+
function _getPrototypeOf$1(o) {
|
|
828
|
+
_getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
829
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
830
|
+
};
|
|
831
|
+
return _getPrototypeOf$1(o);
|
|
692
832
|
}
|
|
693
833
|
function _setPrototypeOf$1(o, p) {
|
|
694
834
|
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
@@ -697,6 +837,59 @@
|
|
|
697
837
|
};
|
|
698
838
|
return _setPrototypeOf$1(o, p);
|
|
699
839
|
}
|
|
840
|
+
function _isNativeReflectConstruct$1() {
|
|
841
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
842
|
+
if (Reflect.construct.sham) return false;
|
|
843
|
+
if (typeof Proxy === "function") return true;
|
|
844
|
+
try {
|
|
845
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
846
|
+
return true;
|
|
847
|
+
} catch (e) {
|
|
848
|
+
return false;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
function _assertThisInitialized$1(self) {
|
|
852
|
+
if (self === void 0) {
|
|
853
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
854
|
+
}
|
|
855
|
+
return self;
|
|
856
|
+
}
|
|
857
|
+
function _possibleConstructorReturn$1(self, call) {
|
|
858
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
859
|
+
return call;
|
|
860
|
+
} else if (call !== void 0) {
|
|
861
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
862
|
+
}
|
|
863
|
+
return _assertThisInitialized$1(self);
|
|
864
|
+
}
|
|
865
|
+
function _createSuper$1(Derived) {
|
|
866
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
|
|
867
|
+
return function _createSuperInternal() {
|
|
868
|
+
var Super = _getPrototypeOf$1(Derived),
|
|
869
|
+
result;
|
|
870
|
+
if (hasNativeReflectConstruct) {
|
|
871
|
+
var NewTarget = _getPrototypeOf$1(this).constructor;
|
|
872
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
873
|
+
} else {
|
|
874
|
+
result = Super.apply(this, arguments);
|
|
875
|
+
}
|
|
876
|
+
return _possibleConstructorReturn$1(this, result);
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
function _toPrimitive$1(input, hint) {
|
|
880
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
881
|
+
var prim = input[Symbol.toPrimitive];
|
|
882
|
+
if (prim !== undefined) {
|
|
883
|
+
var res = prim.call(input, hint || "default");
|
|
884
|
+
if (_typeof(res) !== "object") return res;
|
|
885
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
886
|
+
}
|
|
887
|
+
return (hint === "string" ? String : Number)(input);
|
|
888
|
+
}
|
|
889
|
+
function _toPropertyKey$1(arg) {
|
|
890
|
+
var key = _toPrimitive$1(arg, "string");
|
|
891
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
892
|
+
}
|
|
700
893
|
|
|
701
894
|
// const MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
|
|
702
895
|
/**
|
|
@@ -704,156 +897,165 @@
|
|
|
704
897
|
*/
|
|
705
898
|
var DOMInteractionPlugin = /*#__PURE__*/function () {
|
|
706
899
|
function DOMInteractionPlugin() {
|
|
900
|
+
_classCallCheck$1(this, DOMInteractionPlugin);
|
|
707
901
|
this.context = void 0;
|
|
708
902
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
$el
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
$el
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
903
|
+
_createClass$1(DOMInteractionPlugin, [{
|
|
904
|
+
key: "apply",
|
|
905
|
+
value: function apply(context) {
|
|
906
|
+
var _this = this;
|
|
907
|
+
var renderingService = context.renderingService,
|
|
908
|
+
renderingContext = context.renderingContext;
|
|
909
|
+
this.context = context;
|
|
910
|
+
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
911
|
+
// const SUPPORT_ONLY_TOUCH = canvas.supportsTouchEvents && MOBILE_REGEX.test(navigator.userAgent);
|
|
912
|
+
var onPointerMove = function onPointerMove(ev) {
|
|
913
|
+
renderingService.hooks.pointerMove.call(ev);
|
|
914
|
+
};
|
|
915
|
+
var onPointerUp = function onPointerUp(ev) {
|
|
916
|
+
renderingService.hooks.pointerUp.call(ev);
|
|
917
|
+
};
|
|
918
|
+
var onPointerDown = function onPointerDown(ev) {
|
|
919
|
+
renderingService.hooks.pointerDown.call(ev);
|
|
920
|
+
};
|
|
921
|
+
var onPointerOver = function onPointerOver(ev) {
|
|
922
|
+
renderingService.hooks.pointerOver.call(ev);
|
|
923
|
+
};
|
|
924
|
+
var onPointerOut = function onPointerOut(ev) {
|
|
925
|
+
renderingService.hooks.pointerOut.call(ev);
|
|
926
|
+
};
|
|
927
|
+
var onPointerCancel = function onPointerCancel(ev) {
|
|
928
|
+
renderingService.hooks.pointerCancel.call(ev);
|
|
929
|
+
};
|
|
930
|
+
var onPointerWheel = function onPointerWheel(ev) {
|
|
931
|
+
renderingService.hooks.pointerWheel.call(ev);
|
|
932
|
+
};
|
|
933
|
+
var addPointerEventListener = function addPointerEventListener($el) {
|
|
934
|
+
globalThis.document.addEventListener('pointermove', onPointerMove, true);
|
|
935
|
+
$el.addEventListener('pointerdown', onPointerDown, true);
|
|
936
|
+
$el.addEventListener('pointerleave', onPointerOut, true);
|
|
937
|
+
$el.addEventListener('pointerover', onPointerOver, true);
|
|
938
|
+
globalThis.addEventListener('pointerup', onPointerUp, true);
|
|
939
|
+
};
|
|
940
|
+
var addTouchEventListener = function addTouchEventListener($el) {
|
|
941
|
+
$el.addEventListener('touchstart', onPointerDown, true);
|
|
942
|
+
$el.addEventListener('touchend', onPointerUp, true);
|
|
943
|
+
$el.addEventListener('touchmove', onPointerMove, true);
|
|
944
|
+
$el.addEventListener('touchcancel', onPointerCancel, true);
|
|
945
|
+
};
|
|
946
|
+
var addMouseEventListener = function addMouseEventListener($el) {
|
|
947
|
+
globalThis.document.addEventListener('mousemove', onPointerMove, true);
|
|
948
|
+
$el.addEventListener('mousedown', onPointerDown, true);
|
|
949
|
+
$el.addEventListener('mouseout', onPointerOut, true);
|
|
950
|
+
$el.addEventListener('mouseover', onPointerOver, true);
|
|
951
|
+
globalThis.addEventListener('mouseup', onPointerUp, true);
|
|
952
|
+
};
|
|
953
|
+
var removePointerEventListener = function removePointerEventListener($el) {
|
|
954
|
+
globalThis.document.removeEventListener('pointermove', onPointerMove, true);
|
|
955
|
+
$el.removeEventListener('pointerdown', onPointerDown, true);
|
|
956
|
+
$el.removeEventListener('pointerleave', onPointerOut, true);
|
|
957
|
+
$el.removeEventListener('pointerover', onPointerOver, true);
|
|
958
|
+
globalThis.removeEventListener('pointerup', onPointerUp, true);
|
|
959
|
+
};
|
|
960
|
+
var removeTouchEventListener = function removeTouchEventListener($el) {
|
|
961
|
+
$el.removeEventListener('touchstart', onPointerDown, true);
|
|
962
|
+
$el.removeEventListener('touchend', onPointerUp, true);
|
|
963
|
+
$el.removeEventListener('touchmove', onPointerMove, true);
|
|
964
|
+
$el.removeEventListener('touchcancel', onPointerCancel, true);
|
|
965
|
+
};
|
|
966
|
+
var removeMouseEventListener = function removeMouseEventListener($el) {
|
|
967
|
+
globalThis.document.removeEventListener('mousemove', onPointerMove, true);
|
|
968
|
+
$el.removeEventListener('mousedown', onPointerDown, true);
|
|
969
|
+
$el.removeEventListener('mouseout', onPointerOut, true);
|
|
970
|
+
$el.removeEventListener('mouseover', onPointerOver, true);
|
|
971
|
+
globalThis.removeEventListener('mouseup', onPointerUp, true);
|
|
972
|
+
};
|
|
973
|
+
renderingService.hooks.init.tapPromise(DOMInteractionPlugin.tag, /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
974
|
+
var $el;
|
|
975
|
+
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
976
|
+
while (1) {
|
|
977
|
+
switch (_context.prev = _context.next) {
|
|
978
|
+
case 0:
|
|
979
|
+
$el = _this.context.contextService.getDomElement(); // @ts-ignore
|
|
980
|
+
if (globalThis.navigator.msPointerEnabled) {
|
|
981
|
+
// @ts-ignore
|
|
982
|
+
$el.style.msContentZooming = 'none';
|
|
983
|
+
// @ts-ignore
|
|
984
|
+
$el.style.msTouchAction = 'none';
|
|
985
|
+
} else if (canvas.supportsPointerEvents) {
|
|
986
|
+
$el.style.touchAction = 'none';
|
|
987
|
+
}
|
|
988
|
+
if (canvas.supportsPointerEvents) {
|
|
989
|
+
addPointerEventListener($el);
|
|
990
|
+
} else {
|
|
991
|
+
addMouseEventListener($el);
|
|
992
|
+
}
|
|
993
|
+
if (canvas.supportsTouchEvents) {
|
|
994
|
+
addTouchEventListener($el);
|
|
995
|
+
}
|
|
996
|
+
// use passive event listeners
|
|
997
|
+
// @see https://zhuanlan.zhihu.com/p/24555031
|
|
998
|
+
$el.addEventListener('wheel', onPointerWheel, {
|
|
999
|
+
passive: true,
|
|
1000
|
+
capture: true
|
|
1001
|
+
});
|
|
1002
|
+
case 5:
|
|
1003
|
+
case "end":
|
|
1004
|
+
return _context.stop();
|
|
1005
|
+
}
|
|
810
1006
|
}
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
var $el = _this.context.contextService.getDomElement();
|
|
816
|
-
// @ts-ignore
|
|
817
|
-
if (globalThis.navigator.msPointerEnabled) {
|
|
818
|
-
// @ts-ignore
|
|
819
|
-
$el.style.msContentZooming = '';
|
|
1007
|
+
}, _callee);
|
|
1008
|
+
})));
|
|
1009
|
+
renderingService.hooks.destroy.tap(DOMInteractionPlugin.tag, function () {
|
|
1010
|
+
var $el = _this.context.contextService.getDomElement();
|
|
820
1011
|
// @ts-ignore
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
1012
|
+
if (globalThis.navigator.msPointerEnabled) {
|
|
1013
|
+
// @ts-ignore
|
|
1014
|
+
$el.style.msContentZooming = '';
|
|
1015
|
+
// @ts-ignore
|
|
1016
|
+
$el.style.msTouchAction = '';
|
|
1017
|
+
} else if (canvas.supportsPointerEvents) {
|
|
1018
|
+
$el.style.touchAction = '';
|
|
1019
|
+
}
|
|
1020
|
+
if (canvas.supportsPointerEvents) {
|
|
1021
|
+
removePointerEventListener($el);
|
|
1022
|
+
} else {
|
|
1023
|
+
removeMouseEventListener($el);
|
|
1024
|
+
}
|
|
1025
|
+
if (canvas.supportsTouchEvents) {
|
|
1026
|
+
removeTouchEventListener($el);
|
|
1027
|
+
}
|
|
1028
|
+
$el.removeEventListener('wheel', onPointerWheel, true);
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
}]);
|
|
836
1032
|
return DOMInteractionPlugin;
|
|
837
1033
|
}();
|
|
838
1034
|
DOMInteractionPlugin.tag = 'DOMInteraction';
|
|
839
1035
|
var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
840
|
-
|
|
1036
|
+
_inherits$1(Plugin, _AbstractRendererPlug);
|
|
1037
|
+
var _super = _createSuper$1(Plugin);
|
|
841
1038
|
function Plugin() {
|
|
842
1039
|
var _this;
|
|
1040
|
+
_classCallCheck$1(this, Plugin);
|
|
843
1041
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
844
1042
|
args[_key] = arguments[_key];
|
|
845
1043
|
}
|
|
846
|
-
_this =
|
|
1044
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
847
1045
|
_this.name = 'dom-interaction';
|
|
848
1046
|
return _this;
|
|
849
1047
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
1048
|
+
_createClass$1(Plugin, [{
|
|
1049
|
+
key: "init",
|
|
1050
|
+
value: function init() {
|
|
1051
|
+
this.addRenderingPlugin(new DOMInteractionPlugin());
|
|
1052
|
+
}
|
|
1053
|
+
}, {
|
|
1054
|
+
key: "destroy",
|
|
1055
|
+
value: function destroy() {
|
|
1056
|
+
this.removeAllRenderingPlugins();
|
|
1057
|
+
}
|
|
1058
|
+
}]);
|
|
857
1059
|
return Plugin;
|
|
858
1060
|
}(gLite.AbstractRendererPlugin);
|
|
859
1061
|
|
|
@@ -1209,6 +1411,56 @@
|
|
|
1209
1411
|
return output;
|
|
1210
1412
|
}
|
|
1211
1413
|
|
|
1414
|
+
function _iterableToArrayLimit(arr, i) {
|
|
1415
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1416
|
+
if (null != _i) {
|
|
1417
|
+
var _s,
|
|
1418
|
+
_e,
|
|
1419
|
+
_x,
|
|
1420
|
+
_r,
|
|
1421
|
+
_arr = [],
|
|
1422
|
+
_n = !0,
|
|
1423
|
+
_d = !1;
|
|
1424
|
+
try {
|
|
1425
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
1426
|
+
if (Object(_i) !== _i) return;
|
|
1427
|
+
_n = !1;
|
|
1428
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {
|
|
1429
|
+
;
|
|
1430
|
+
}
|
|
1431
|
+
} catch (err) {
|
|
1432
|
+
_d = !0, _e = err;
|
|
1433
|
+
} finally {
|
|
1434
|
+
try {
|
|
1435
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
1436
|
+
} finally {
|
|
1437
|
+
if (_d) throw _e;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
return _arr;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
function ownKeys(object, enumerableOnly) {
|
|
1444
|
+
var keys = Object.keys(object);
|
|
1445
|
+
if (Object.getOwnPropertySymbols) {
|
|
1446
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1447
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
1448
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1449
|
+
})), keys.push.apply(keys, symbols);
|
|
1450
|
+
}
|
|
1451
|
+
return keys;
|
|
1452
|
+
}
|
|
1453
|
+
function _objectSpread2(target) {
|
|
1454
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1455
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
1456
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
1457
|
+
_defineProperty(target, key, source[key]);
|
|
1458
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
1459
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
return target;
|
|
1463
|
+
}
|
|
1212
1464
|
function _regeneratorRuntime$2() {
|
|
1213
1465
|
_regeneratorRuntime$2 = function _regeneratorRuntime() {
|
|
1214
1466
|
return exports;
|
|
@@ -1285,7 +1537,7 @@
|
|
|
1285
1537
|
if ("throw" !== record.type) {
|
|
1286
1538
|
var result = record.arg,
|
|
1287
1539
|
value = result.value;
|
|
1288
|
-
return value && "object" ==
|
|
1540
|
+
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
1289
1541
|
invoke("next", value, resolve, reject);
|
|
1290
1542
|
}, function (err) {
|
|
1291
1543
|
invoke("throw", err, resolve, reject);
|
|
@@ -1546,24 +1798,63 @@
|
|
|
1546
1798
|
});
|
|
1547
1799
|
};
|
|
1548
1800
|
}
|
|
1549
|
-
function
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1801
|
+
function _classCallCheck$2(instance, Constructor) {
|
|
1802
|
+
if (!(instance instanceof Constructor)) {
|
|
1803
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
function _defineProperties$2(target, props) {
|
|
1807
|
+
for (var i = 0; i < props.length; i++) {
|
|
1808
|
+
var descriptor = props[i];
|
|
1809
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1810
|
+
descriptor.configurable = true;
|
|
1811
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1812
|
+
Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
function _createClass$2(Constructor, protoProps, staticProps) {
|
|
1816
|
+
if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
|
|
1817
|
+
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
1818
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
1819
|
+
writable: false
|
|
1820
|
+
});
|
|
1821
|
+
return Constructor;
|
|
1822
|
+
}
|
|
1823
|
+
function _defineProperty(obj, key, value) {
|
|
1824
|
+
key = _toPropertyKey$2(key);
|
|
1825
|
+
if (key in obj) {
|
|
1826
|
+
Object.defineProperty(obj, key, {
|
|
1827
|
+
value: value,
|
|
1828
|
+
enumerable: true,
|
|
1829
|
+
configurable: true,
|
|
1830
|
+
writable: true
|
|
1831
|
+
});
|
|
1832
|
+
} else {
|
|
1833
|
+
obj[key] = value;
|
|
1834
|
+
}
|
|
1835
|
+
return obj;
|
|
1836
|
+
}
|
|
1837
|
+
function _inherits$2(subClass, superClass) {
|
|
1838
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
1839
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
1840
|
+
}
|
|
1841
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1842
|
+
constructor: {
|
|
1843
|
+
value: subClass,
|
|
1844
|
+
writable: true,
|
|
1845
|
+
configurable: true
|
|
1558
1846
|
}
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1847
|
+
});
|
|
1848
|
+
Object.defineProperty(subClass, "prototype", {
|
|
1849
|
+
writable: false
|
|
1850
|
+
});
|
|
1851
|
+
if (superClass) _setPrototypeOf$2(subClass, superClass);
|
|
1562
1852
|
}
|
|
1563
|
-
function
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1853
|
+
function _getPrototypeOf$2(o) {
|
|
1854
|
+
_getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
1855
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
1856
|
+
};
|
|
1857
|
+
return _getPrototypeOf$2(o);
|
|
1567
1858
|
}
|
|
1568
1859
|
function _setPrototypeOf$2(o, p) {
|
|
1569
1860
|
_setPrototypeOf$2 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
@@ -1572,11 +1863,89 @@
|
|
|
1572
1863
|
};
|
|
1573
1864
|
return _setPrototypeOf$2(o, p);
|
|
1574
1865
|
}
|
|
1575
|
-
|
|
1866
|
+
function _isNativeReflectConstruct$2() {
|
|
1867
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1868
|
+
if (Reflect.construct.sham) return false;
|
|
1869
|
+
if (typeof Proxy === "function") return true;
|
|
1870
|
+
try {
|
|
1871
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
1872
|
+
return true;
|
|
1873
|
+
} catch (e) {
|
|
1874
|
+
return false;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
function _assertThisInitialized$2(self) {
|
|
1878
|
+
if (self === void 0) {
|
|
1879
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1880
|
+
}
|
|
1881
|
+
return self;
|
|
1882
|
+
}
|
|
1883
|
+
function _possibleConstructorReturn$2(self, call) {
|
|
1884
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
1885
|
+
return call;
|
|
1886
|
+
} else if (call !== void 0) {
|
|
1887
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
1888
|
+
}
|
|
1889
|
+
return _assertThisInitialized$2(self);
|
|
1890
|
+
}
|
|
1891
|
+
function _createSuper$2(Derived) {
|
|
1892
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
|
|
1893
|
+
return function _createSuperInternal() {
|
|
1894
|
+
var Super = _getPrototypeOf$2(Derived),
|
|
1895
|
+
result;
|
|
1896
|
+
if (hasNativeReflectConstruct) {
|
|
1897
|
+
var NewTarget = _getPrototypeOf$2(this).constructor;
|
|
1898
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
1899
|
+
} else {
|
|
1900
|
+
result = Super.apply(this, arguments);
|
|
1901
|
+
}
|
|
1902
|
+
return _possibleConstructorReturn$2(this, result);
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
function _slicedToArray(arr, i) {
|
|
1906
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
1907
|
+
}
|
|
1908
|
+
function _arrayWithHoles(arr) {
|
|
1909
|
+
if (Array.isArray(arr)) return arr;
|
|
1910
|
+
}
|
|
1911
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
1912
|
+
if (!o) return;
|
|
1913
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
1914
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1915
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1916
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1917
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1918
|
+
}
|
|
1919
|
+
function _arrayLikeToArray(arr, len) {
|
|
1920
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1921
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
1922
|
+
arr2[i] = arr[i];
|
|
1923
|
+
}
|
|
1924
|
+
return arr2;
|
|
1925
|
+
}
|
|
1926
|
+
function _nonIterableRest() {
|
|
1927
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1928
|
+
}
|
|
1929
|
+
function _toPrimitive$2(input, hint) {
|
|
1930
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
1931
|
+
var prim = input[Symbol.toPrimitive];
|
|
1932
|
+
if (prim !== undefined) {
|
|
1933
|
+
var res = prim.call(input, hint || "default");
|
|
1934
|
+
if (_typeof(res) !== "object") return res;
|
|
1935
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1936
|
+
}
|
|
1937
|
+
return (hint === "string" ? String : Number)(input);
|
|
1938
|
+
}
|
|
1939
|
+
function _toPropertyKey$2(arg) {
|
|
1940
|
+
var key = _toPrimitive$2(arg, "string");
|
|
1941
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
1942
|
+
}
|
|
1943
|
+
var ElementSVG = /*#__PURE__*/_createClass$2(function ElementSVG() {
|
|
1944
|
+
_classCallCheck$2(this, ElementSVG);
|
|
1576
1945
|
this.$el = void 0;
|
|
1577
1946
|
this.$groupEl = void 0;
|
|
1578
1947
|
this.$hitTestingEl = void 0;
|
|
1579
|
-
};
|
|
1948
|
+
});
|
|
1580
1949
|
ElementSVG.tag = 'c-svg-element';
|
|
1581
1950
|
function updateImageElementAttribute($el, parsedStyle) {
|
|
1582
1951
|
var _parsedStyle$img = parsedStyle.img,
|
|
@@ -1589,13 +1958,13 @@
|
|
|
1589
1958
|
$el.setAttribute('href', img);
|
|
1590
1959
|
} else if (img instanceof Image) {
|
|
1591
1960
|
if (!width) {
|
|
1592
|
-
$el.setAttribute('width', ""
|
|
1961
|
+
$el.setAttribute('width', "".concat(img.width));
|
|
1593
1962
|
// TODO: set renderable.boundsDirty
|
|
1594
1963
|
// this.attr('width', img.width);
|
|
1595
1964
|
}
|
|
1596
1965
|
|
|
1597
1966
|
if (!height) {
|
|
1598
|
-
$el.setAttribute('height', ""
|
|
1967
|
+
$el.setAttribute('height', "".concat(img.height));
|
|
1599
1968
|
// this.attr('height', img.height);
|
|
1600
1969
|
}
|
|
1601
1970
|
|
|
@@ -1608,21 +1977,21 @@
|
|
|
1608
1977
|
} else if (img instanceof ImageData) {
|
|
1609
1978
|
var canvas = document.createElement('canvas');
|
|
1610
1979
|
// @ts-ignore
|
|
1611
|
-
canvas.setAttribute('width', ""
|
|
1980
|
+
canvas.setAttribute('width', "".concat(img.width));
|
|
1612
1981
|
// @ts-ignore
|
|
1613
|
-
canvas.setAttribute('height', ""
|
|
1982
|
+
canvas.setAttribute('height', "".concat(img.height));
|
|
1614
1983
|
var context = canvas.getContext('2d');
|
|
1615
1984
|
if (context) {
|
|
1616
1985
|
context.putImageData(img, 0, 0);
|
|
1617
1986
|
if (!width) {
|
|
1618
1987
|
// @ts-ignore
|
|
1619
|
-
$el.setAttribute('width', ""
|
|
1988
|
+
$el.setAttribute('width', "".concat(img.width));
|
|
1620
1989
|
// this.attr('width', img.width);
|
|
1621
1990
|
}
|
|
1622
1991
|
|
|
1623
1992
|
if (!height) {
|
|
1624
1993
|
// @ts-ignore
|
|
1625
|
-
$el.setAttribute('height', ""
|
|
1994
|
+
$el.setAttribute('height', "".concat(img.height));
|
|
1626
1995
|
// this.attr('height', img.height);
|
|
1627
1996
|
}
|
|
1628
1997
|
|
|
@@ -1665,10 +2034,10 @@
|
|
|
1665
2034
|
endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
|
|
1666
2035
|
}
|
|
1667
2036
|
// @see https://github.com/antvis/g/issues/1038
|
|
1668
|
-
$el.setAttribute('x1', ""
|
|
1669
|
-
$el.setAttribute('y1', ""
|
|
1670
|
-
$el.setAttribute('x2', ""
|
|
1671
|
-
$el.setAttribute('y2', ""
|
|
2037
|
+
$el.setAttribute('x1', "".concat(x1 - defX + startOffsetX));
|
|
2038
|
+
$el.setAttribute('y1', "".concat(y1 - defY + startOffsetY));
|
|
2039
|
+
$el.setAttribute('x2', "".concat(x2 - defX + endOffsetX));
|
|
2040
|
+
$el.setAttribute('y2', "".concat(y2 - defY + endOffsetY));
|
|
1672
2041
|
}
|
|
1673
2042
|
function updatePathElementAttribute($el, parsedStyle) {
|
|
1674
2043
|
var path = parsedStyle.path,
|
|
@@ -1689,8 +2058,9 @@
|
|
|
1689
2058
|
var y;
|
|
1690
2059
|
if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
|
|
1691
2060
|
var _markerStart$parentNo = markerStart.parentNode.getStartTangent(),
|
|
1692
|
-
|
|
1693
|
-
|
|
2061
|
+
_markerStart$parentNo2 = _slicedToArray(_markerStart$parentNo, 2),
|
|
2062
|
+
p1 = _markerStart$parentNo2[0],
|
|
2063
|
+
p2 = _markerStart$parentNo2[1];
|
|
1694
2064
|
x = p1[0] - p2[0];
|
|
1695
2065
|
y = p1[1] - p2[1];
|
|
1696
2066
|
rad = Math.atan2(y, x);
|
|
@@ -1699,8 +2069,9 @@
|
|
|
1699
2069
|
}
|
|
1700
2070
|
if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
|
|
1701
2071
|
var _markerEnd$parentNode = markerEnd.parentNode.getEndTangent(),
|
|
1702
|
-
|
|
1703
|
-
|
|
2072
|
+
_markerEnd$parentNode2 = _slicedToArray(_markerEnd$parentNode, 2),
|
|
2073
|
+
_p = _markerEnd$parentNode2[0],
|
|
2074
|
+
_p2 = _markerEnd$parentNode2[1];
|
|
1704
2075
|
x = _p[0] - _p2[0];
|
|
1705
2076
|
y = _p[1] - _p2[1];
|
|
1706
2077
|
rad = Math.atan2(y, x);
|
|
@@ -1752,7 +2123,7 @@
|
|
|
1752
2123
|
offsetX = endOffsetX;
|
|
1753
2124
|
offsetY = endOffsetY;
|
|
1754
2125
|
}
|
|
1755
|
-
return point[0] - defX + offsetX
|
|
2126
|
+
return "".concat(point[0] - defX + offsetX, ",").concat(point[1] - defY + offsetY);
|
|
1756
2127
|
}).join(' '));
|
|
1757
2128
|
}
|
|
1758
2129
|
}
|
|
@@ -1769,20 +2140,21 @@
|
|
|
1769
2140
|
});
|
|
1770
2141
|
var d = '';
|
|
1771
2142
|
if (!hasRadius) {
|
|
1772
|
-
d = "M 0,0 l "
|
|
2143
|
+
d = "M 0,0 l ".concat(width, ",0 l 0,").concat(height, " l").concat(-width, " 0 z");
|
|
1773
2144
|
} else {
|
|
1774
2145
|
var _radius$map = radius.map(function (r) {
|
|
1775
2146
|
return clamp(r, 0, Math.min(Math.abs(width) / 2, Math.abs(height) / 2));
|
|
1776
2147
|
}),
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
2148
|
+
_radius$map2 = _slicedToArray(_radius$map, 4),
|
|
2149
|
+
tlr = _radius$map2[0],
|
|
2150
|
+
trr = _radius$map2[1],
|
|
2151
|
+
brr = _radius$map2[2],
|
|
2152
|
+
blr = _radius$map2[3];
|
|
1781
2153
|
var signX = width > 0 ? 1 : -1;
|
|
1782
2154
|
var signY = height > 0 ? 1 : -1;
|
|
1783
2155
|
// sweep-flag @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Paths#arcs
|
|
1784
2156
|
var sweepFlag = signX + signY !== 0 ? 1 : 0;
|
|
1785
|
-
d = [["M "
|
|
2157
|
+
d = [["M ".concat(signX * tlr, ",0")], ["l ".concat(width - signX * (tlr + trr), ",0")], ["a ".concat(trr, ",").concat(trr, ",0,0,").concat(sweepFlag, ",").concat(signX * trr, ",").concat(signY * trr)], ["l 0,".concat(height - signY * (trr + brr))], ["a ".concat(brr, ",").concat(brr, ",0,0,").concat(sweepFlag, ",").concat(-signX * brr, ",").concat(signY * brr)], ["l ".concat(signX * (brr + blr) - width, ",0")], ["a ".concat(blr, ",").concat(blr, ",0,0,").concat(sweepFlag, ",").concat(-signX * blr, ",").concat(-signY * blr)], ["l 0,".concat(signY * (blr + tlr) - height)], ["a ".concat(tlr, ",").concat(tlr, ",0,0,").concat(sweepFlag, ",").concat(signX * tlr, ",").concat(-signY * tlr)], ['z']].join(' ');
|
|
1786
2158
|
}
|
|
1787
2159
|
$el.setAttribute('d', d);
|
|
1788
2160
|
}
|
|
@@ -1894,6 +2266,7 @@
|
|
|
1894
2266
|
var TEXT_PATH_PREFIX = 'text-path-';
|
|
1895
2267
|
var SVGRendererPlugin = /*#__PURE__*/function () {
|
|
1896
2268
|
function SVGRendererPlugin(pluginOptions, defElementManager, context) {
|
|
2269
|
+
_classCallCheck$2(this, SVGRendererPlugin);
|
|
1897
2270
|
this.pluginOptions = void 0;
|
|
1898
2271
|
this.defElementManager = void 0;
|
|
1899
2272
|
this.context = void 0;
|
|
@@ -1909,507 +2282,526 @@
|
|
|
1909
2282
|
/**
|
|
1910
2283
|
* <camera>
|
|
1911
2284
|
*/
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
var
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
var
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
var
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
if (!object.elementSVG) {
|
|
1936
|
-
return;
|
|
1937
|
-
}
|
|
1938
|
-
var attrName = e.attrName;
|
|
1939
|
-
var attribtues = _this.dirtyAttributes.get(object);
|
|
1940
|
-
if (!attribtues) {
|
|
1941
|
-
_this.dirtyAttributes.set(object, []);
|
|
1942
|
-
attribtues = _this.dirtyAttributes.get(object);
|
|
1943
|
-
}
|
|
1944
|
-
attribtues.push(attrName);
|
|
1945
|
-
};
|
|
1946
|
-
var handleGeometryBoundsChanged = function handleGeometryBoundsChanged(e) {
|
|
1947
|
-
var _object$elementSVG;
|
|
1948
|
-
var object = e.target;
|
|
1949
|
-
// @ts-ignore
|
|
1950
|
-
var $el = (_object$elementSVG = object.elementSVG) === null || _object$elementSVG === void 0 ? void 0 : _object$elementSVG.$el;
|
|
1951
|
-
var _object$parsedStyle = object.parsedStyle,
|
|
1952
|
-
fill = _object$parsedStyle.fill,
|
|
1953
|
-
stroke = _object$parsedStyle.stroke;
|
|
1954
|
-
if (fill && !(fill instanceof gLite.CSSRGB)) {
|
|
1955
|
-
_this.defElementManager.createOrUpdateGradientAndPattern(object, $el, fill, 'fill', _this);
|
|
1956
|
-
}
|
|
1957
|
-
if (stroke && !(stroke instanceof gLite.CSSRGB)) {
|
|
1958
|
-
_this.defElementManager.createOrUpdateGradientAndPattern(object, $el, stroke, 'stroke', _this);
|
|
1959
|
-
}
|
|
1960
|
-
};
|
|
1961
|
-
renderingService.hooks.init.tapPromise(SVGRendererPlugin.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
1962
|
-
var _this$context$config, background, document, $svg;
|
|
1963
|
-
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
1964
|
-
while (1) {
|
|
1965
|
-
switch (_context.prev = _context.next) {
|
|
1966
|
-
case 0:
|
|
1967
|
-
_this$context$config = _this.context.config, background = _this$context$config.background, document = _this$context$config.document; // <defs>
|
|
1968
|
-
_this.defElementManager.init();
|
|
1969
|
-
$svg = _this.context.contextService.getContext();
|
|
1970
|
-
if (background) {
|
|
1971
|
-
$svg.style.background = background;
|
|
1972
|
-
}
|
|
1973
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/color-interpolation-filters
|
|
1974
|
-
$svg.setAttribute('color-interpolation-filters', 'sRGB');
|
|
1975
|
-
_this.$camera = createSVGElement('g', document);
|
|
1976
|
-
_this.$camera.id = G_SVG_PREFIX + "-camera";
|
|
1977
|
-
_this.applyTransform(_this.$camera, _this.context.camera.getOrthoMatrix());
|
|
1978
|
-
$svg.appendChild(_this.$camera);
|
|
1979
|
-
canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
1980
|
-
canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
1981
|
-
canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
1982
|
-
canvas.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleGeometryBoundsChanged);
|
|
1983
|
-
case 13:
|
|
1984
|
-
case "end":
|
|
1985
|
-
return _context.stop();
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
}, _callee);
|
|
1989
|
-
})));
|
|
1990
|
-
renderingService.hooks.destroy.tap(SVGRendererPlugin.tag, function () {
|
|
1991
|
-
canvas.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
1992
|
-
canvas.removeEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
1993
|
-
canvas.removeEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
1994
|
-
canvas.removeEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleGeometryBoundsChanged);
|
|
1995
|
-
});
|
|
1996
|
-
renderingService.hooks.render.tap(SVGRendererPlugin.tag, function (object) {
|
|
1997
|
-
// if (!object.isCulled()) {
|
|
1998
|
-
_this.renderQueue.push(object);
|
|
1999
|
-
// }
|
|
2000
|
-
});
|
|
2001
|
-
|
|
2002
|
-
renderingService.hooks.beginFrame.tap(SVGRendererPlugin.tag, function () {
|
|
2003
|
-
var doc = _this.context.config.document;
|
|
2004
|
-
if (_this.pendingReorderQueue.size) {
|
|
2005
|
-
_this.pendingReorderQueue.forEach(function (object) {
|
|
2006
|
-
var _object$elementSVG2;
|
|
2007
|
-
var children = ((object === null || object === void 0 ? void 0 : object.children) || []).slice();
|
|
2008
|
-
var $parentGroupEl =
|
|
2009
|
-
// @ts-ignore
|
|
2010
|
-
object === null || object === void 0 ? void 0 : (_object$elementSVG2 = object.elementSVG) === null || _object$elementSVG2 === void 0 ? void 0 : _object$elementSVG2.$groupEl;
|
|
2011
|
-
if ($parentGroupEl) {
|
|
2012
|
-
_this.reorderChildren(doc || document, $parentGroupEl, children || []);
|
|
2013
|
-
}
|
|
2014
|
-
});
|
|
2015
|
-
_this.pendingReorderQueue.clear();
|
|
2016
|
-
}
|
|
2017
|
-
});
|
|
2018
|
-
renderingService.hooks.endFrame.tap(SVGRendererPlugin.tag, function () {
|
|
2019
|
-
if (renderingContext.renderReasons.has(gLite.RenderReason.CAMERA_CHANGED)) {
|
|
2020
|
-
_this.applyTransform(_this.$camera, _this.context.camera.getOrthoMatrix());
|
|
2021
|
-
}
|
|
2022
|
-
_this.renderQueue.forEach(function (object) {
|
|
2023
|
-
var _object$elementSVG3, _object$elementSVG4;
|
|
2285
|
+
_createClass$2(SVGRendererPlugin, [{
|
|
2286
|
+
key: "apply",
|
|
2287
|
+
value: function apply(context) {
|
|
2288
|
+
var _this = this;
|
|
2289
|
+
var renderingService = context.renderingService,
|
|
2290
|
+
renderingContext = context.renderingContext;
|
|
2291
|
+
this.context = context;
|
|
2292
|
+
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
2293
|
+
var document = this.context.config.document;
|
|
2294
|
+
var handleMounted = function handleMounted(e) {
|
|
2295
|
+
var object = e.target;
|
|
2296
|
+
// create SVG DOM Node
|
|
2297
|
+
_this.createSVGDom(document, object, _this.$camera);
|
|
2298
|
+
};
|
|
2299
|
+
var handleUnmounted = function handleUnmounted(e) {
|
|
2300
|
+
var object = e.target;
|
|
2301
|
+
_this.defElementManager.clear(object.entity);
|
|
2302
|
+
_this.clipPathUseMap.delete(object);
|
|
2303
|
+
_this.removeSVGDom(object);
|
|
2304
|
+
};
|
|
2305
|
+
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
2306
|
+
var object = e.target;
|
|
2307
|
+
// @see https://github.com/antvis/g/issues/994
|
|
2024
2308
|
// @ts-ignore
|
|
2025
|
-
|
|
2309
|
+
if (!object.elementSVG) {
|
|
2310
|
+
return;
|
|
2311
|
+
}
|
|
2312
|
+
var attrName = e.attrName;
|
|
2313
|
+
var attribtues = _this.dirtyAttributes.get(object);
|
|
2314
|
+
if (!attribtues) {
|
|
2315
|
+
_this.dirtyAttributes.set(object, []);
|
|
2316
|
+
attribtues = _this.dirtyAttributes.get(object);
|
|
2317
|
+
}
|
|
2318
|
+
attribtues.push(attrName);
|
|
2319
|
+
};
|
|
2320
|
+
var handleGeometryBoundsChanged = function handleGeometryBoundsChanged(e) {
|
|
2321
|
+
var _object$elementSVG;
|
|
2322
|
+
var object = e.target;
|
|
2026
2323
|
// @ts-ignore
|
|
2027
|
-
var $
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
_this.
|
|
2033
|
-
// clipped shapes should also be informed
|
|
2034
|
-
var $useRefs = _this.clipPathUseMap.get(object);
|
|
2035
|
-
if ($useRefs && $useRefs.length) {
|
|
2036
|
-
$useRefs.forEach(function ($use) {
|
|
2037
|
-
// <clipPath transform="matrix()"><circle /></clipPath>
|
|
2038
|
-
_this.applyTransform($use, object.getWorldTransform());
|
|
2039
|
-
// const parentInvert = mat4.invert(
|
|
2040
|
-
// mat4.create(),
|
|
2041
|
-
// (object as DisplayObject).getWorldTransform(),
|
|
2042
|
-
// );
|
|
2043
|
-
// this.applyTransform($clipPath, parentInvert);
|
|
2044
|
-
});
|
|
2045
|
-
}
|
|
2046
|
-
// finish rendering, clear dirty flag
|
|
2047
|
-
object.renderable.dirty = false;
|
|
2324
|
+
var $el = (_object$elementSVG = object.elementSVG) === null || _object$elementSVG === void 0 ? void 0 : _object$elementSVG.$el;
|
|
2325
|
+
var _object$parsedStyle = object.parsedStyle,
|
|
2326
|
+
fill = _object$parsedStyle.fill,
|
|
2327
|
+
stroke = _object$parsedStyle.stroke;
|
|
2328
|
+
if (fill && !(fill instanceof gLite.CSSRGB)) {
|
|
2329
|
+
_this.defElementManager.createOrUpdateGradientAndPattern(object, $el, fill, 'fill', _this);
|
|
2048
2330
|
}
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
_this.
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2331
|
+
if (stroke && !(stroke instanceof gLite.CSSRGB)) {
|
|
2332
|
+
_this.defElementManager.createOrUpdateGradientAndPattern(object, $el, stroke, 'stroke', _this);
|
|
2333
|
+
}
|
|
2334
|
+
};
|
|
2335
|
+
renderingService.hooks.init.tapPromise(SVGRendererPlugin.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
2336
|
+
var _this$context$config, background, document, $svg;
|
|
2337
|
+
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
2338
|
+
while (1) {
|
|
2339
|
+
switch (_context.prev = _context.next) {
|
|
2340
|
+
case 0:
|
|
2341
|
+
_this$context$config = _this.context.config, background = _this$context$config.background, document = _this$context$config.document; // <defs>
|
|
2342
|
+
_this.defElementManager.init();
|
|
2343
|
+
$svg = _this.context.contextService.getContext();
|
|
2344
|
+
if (background) {
|
|
2345
|
+
$svg.style.background = background;
|
|
2346
|
+
}
|
|
2347
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/color-interpolation-filters
|
|
2348
|
+
$svg.setAttribute('color-interpolation-filters', 'sRGB');
|
|
2349
|
+
_this.$camera = createSVGElement('g', document);
|
|
2350
|
+
_this.$camera.id = "".concat(G_SVG_PREFIX, "-camera");
|
|
2351
|
+
_this.applyTransform(_this.$camera, _this.context.camera.getOrthoMatrix());
|
|
2352
|
+
$svg.appendChild(_this.$camera);
|
|
2353
|
+
canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
2354
|
+
canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
2355
|
+
canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
2356
|
+
canvas.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleGeometryBoundsChanged);
|
|
2357
|
+
case 13:
|
|
2358
|
+
case "end":
|
|
2359
|
+
return _context.stop();
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}, _callee);
|
|
2363
|
+
})));
|
|
2364
|
+
renderingService.hooks.destroy.tap(SVGRendererPlugin.tag, function () {
|
|
2365
|
+
canvas.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
2366
|
+
canvas.removeEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
2367
|
+
canvas.removeEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
2368
|
+
canvas.removeEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleGeometryBoundsChanged);
|
|
2369
|
+
});
|
|
2370
|
+
renderingService.hooks.render.tap(SVGRendererPlugin.tag, function (object) {
|
|
2371
|
+
// if (!object.isCulled()) {
|
|
2372
|
+
_this.renderQueue.push(object);
|
|
2373
|
+
// }
|
|
2374
|
+
});
|
|
2375
|
+
|
|
2376
|
+
renderingService.hooks.beginFrame.tap(SVGRendererPlugin.tag, function () {
|
|
2377
|
+
var doc = _this.context.config.document;
|
|
2378
|
+
if (_this.pendingReorderQueue.size) {
|
|
2379
|
+
_this.pendingReorderQueue.forEach(function (object) {
|
|
2380
|
+
var _object$elementSVG2;
|
|
2381
|
+
var children = ((object === null || object === void 0 ? void 0 : object.children) || []).slice();
|
|
2382
|
+
var $parentGroupEl =
|
|
2383
|
+
// @ts-ignore
|
|
2384
|
+
object === null || object === void 0 ? void 0 : (_object$elementSVG2 = object.elementSVG) === null || _object$elementSVG2 === void 0 ? void 0 : _object$elementSVG2.$groupEl;
|
|
2385
|
+
if ($parentGroupEl) {
|
|
2386
|
+
_this.reorderChildren(doc || document, $parentGroupEl, children || []);
|
|
2064
2387
|
}
|
|
2065
|
-
_this.updateAttribute(object, [attrName]);
|
|
2066
2388
|
});
|
|
2067
|
-
_this.
|
|
2389
|
+
_this.pendingReorderQueue.clear();
|
|
2068
2390
|
}
|
|
2069
2391
|
});
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
_proto.reorderChildren = function reorderChildren(doc, $groupEl, children) {
|
|
2077
|
-
// need to reorder parent's children
|
|
2078
|
-
children.sort(function (a, b) {
|
|
2079
|
-
return a.sortable.renderOrder - b.sortable.renderOrder;
|
|
2080
|
-
});
|
|
2081
|
-
if (children.length) {
|
|
2082
|
-
// create empty fragment
|
|
2083
|
-
var fragment = (doc || document).createDocumentFragment();
|
|
2084
|
-
children.forEach(function (child) {
|
|
2085
|
-
if (child.isConnected) {
|
|
2392
|
+
renderingService.hooks.endFrame.tap(SVGRendererPlugin.tag, function () {
|
|
2393
|
+
if (renderingContext.renderReasons.has(gLite.RenderReason.CAMERA_CHANGED)) {
|
|
2394
|
+
_this.applyTransform(_this.$camera, _this.context.camera.getOrthoMatrix());
|
|
2395
|
+
}
|
|
2396
|
+
_this.renderQueue.forEach(function (object) {
|
|
2397
|
+
var _object$elementSVG3, _object$elementSVG4;
|
|
2086
2398
|
// @ts-ignore
|
|
2087
|
-
var $el =
|
|
2088
|
-
|
|
2089
|
-
|
|
2399
|
+
var $el = (_object$elementSVG3 = object.elementSVG) === null || _object$elementSVG3 === void 0 ? void 0 : _object$elementSVG3.$el;
|
|
2400
|
+
// @ts-ignore
|
|
2401
|
+
var $groupEl = (_object$elementSVG4 = object.elementSVG) === null || _object$elementSVG4 === void 0 ? void 0 : _object$elementSVG4.$groupEl;
|
|
2402
|
+
if ($el && $groupEl) {
|
|
2403
|
+
// apply local RTS transformation to <group> wrapper
|
|
2404
|
+
// account for anchor
|
|
2405
|
+
var localTransform = object.getLocalTransform();
|
|
2406
|
+
_this.applyTransform($groupEl, localTransform);
|
|
2407
|
+
// clipped shapes should also be informed
|
|
2408
|
+
var $useRefs = _this.clipPathUseMap.get(object);
|
|
2409
|
+
if ($useRefs && $useRefs.length) {
|
|
2410
|
+
$useRefs.forEach(function ($use) {
|
|
2411
|
+
// <clipPath transform="matrix()"><circle /></clipPath>
|
|
2412
|
+
_this.applyTransform($use, object.getWorldTransform());
|
|
2413
|
+
// const parentInvert = mat4.invert(
|
|
2414
|
+
// mat4.create(),
|
|
2415
|
+
// (object as DisplayObject).getWorldTransform(),
|
|
2416
|
+
// );
|
|
2417
|
+
// this.applyTransform($clipPath, parentInvert);
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
// finish rendering, clear dirty flag
|
|
2421
|
+
object.renderable.dirty = false;
|
|
2090
2422
|
}
|
|
2091
|
-
|
|
2423
|
+
// update dirty attributes
|
|
2424
|
+
var attributes = _this.dirtyAttributes.get(object);
|
|
2425
|
+
if (attributes) {
|
|
2426
|
+
attributes.forEach(function (attrName) {
|
|
2427
|
+
if (attrName === 'zIndex') {
|
|
2428
|
+
var _object$parentNode, _object$parentNode$el;
|
|
2429
|
+
var parent = object.parentNode;
|
|
2430
|
+
// @ts-ignore
|
|
2431
|
+
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;
|
|
2432
|
+
var children = ((parent === null || parent === void 0 ? void 0 : parent.children) || []).slice();
|
|
2433
|
+
if (_$groupEl) {
|
|
2434
|
+
_this.reorderChildren(document, _$groupEl, children);
|
|
2435
|
+
}
|
|
2436
|
+
} else if (attrName === 'increasedLineWidthForHitTesting') {
|
|
2437
|
+
_this.createOrUpdateHitArea(object, $el, $groupEl);
|
|
2438
|
+
}
|
|
2439
|
+
_this.updateAttribute(object, [attrName]);
|
|
2440
|
+
});
|
|
2441
|
+
_this.dirtyAttributes.delete(object);
|
|
2442
|
+
}
|
|
2443
|
+
});
|
|
2444
|
+
_this.renderQueue = [];
|
|
2092
2445
|
});
|
|
2093
|
-
$groupEl.appendChild(fragment);
|
|
2094
2446
|
}
|
|
2095
|
-
}
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2447
|
+
}, {
|
|
2448
|
+
key: "getId",
|
|
2449
|
+
value: function getId(object) {
|
|
2450
|
+
return "".concat(G_SVG_PREFIX, "-").concat(object.nodeName, "-").concat(object.entity);
|
|
2451
|
+
}
|
|
2452
|
+
}, {
|
|
2453
|
+
key: "reorderChildren",
|
|
2454
|
+
value: function reorderChildren(doc, $groupEl, children) {
|
|
2455
|
+
// need to reorder parent's children
|
|
2456
|
+
children.sort(function (a, b) {
|
|
2457
|
+
return a.sortable.renderOrder - b.sortable.renderOrder;
|
|
2458
|
+
});
|
|
2459
|
+
if (children.length) {
|
|
2460
|
+
// create empty fragment
|
|
2461
|
+
var fragment = (doc || document).createDocumentFragment();
|
|
2462
|
+
children.forEach(function (child) {
|
|
2463
|
+
if (child.isConnected) {
|
|
2464
|
+
// @ts-ignore
|
|
2465
|
+
var $el = child.elementSVG.$groupEl;
|
|
2466
|
+
if ($el) {
|
|
2467
|
+
fragment.appendChild($el);
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
});
|
|
2471
|
+
$groupEl.appendChild(fragment);
|
|
2112
2472
|
}
|
|
2113
|
-
// apply attributes
|
|
2114
|
-
this.updateAttribute(object, Object.keys(attributes));
|
|
2115
2473
|
}
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2474
|
+
}, {
|
|
2475
|
+
key: "applyTransform",
|
|
2476
|
+
value: function applyTransform($el, rts) {
|
|
2477
|
+
// use proper precision avoiding too long string in `transform`
|
|
2478
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Transformations
|
|
2479
|
+
$el.setAttribute('transform', "matrix(".concat(numberToLongString(rts[0]), ",").concat(numberToLongString(rts[1]), ",").concat(numberToLongString(rts[4]), ",").concat(numberToLongString(rts[5]), ",").concat(numberToLongString(rts[12]), ",").concat(numberToLongString(rts[13]), ")"));
|
|
2480
|
+
}
|
|
2481
|
+
}, {
|
|
2482
|
+
key: "applyAttributes",
|
|
2483
|
+
value: function applyAttributes(object) {
|
|
2484
|
+
// @ts-ignore
|
|
2485
|
+
var elementSVG = object.elementSVG;
|
|
2486
|
+
var $el = elementSVG === null || elementSVG === void 0 ? void 0 : elementSVG.$el;
|
|
2487
|
+
var $groupEl = elementSVG === null || elementSVG === void 0 ? void 0 : elementSVG.$groupEl;
|
|
2488
|
+
if ($el && $groupEl) {
|
|
2489
|
+
var nodeName = object.nodeName,
|
|
2490
|
+
attributes = object.attributes;
|
|
2491
|
+
$el.setAttribute('fill', 'none');
|
|
2492
|
+
if (nodeName === gLite.Shape.IMAGE) {
|
|
2493
|
+
$el.setAttribute('preserveAspectRatio', 'none');
|
|
2494
|
+
}
|
|
2495
|
+
// apply attributes
|
|
2496
|
+
this.updateAttribute(object, Object.keys(attributes));
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
}, {
|
|
2500
|
+
key: "updateAttribute",
|
|
2501
|
+
value: function updateAttribute(object, attributes) {
|
|
2502
|
+
var _this2 = this;
|
|
2503
|
+
var document = this.context.config.document;
|
|
2504
|
+
// @ts-ignore
|
|
2505
|
+
var _object$elementSVG5 = object.elementSVG,
|
|
2506
|
+
$el = _object$elementSVG5.$el,
|
|
2507
|
+
$groupEl = _object$elementSVG5.$groupEl,
|
|
2508
|
+
$hitTestingEl = _object$elementSVG5.$hitTestingEl;
|
|
2509
|
+
var parsedStyle = object.parsedStyle,
|
|
2510
|
+
computedStyle = object.computedStyle;
|
|
2511
|
+
var shouldUpdateElementAttribute = attributes.some(function (name) {
|
|
2512
|
+
return (
|
|
2137
2513
|
// @ts-ignore
|
|
2138
|
-
_this2.context.SVGElementLifeCycleContribution.
|
|
2514
|
+
_this2.context.SVGElementLifeCycleContribution.shouldUpdateElementAttribute(object, name)
|
|
2515
|
+
);
|
|
2516
|
+
});
|
|
2517
|
+
// need re-generate path
|
|
2518
|
+
if (shouldUpdateElementAttribute && $el) {
|
|
2519
|
+
[$el, $hitTestingEl].forEach(function ($el) {
|
|
2520
|
+
if ($el) {
|
|
2521
|
+
// @ts-ignore
|
|
2522
|
+
_this2.context.SVGElementLifeCycleContribution.updateElementAttribute(object, $el);
|
|
2523
|
+
if (object.nodeName !== gLite.Shape.TEXT) {
|
|
2524
|
+
_this2.updateAnchorWithTransform(object);
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
});
|
|
2528
|
+
}
|
|
2529
|
+
// update common attributes
|
|
2530
|
+
attributes.forEach(function (name) {
|
|
2531
|
+
var _FORMAT_VALUE_MAP$nam, _propertyMetadataCach;
|
|
2532
|
+
var usedName = SVG_ATTR_MAP[name];
|
|
2533
|
+
var computedValue = computedStyle[name];
|
|
2534
|
+
var computedValueStr = computedValue && computedValue.toString();
|
|
2535
|
+
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;
|
|
2536
|
+
var usedValue = parsedStyle[name];
|
|
2537
|
+
var inherited = !!((_propertyMetadataCach = gLite.propertyMetadataCache[name]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.inh);
|
|
2538
|
+
if (!usedName) {
|
|
2539
|
+
return;
|
|
2540
|
+
}
|
|
2541
|
+
// <foreignObject>
|
|
2542
|
+
if (object.nodeName === gLite.Shape.HTML) {
|
|
2543
|
+
if (name === 'lineWidth') {
|
|
2544
|
+
$el.style['border-width'] = "".concat(usedValue || 0, "px");
|
|
2545
|
+
} else if (name === 'lineDash') {
|
|
2546
|
+
$el.style['border-style'] = 'dashed';
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
if (name === 'fill') {
|
|
2550
|
+
if (object.nodeName === gLite.Shape.HTML) {
|
|
2551
|
+
$el.style.background = usedValue.toString();
|
|
2552
|
+
} else {
|
|
2553
|
+
_this2.defElementManager.createOrUpdateGradientAndPattern(object, $el, usedValue, usedName, _this2);
|
|
2554
|
+
}
|
|
2555
|
+
} else if (name === 'stroke') {
|
|
2556
|
+
if (object.nodeName === gLite.Shape.HTML) {
|
|
2557
|
+
$el.style['border-color'] = usedValue.toString();
|
|
2558
|
+
$el.style['border-style'] = 'solid';
|
|
2559
|
+
} else {
|
|
2560
|
+
_this2.defElementManager.createOrUpdateGradientAndPattern(object, $el, usedValue, usedName, _this2);
|
|
2561
|
+
}
|
|
2562
|
+
} else if (inherited && usedName) {
|
|
2563
|
+
// use computed value
|
|
2564
|
+
// update `visibility` on <group>
|
|
2565
|
+
if (computedValueStr !== 'unset' && computedValueStr !== DEFAULT_VALUE_MAP[name]) {
|
|
2566
|
+
$groupEl === null || $groupEl === void 0 ? void 0 : $groupEl.setAttribute(usedName, formattedValueStr);
|
|
2567
|
+
} else {
|
|
2568
|
+
$groupEl === null || $groupEl === void 0 ? void 0 : $groupEl.removeAttribute(usedName);
|
|
2569
|
+
}
|
|
2570
|
+
} else if (name === 'clipPath') {
|
|
2571
|
+
_this2.createOrUpdateClipOrTextPath(document, usedValue, object);
|
|
2572
|
+
} else if (name === 'textPath') {
|
|
2573
|
+
_this2.createOrUpdateClipOrTextPath(document, usedValue, object, true);
|
|
2574
|
+
} else if (name === 'shadowType' || name === 'shadowColor' || name === 'shadowBlur' || name === 'shadowOffsetX' || name === 'shadowOffsetY') {
|
|
2575
|
+
_this2.defElementManager.createOrUpdateShadow(object, $el, name);
|
|
2576
|
+
} else if (name === 'filter') {
|
|
2577
|
+
_this2.defElementManager.createOrUpdateFilter(object, $el, usedValue);
|
|
2578
|
+
} else if (name === 'innerHTML') {
|
|
2579
|
+
_this2.createOrUpdateInnerHTML(document, $el, usedValue);
|
|
2580
|
+
} else if (name === 'anchor') {
|
|
2581
|
+
// text' anchor is controlled by `textAnchor` property
|
|
2139
2582
|
if (object.nodeName !== gLite.Shape.TEXT) {
|
|
2140
2583
|
_this2.updateAnchorWithTransform(object);
|
|
2141
2584
|
}
|
|
2585
|
+
} else {
|
|
2586
|
+
if (computedValue) {
|
|
2587
|
+
// use computed value so that we can use cascaded effect in SVG
|
|
2588
|
+
// ignore 'unset' and default value
|
|
2589
|
+
[$el, $hitTestingEl].forEach(function ($el) {
|
|
2590
|
+
if ($el && usedName) {
|
|
2591
|
+
if (computedValueStr !== 'unset' && computedValueStr !== DEFAULT_VALUE_MAP[name]) {
|
|
2592
|
+
$el.setAttribute(usedName, formattedValueStr);
|
|
2593
|
+
} else {
|
|
2594
|
+
$el.removeAttribute(usedName);
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
});
|
|
2598
|
+
}
|
|
2142
2599
|
}
|
|
2143
2600
|
});
|
|
2144
2601
|
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
var
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
var
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
if (
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
$el.style['border-style'] = 'dashed';
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
if (name === 'fill') {
|
|
2602
|
+
}, {
|
|
2603
|
+
key: "createSVGDom",
|
|
2604
|
+
value: function createSVGDom(document, object, root) {
|
|
2605
|
+
var noWrapWithGroup = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2606
|
+
// create svg element
|
|
2607
|
+
// @ts-ignore
|
|
2608
|
+
object.elementSVG = new ElementSVG();
|
|
2609
|
+
// @ts-ignore
|
|
2610
|
+
var svgElement = object.elementSVG;
|
|
2611
|
+
// use <group> as default, eg. CustomElement
|
|
2612
|
+
var $el =
|
|
2613
|
+
// @ts-ignore
|
|
2614
|
+
this.context.SVGElementLifeCycleContribution.createElement(object);
|
|
2615
|
+
if ($el) {
|
|
2616
|
+
var _object$parentNode$el2;
|
|
2617
|
+
var $groupEl;
|
|
2618
|
+
// save $el on parsedStyle, which will be returned in getDomElement()
|
|
2166
2619
|
if (object.nodeName === gLite.Shape.HTML) {
|
|
2167
|
-
|
|
2168
|
-
} else {
|
|
2169
|
-
_this2.defElementManager.createOrUpdateGradientAndPattern(object, $el, usedValue, usedName, _this2);
|
|
2620
|
+
object.parsedStyle.$el = $el;
|
|
2170
2621
|
}
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
$el.style['border-color'] = usedValue.toString();
|
|
2174
|
-
$el.style['border-style'] = 'solid';
|
|
2175
|
-
} else {
|
|
2176
|
-
_this2.defElementManager.createOrUpdateGradientAndPattern(object, $el, usedValue, usedName, _this2);
|
|
2622
|
+
if (this.pluginOptions.outputSVGElementId) {
|
|
2623
|
+
$el.id = this.getId(object);
|
|
2177
2624
|
}
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
// update `visibility` on <group>
|
|
2181
|
-
if (computedValueStr !== 'unset' && computedValueStr !== DEFAULT_VALUE_MAP[name]) {
|
|
2182
|
-
$groupEl === null || $groupEl === void 0 ? void 0 : $groupEl.setAttribute(usedName, formattedValueStr);
|
|
2183
|
-
} else {
|
|
2184
|
-
$groupEl === null || $groupEl === void 0 ? void 0 : $groupEl.removeAttribute(usedName);
|
|
2625
|
+
if (this.pluginOptions.outputSVGElementName && object.name) {
|
|
2626
|
+
$el.setAttribute('name', object.name);
|
|
2185
2627
|
}
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
_this2.defElementManager.createOrUpdateShadow(object, $el, name);
|
|
2192
|
-
} else if (name === 'filter') {
|
|
2193
|
-
_this2.defElementManager.createOrUpdateFilter(object, $el, usedValue);
|
|
2194
|
-
} else if (name === 'innerHTML') {
|
|
2195
|
-
_this2.createOrUpdateInnerHTML(document, $el, usedValue);
|
|
2196
|
-
} else if (name === 'anchor') {
|
|
2197
|
-
// text' anchor is controlled by `textAnchor` property
|
|
2198
|
-
if (object.nodeName !== gLite.Shape.TEXT) {
|
|
2199
|
-
_this2.updateAnchorWithTransform(object);
|
|
2628
|
+
if (($el.hasAttribute('data-wrapgroup') || $el.nodeName !== 'g') && !noWrapWithGroup) {
|
|
2629
|
+
$groupEl = createSVGElement('g', document);
|
|
2630
|
+
$groupEl.appendChild($el);
|
|
2631
|
+
} else {
|
|
2632
|
+
$groupEl = $el;
|
|
2200
2633
|
}
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2634
|
+
svgElement.$el = $el;
|
|
2635
|
+
svgElement.$groupEl = $groupEl;
|
|
2636
|
+
// apply attributes at first time
|
|
2637
|
+
this.applyAttributes(object);
|
|
2638
|
+
// create hitArea if necessary
|
|
2639
|
+
this.createOrUpdateHitArea(object, $el, $groupEl);
|
|
2640
|
+
var $parentGroupEl =
|
|
2641
|
+
// @ts-ignore
|
|
2642
|
+
object.parentNode && ((_object$parentNode$el2 = object.parentNode.elementSVG) === null || _object$parentNode$el2 === void 0 ? void 0 : _object$parentNode$el2.$groupEl) || root;
|
|
2643
|
+
if ($parentGroupEl) {
|
|
2644
|
+
$parentGroupEl.appendChild($groupEl);
|
|
2645
|
+
// need reorder children later
|
|
2646
|
+
this.pendingReorderQueue.add(object.parentNode);
|
|
2214
2647
|
}
|
|
2215
2648
|
}
|
|
2216
|
-
});
|
|
2217
|
-
};
|
|
2218
|
-
_proto.createSVGDom = function createSVGDom(document, object, root, noWrapWithGroup) {
|
|
2219
|
-
if (noWrapWithGroup === void 0) {
|
|
2220
|
-
noWrapWithGroup = false;
|
|
2221
2649
|
}
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
var svgElement = object.elementSVG;
|
|
2227
|
-
// use <group> as default, eg. CustomElement
|
|
2228
|
-
var $el =
|
|
2229
|
-
// @ts-ignore
|
|
2230
|
-
this.context.SVGElementLifeCycleContribution.createElement(object);
|
|
2231
|
-
if ($el) {
|
|
2232
|
-
var _object$parentNode$el2;
|
|
2233
|
-
var $groupEl;
|
|
2234
|
-
// save $el on parsedStyle, which will be returned in getDomElement()
|
|
2235
|
-
if (object.nodeName === gLite.Shape.HTML) {
|
|
2236
|
-
object.parsedStyle.$el = $el;
|
|
2237
|
-
}
|
|
2238
|
-
if (this.pluginOptions.outputSVGElementId) {
|
|
2239
|
-
$el.id = this.getId(object);
|
|
2240
|
-
}
|
|
2241
|
-
if (this.pluginOptions.outputSVGElementName && object.name) {
|
|
2242
|
-
$el.setAttribute('name', object.name);
|
|
2243
|
-
}
|
|
2244
|
-
if (($el.hasAttribute('data-wrapgroup') || $el.nodeName !== 'g') && !noWrapWithGroup) {
|
|
2245
|
-
$groupEl = createSVGElement('g', document);
|
|
2246
|
-
$groupEl.appendChild($el);
|
|
2247
|
-
} else {
|
|
2248
|
-
$groupEl = $el;
|
|
2249
|
-
}
|
|
2250
|
-
svgElement.$el = $el;
|
|
2251
|
-
svgElement.$groupEl = $groupEl;
|
|
2252
|
-
// apply attributes at first time
|
|
2253
|
-
this.applyAttributes(object);
|
|
2254
|
-
// create hitArea if necessary
|
|
2255
|
-
this.createOrUpdateHitArea(object, $el, $groupEl);
|
|
2256
|
-
var $parentGroupEl =
|
|
2650
|
+
}, {
|
|
2651
|
+
key: "removeSVGDom",
|
|
2652
|
+
value: function removeSVGDom(object) {
|
|
2653
|
+
var _object$elementSVG6;
|
|
2257
2654
|
// @ts-ignore
|
|
2258
|
-
|
|
2259
|
-
if ($
|
|
2260
|
-
$
|
|
2261
|
-
//
|
|
2262
|
-
this.
|
|
2655
|
+
var $groupEl = (_object$elementSVG6 = object.elementSVG) === null || _object$elementSVG6 === void 0 ? void 0 : _object$elementSVG6.$groupEl;
|
|
2656
|
+
if ($groupEl && $groupEl.parentNode) {
|
|
2657
|
+
$groupEl.parentNode.removeChild($groupEl);
|
|
2658
|
+
// @ts-ignore
|
|
2659
|
+
this.context.SVGElementLifeCycleContribution.destroyElement(object, $groupEl);
|
|
2660
|
+
// object.entity.removeComponent(ElementSVG, true);
|
|
2263
2661
|
}
|
|
2264
2662
|
}
|
|
2265
|
-
}
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
// @ts-ignore
|
|
2269
|
-
var $groupEl = (_object$elementSVG6 = object.elementSVG) === null || _object$elementSVG6 === void 0 ? void 0 : _object$elementSVG6.$groupEl;
|
|
2270
|
-
if ($groupEl && $groupEl.parentNode) {
|
|
2271
|
-
$groupEl.parentNode.removeChild($groupEl);
|
|
2663
|
+
}, {
|
|
2664
|
+
key: "createOrUpdateHitArea",
|
|
2665
|
+
value: function createOrUpdateHitArea(object, $el, $groupEl) {
|
|
2272
2666
|
// @ts-ignore
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
//
|
|
2289
|
-
|
|
2667
|
+
var svgElement = object.elementSVG;
|
|
2668
|
+
var $hitTestingEl = svgElement.$hitTestingEl;
|
|
2669
|
+
var increasedLineWidthForHitTesting = object.parsedStyle.increasedLineWidthForHitTesting;
|
|
2670
|
+
// account for hitArea
|
|
2671
|
+
if (increasedLineWidthForHitTesting) {
|
|
2672
|
+
if (!$hitTestingEl) {
|
|
2673
|
+
$hitTestingEl = $el.cloneNode();
|
|
2674
|
+
if (this.pluginOptions.outputSVGElementId) {
|
|
2675
|
+
// use the entity suffix, so that `g-plugin-svg-picker` can extract
|
|
2676
|
+
$hitTestingEl.id = "".concat(G_SVG_PREFIX, "-").concat(object.nodeName, "-hittesting-").concat(object.entity);
|
|
2677
|
+
}
|
|
2678
|
+
// clear attributes like `filter` `font-size`
|
|
2679
|
+
['filter'].forEach(function (attribute) {
|
|
2680
|
+
$hitTestingEl.removeAttribute(attribute);
|
|
2681
|
+
});
|
|
2682
|
+
// hitArea should be 'transparent' but not 'none'
|
|
2683
|
+
var hasFill = $el.getAttribute('fill') !== 'none';
|
|
2684
|
+
$hitTestingEl.setAttribute('fill', hasFill ? 'transparent' : 'none');
|
|
2685
|
+
$hitTestingEl.setAttribute('stroke', 'transparent');
|
|
2686
|
+
$groupEl.appendChild($hitTestingEl);
|
|
2687
|
+
svgElement.$hitTestingEl = $hitTestingEl;
|
|
2688
|
+
}
|
|
2689
|
+
// increase interactive line width
|
|
2690
|
+
$hitTestingEl.setAttribute('stroke-width', "".concat(increasedLineWidthForHitTesting + object.parsedStyle.lineWidth));
|
|
2691
|
+
} else {
|
|
2692
|
+
if ($hitTestingEl) {
|
|
2693
|
+
$groupEl.removeChild($hitTestingEl);
|
|
2694
|
+
svgElement.$hitTestingEl = null;
|
|
2290
2695
|
}
|
|
2291
|
-
// clear attributes like `filter` `font-size`
|
|
2292
|
-
['filter'].forEach(function (attribute) {
|
|
2293
|
-
$hitTestingEl.removeAttribute(attribute);
|
|
2294
|
-
});
|
|
2295
|
-
// hitArea should be 'transparent' but not 'none'
|
|
2296
|
-
var hasFill = $el.getAttribute('fill') !== 'none';
|
|
2297
|
-
$hitTestingEl.setAttribute('fill', hasFill ? 'transparent' : 'none');
|
|
2298
|
-
$hitTestingEl.setAttribute('stroke', 'transparent');
|
|
2299
|
-
$groupEl.appendChild($hitTestingEl);
|
|
2300
|
-
svgElement.$hitTestingEl = $hitTestingEl;
|
|
2301
|
-
}
|
|
2302
|
-
// increase interactive line width
|
|
2303
|
-
$hitTestingEl.setAttribute('stroke-width', "" + (increasedLineWidthForHitTesting + object.parsedStyle.lineWidth));
|
|
2304
|
-
} else {
|
|
2305
|
-
if ($hitTestingEl) {
|
|
2306
|
-
$groupEl.removeChild($hitTestingEl);
|
|
2307
|
-
svgElement.$hitTestingEl = null;
|
|
2308
2696
|
}
|
|
2309
2697
|
}
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
_proto.createOrUpdateClipOrTextPath = function createOrUpdateClipOrTextPath(document, clipPath, object, isTextPath) {
|
|
2322
|
-
if (isTextPath === void 0) {
|
|
2323
|
-
isTextPath = false;
|
|
2698
|
+
}, {
|
|
2699
|
+
key: "createOrUpdateInnerHTML",
|
|
2700
|
+
value: function createOrUpdateInnerHTML(doc, $el, usedValue) {
|
|
2701
|
+
var $div = (doc || document).createElement('div');
|
|
2702
|
+
if (typeof usedValue === 'string') {
|
|
2703
|
+
$div.innerHTML = usedValue;
|
|
2704
|
+
} else {
|
|
2705
|
+
$div.appendChild(usedValue);
|
|
2706
|
+
}
|
|
2707
|
+
$el.innerHTML = '';
|
|
2708
|
+
$el.appendChild($div);
|
|
2324
2709
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
var
|
|
2332
|
-
var
|
|
2333
|
-
var
|
|
2334
|
-
if (
|
|
2335
|
-
var
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2710
|
+
}, {
|
|
2711
|
+
key: "createOrUpdateClipOrTextPath",
|
|
2712
|
+
value: function createOrUpdateClipOrTextPath(document, clipPath, object) {
|
|
2713
|
+
var isTextPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2714
|
+
// @ts-ignore
|
|
2715
|
+
var $groupEl = object.elementSVG.$groupEl;
|
|
2716
|
+
var PREFIX = isTextPath ? TEXT_PATH_PREFIX : CLIP_PATH_PREFIX;
|
|
2717
|
+
var attributeNameCamel = isTextPath ? 'g' : 'clipPath';
|
|
2718
|
+
var attributeNameHyphen = isTextPath ? 'text-path' : 'clip-path';
|
|
2719
|
+
if (clipPath) {
|
|
2720
|
+
var clipPathId = PREFIX + clipPath.entity + '-' + object.entity;
|
|
2721
|
+
var $def = this.defElementManager.getDefElement();
|
|
2722
|
+
var existed = $def.querySelector("#".concat(clipPathId));
|
|
2723
|
+
if (!existed) {
|
|
2724
|
+
var $clipPath;
|
|
2725
|
+
if (isTextPath) {
|
|
2726
|
+
// use <path> directly instead of wrapping with <g>
|
|
2727
|
+
this.createSVGDom(document, clipPath, null, true);
|
|
2728
|
+
// @ts-ignore
|
|
2729
|
+
$clipPath = clipPath.elementSVG.$el;
|
|
2730
|
+
} else {
|
|
2731
|
+
// the clipPath is allowed to be detached from canvas
|
|
2732
|
+
if (!clipPath.isConnected) {
|
|
2733
|
+
var $existedClipPath = $def.querySelector("#".concat(this.getId(clipPath)));
|
|
2734
|
+
if (!$existedClipPath) {
|
|
2735
|
+
this.createSVGDom(document, clipPath, $def, true);
|
|
2736
|
+
}
|
|
2347
2737
|
}
|
|
2738
|
+
// create <clipPath> dom node
|
|
2739
|
+
$clipPath = createSVGElement(attributeNameCamel, document);
|
|
2740
|
+
var $use = createSVGElement('use', document);
|
|
2741
|
+
// @ts-ignore
|
|
2742
|
+
$use.setAttribute('href', "#".concat(clipPath.elementSVG.$el.id));
|
|
2743
|
+
$clipPath.appendChild($use);
|
|
2744
|
+
var $useRefs = this.clipPathUseMap.get(clipPath);
|
|
2745
|
+
if (!$useRefs) {
|
|
2746
|
+
this.clipPathUseMap.set(clipPath, []);
|
|
2747
|
+
$useRefs = this.clipPathUseMap.get(clipPath);
|
|
2748
|
+
}
|
|
2749
|
+
$useRefs.push($use);
|
|
2750
|
+
// <clipPath transform="matrix()"><circle /></clipPath>
|
|
2751
|
+
this.applyTransform($use, clipPath.getWorldTransform());
|
|
2752
|
+
var parentInvert = invert(create(), object.getWorldTransform());
|
|
2753
|
+
this.applyTransform($clipPath, parentInvert);
|
|
2348
2754
|
}
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
// @ts-ignore
|
|
2353
|
-
$use.setAttribute('href', "#" + clipPath.elementSVG.$el.id);
|
|
2354
|
-
$clipPath.appendChild($use);
|
|
2355
|
-
var $useRefs = this.clipPathUseMap.get(clipPath);
|
|
2356
|
-
if (!$useRefs) {
|
|
2357
|
-
this.clipPathUseMap.set(clipPath, []);
|
|
2358
|
-
$useRefs = this.clipPathUseMap.get(clipPath);
|
|
2359
|
-
}
|
|
2360
|
-
$useRefs.push($use);
|
|
2361
|
-
// <clipPath transform="matrix()"><circle /></clipPath>
|
|
2362
|
-
this.applyTransform($use, clipPath.getWorldTransform());
|
|
2363
|
-
var parentInvert = invert(create(), object.getWorldTransform());
|
|
2364
|
-
this.applyTransform($clipPath, parentInvert);
|
|
2755
|
+
$clipPath.id = clipPathId;
|
|
2756
|
+
// append it to <defs>
|
|
2757
|
+
$def.appendChild($clipPath);
|
|
2365
2758
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
if (!isTextPath) {
|
|
2373
|
-
// apply clipPath to $group
|
|
2374
|
-
// @see https://github.com/antvis/g/issues/961
|
|
2375
|
-
$groupEl.setAttribute(attributeNameHyphen, "url(#" + clipPathId + ")");
|
|
2376
|
-
}
|
|
2377
|
-
} else {
|
|
2378
|
-
if (!isTextPath) {
|
|
2379
|
-
// remove clip path
|
|
2380
|
-
$groupEl.removeAttribute(attributeNameHyphen);
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2383
|
-
}
|
|
2384
|
-
/**
|
|
2385
|
-
* the origin is bounding box's top left corner
|
|
2386
|
-
*/;
|
|
2387
|
-
_proto.updateAnchorWithTransform = function updateAnchorWithTransform(object) {
|
|
2388
|
-
var _object$elementSVG7, _object$elementSVG8;
|
|
2389
|
-
var bounds = object.getGeometryBounds();
|
|
2390
|
-
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
2391
|
-
var height = bounds && bounds.halfExtents[1] * 2 || 0;
|
|
2392
|
-
var _ref2 = object.parsedStyle || {},
|
|
2393
|
-
anchor = _ref2.anchor;
|
|
2394
|
-
// @ts-ignore
|
|
2395
|
-
[(_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) {
|
|
2396
|
-
if ($el) {
|
|
2397
|
-
var tx = -(anchor[0] * width);
|
|
2398
|
-
var ty = -(anchor[1] * height);
|
|
2399
|
-
if (tx !== 0 || ty !== 0) {
|
|
2400
|
-
// apply anchor to element's `transform` property
|
|
2401
|
-
$el.setAttribute('transform',
|
|
2402
|
-
// can't use percent unit like translate(-50%, -50%)
|
|
2403
|
-
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/transform#translate
|
|
2404
|
-
"translate(" + tx + "," + ty + ")");
|
|
2759
|
+
// apply attributes
|
|
2760
|
+
this.applyAttributes(clipPath);
|
|
2761
|
+
if (!isTextPath) {
|
|
2762
|
+
// apply clipPath to $group
|
|
2763
|
+
// @see https://github.com/antvis/g/issues/961
|
|
2764
|
+
$groupEl.setAttribute(attributeNameHyphen, "url(#".concat(clipPathId, ")"));
|
|
2405
2765
|
}
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2766
|
+
} else {
|
|
2767
|
+
if (!isTextPath) {
|
|
2768
|
+
// remove clip path
|
|
2769
|
+
$groupEl.removeAttribute(attributeNameHyphen);
|
|
2409
2770
|
}
|
|
2410
2771
|
}
|
|
2411
|
-
}
|
|
2412
|
-
|
|
2772
|
+
}
|
|
2773
|
+
/**
|
|
2774
|
+
* the origin is bounding box's top left corner
|
|
2775
|
+
*/
|
|
2776
|
+
}, {
|
|
2777
|
+
key: "updateAnchorWithTransform",
|
|
2778
|
+
value: function updateAnchorWithTransform(object) {
|
|
2779
|
+
var _object$elementSVG7, _object$elementSVG8;
|
|
2780
|
+
var bounds = object.getGeometryBounds();
|
|
2781
|
+
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
2782
|
+
var height = bounds && bounds.halfExtents[1] * 2 || 0;
|
|
2783
|
+
var _ref2 = object.parsedStyle || {},
|
|
2784
|
+
anchor = _ref2.anchor;
|
|
2785
|
+
// @ts-ignore
|
|
2786
|
+
[(_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) {
|
|
2787
|
+
if ($el) {
|
|
2788
|
+
var tx = -(anchor[0] * width);
|
|
2789
|
+
var ty = -(anchor[1] * height);
|
|
2790
|
+
if (tx !== 0 || ty !== 0) {
|
|
2791
|
+
// apply anchor to element's `transform` property
|
|
2792
|
+
$el.setAttribute('transform',
|
|
2793
|
+
// can't use percent unit like translate(-50%, -50%)
|
|
2794
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/transform#translate
|
|
2795
|
+
"translate(".concat(tx, ",").concat(ty, ")"));
|
|
2796
|
+
}
|
|
2797
|
+
if (object.nodeName === gLite.Shape.CIRCLE || object.nodeName === gLite.Shape.ELLIPSE) {
|
|
2798
|
+
$el.setAttribute('cx', "".concat(width / 2));
|
|
2799
|
+
$el.setAttribute('cy', "".concat(height / 2));
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
});
|
|
2803
|
+
}
|
|
2804
|
+
}]);
|
|
2413
2805
|
return SVGRendererPlugin;
|
|
2414
2806
|
}();
|
|
2415
2807
|
SVGRendererPlugin.tag = 'SVGRenderer';
|
|
@@ -2465,18 +2857,18 @@
|
|
|
2465
2857
|
var lineNum = lines.length;
|
|
2466
2858
|
var styleCSSText = '';
|
|
2467
2859
|
if (dx !== 0 || dy !== 0) {
|
|
2468
|
-
styleCSSText += "transform:translate("
|
|
2860
|
+
styleCSSText += "transform:translate(".concat(dx, "px, ").concat(dy, "px);");
|
|
2469
2861
|
}
|
|
2470
2862
|
if (textDecorationLine && textDecorationLine !== 'none') {
|
|
2471
2863
|
// use CSS text-decoration since the implementation in SVG is not good enough
|
|
2472
|
-
styleCSSText += "text-decoration:"
|
|
2864
|
+
styleCSSText += "text-decoration:".concat(textDecorationLine, " ").concat(textDecorationStyle, " ").concat(textDecorationColor, ";");
|
|
2473
2865
|
}
|
|
2474
2866
|
if (styleCSSText) {
|
|
2475
2867
|
$el.setAttribute('style', styleCSSText);
|
|
2476
2868
|
}
|
|
2477
2869
|
if (lineNum === 1) {
|
|
2478
2870
|
var textContent = convertHTML(lines[0]);
|
|
2479
|
-
$el.setAttribute('dx', ""
|
|
2871
|
+
$el.setAttribute('dx', "".concat(lineWidth / 2));
|
|
2480
2872
|
// <textPath> only support one line
|
|
2481
2873
|
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/textPath
|
|
2482
2874
|
if (textPath) {
|
|
@@ -2484,12 +2876,12 @@
|
|
|
2484
2876
|
$el.innerHTML = '';
|
|
2485
2877
|
// append <textPath href="#MyPath">text</textPath>
|
|
2486
2878
|
var $textPath = createSVGElement('textPath', $el.ownerDocument);
|
|
2487
|
-
$textPath.setAttribute('href', "#"
|
|
2879
|
+
$textPath.setAttribute('href', "#".concat(TEXT_PATH_PREFIX + textPath.entity));
|
|
2488
2880
|
if (textPathSide !== 'left') {
|
|
2489
2881
|
$textPath.setAttribute('side', textPathSide);
|
|
2490
2882
|
}
|
|
2491
2883
|
if (textPathStartOffset !== 0) {
|
|
2492
|
-
$textPath.setAttribute('startOffset', ""
|
|
2884
|
+
$textPath.setAttribute('startOffset', "".concat(textPathStartOffset));
|
|
2493
2885
|
}
|
|
2494
2886
|
$textPath.innerHTML = textContent;
|
|
2495
2887
|
$el.appendChild($textPath);
|
|
@@ -2512,70 +2904,79 @@
|
|
|
2512
2904
|
} else {
|
|
2513
2905
|
dy = lineHeight;
|
|
2514
2906
|
}
|
|
2515
|
-
return "<tspan x=\"0\" dx=\""
|
|
2907
|
+
return "<tspan x=\"0\" dx=\"".concat(dx, "\" dy=\"").concat(dy, "\">").concat(convertHTML(line), "</tspan>");
|
|
2516
2908
|
}).join('');
|
|
2517
2909
|
}
|
|
2518
2910
|
}
|
|
2519
2911
|
var _SHAPE2TAGS, _SHAPE_UPDATE_DEPS;
|
|
2520
|
-
var SHAPE2TAGS = (_SHAPE2TAGS = {}, _SHAPE2TAGS
|
|
2521
|
-
var SHAPE_UPDATE_DEPS = (_SHAPE_UPDATE_DEPS = {}, _SHAPE_UPDATE_DEPS
|
|
2912
|
+
var SHAPE2TAGS = (_SHAPE2TAGS = {}, _defineProperty(_SHAPE2TAGS, gLite.Shape.RECT, 'path'), _defineProperty(_SHAPE2TAGS, gLite.Shape.CIRCLE, 'circle'), _defineProperty(_SHAPE2TAGS, gLite.Shape.ELLIPSE, 'ellipse'), _defineProperty(_SHAPE2TAGS, gLite.Shape.IMAGE, 'image'), _defineProperty(_SHAPE2TAGS, gLite.Shape.GROUP, 'g'), _defineProperty(_SHAPE2TAGS, gLite.Shape.LINE, 'line'), _defineProperty(_SHAPE2TAGS, gLite.Shape.POLYLINE, 'polyline'), _defineProperty(_SHAPE2TAGS, gLite.Shape.POLYGON, 'polygon'), _defineProperty(_SHAPE2TAGS, gLite.Shape.TEXT, 'text'), _defineProperty(_SHAPE2TAGS, gLite.Shape.PATH, 'path'), _defineProperty(_SHAPE2TAGS, gLite.Shape.HTML, 'foreignObject'), _SHAPE2TAGS);
|
|
2913
|
+
var SHAPE_UPDATE_DEPS = (_SHAPE_UPDATE_DEPS = {}, _defineProperty(_SHAPE_UPDATE_DEPS, gLite.Shape.CIRCLE, ['r']), _defineProperty(_SHAPE_UPDATE_DEPS, gLite.Shape.ELLIPSE, ['rx', 'ry']), _defineProperty(_SHAPE_UPDATE_DEPS, gLite.Shape.RECT, ['width', 'height', 'radius']), _defineProperty(_SHAPE_UPDATE_DEPS, gLite.Shape.IMAGE, ['img', 'width', 'height']), _defineProperty(_SHAPE_UPDATE_DEPS, gLite.Shape.LINE, ['x1', 'y1', 'x2', 'y2', 'markerStart', 'markerEnd', 'markerStartOffset', 'markerEndOffset']), _defineProperty(_SHAPE_UPDATE_DEPS, gLite.Shape.POLYLINE, ['points', 'markerStart', 'markerEnd', 'markerMid', 'markerStartOffset', 'markerEndOffset']), _defineProperty(_SHAPE_UPDATE_DEPS, gLite.Shape.POLYGON, ['points', 'markerStart', 'markerEnd', 'markerMid', 'markerStartOffset', 'markerEndOffset']), _defineProperty(_SHAPE_UPDATE_DEPS, gLite.Shape.PATH, ['path', 'markerStart', 'markerEnd', 'markerMid', 'markerStartOffset', 'markerEndOffset']), _defineProperty(_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',
|
|
2522
2914
|
// 'whiteSpace',
|
|
2523
|
-
'dx', 'dy'], _SHAPE_UPDATE_DEPS);
|
|
2915
|
+
'dx', 'dy']), _SHAPE_UPDATE_DEPS);
|
|
2524
2916
|
var DefaultElementLifeCycleContribution = /*#__PURE__*/function () {
|
|
2525
2917
|
function DefaultElementLifeCycleContribution(context) {
|
|
2918
|
+
_classCallCheck$2(this, DefaultElementLifeCycleContribution);
|
|
2526
2919
|
this.context = void 0;
|
|
2527
2920
|
this.context = context;
|
|
2528
2921
|
}
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
_proto.destroyElement = function destroyElement(object, $el) {};
|
|
2536
|
-
_proto.shouldUpdateElementAttribute = function shouldUpdateElementAttribute(object, attributeName) {
|
|
2537
|
-
var nodeName = object.nodeName;
|
|
2538
|
-
return (SHAPE_UPDATE_DEPS[nodeName] || []).indexOf(attributeName) > -1;
|
|
2539
|
-
};
|
|
2540
|
-
_proto.updateElementAttribute = function updateElementAttribute(object) {
|
|
2541
|
-
// @ts-ignore
|
|
2542
|
-
var $el = object.elementSVG.$el;
|
|
2543
|
-
var nodeName = object.nodeName,
|
|
2544
|
-
parsedStyle = object.parsedStyle;
|
|
2545
|
-
switch (nodeName) {
|
|
2546
|
-
case gLite.Shape.IMAGE:
|
|
2547
|
-
{
|
|
2548
|
-
updateImageElementAttribute($el, parsedStyle);
|
|
2549
|
-
break;
|
|
2550
|
-
}
|
|
2551
|
-
case gLite.Shape.RECT:
|
|
2552
|
-
{
|
|
2553
|
-
updateRectElementAttribute($el, parsedStyle);
|
|
2554
|
-
break;
|
|
2555
|
-
}
|
|
2556
|
-
case gLite.Shape.LINE:
|
|
2557
|
-
{
|
|
2558
|
-
updateLineElementAttribute($el, parsedStyle);
|
|
2559
|
-
break;
|
|
2560
|
-
}
|
|
2561
|
-
case gLite.Shape.POLYGON:
|
|
2562
|
-
case gLite.Shape.POLYLINE:
|
|
2563
|
-
{
|
|
2564
|
-
updatePolylineElementAttribute($el, parsedStyle);
|
|
2565
|
-
break;
|
|
2566
|
-
}
|
|
2567
|
-
case gLite.Shape.PATH:
|
|
2568
|
-
{
|
|
2569
|
-
updatePathElementAttribute($el, parsedStyle);
|
|
2570
|
-
break;
|
|
2571
|
-
}
|
|
2572
|
-
case gLite.Shape.TEXT:
|
|
2573
|
-
{
|
|
2574
|
-
updateTextElementAttribute($el, parsedStyle);
|
|
2575
|
-
break;
|
|
2576
|
-
}
|
|
2922
|
+
_createClass$2(DefaultElementLifeCycleContribution, [{
|
|
2923
|
+
key: "createElement",
|
|
2924
|
+
value: function createElement(object) {
|
|
2925
|
+
var doc = this.context.config.document;
|
|
2926
|
+
var type = SHAPE2TAGS[object.nodeName] || 'g';
|
|
2927
|
+
return createSVGElement(type, doc || document);
|
|
2577
2928
|
}
|
|
2578
|
-
}
|
|
2929
|
+
}, {
|
|
2930
|
+
key: "destroyElement",
|
|
2931
|
+
value: function destroyElement(object, $el) {}
|
|
2932
|
+
}, {
|
|
2933
|
+
key: "shouldUpdateElementAttribute",
|
|
2934
|
+
value: function shouldUpdateElementAttribute(object, attributeName) {
|
|
2935
|
+
var nodeName = object.nodeName;
|
|
2936
|
+
return (SHAPE_UPDATE_DEPS[nodeName] || []).indexOf(attributeName) > -1;
|
|
2937
|
+
}
|
|
2938
|
+
}, {
|
|
2939
|
+
key: "updateElementAttribute",
|
|
2940
|
+
value: function updateElementAttribute(object) {
|
|
2941
|
+
// @ts-ignore
|
|
2942
|
+
var $el = object.elementSVG.$el;
|
|
2943
|
+
var nodeName = object.nodeName,
|
|
2944
|
+
parsedStyle = object.parsedStyle;
|
|
2945
|
+
switch (nodeName) {
|
|
2946
|
+
case gLite.Shape.IMAGE:
|
|
2947
|
+
{
|
|
2948
|
+
updateImageElementAttribute($el, parsedStyle);
|
|
2949
|
+
break;
|
|
2950
|
+
}
|
|
2951
|
+
case gLite.Shape.RECT:
|
|
2952
|
+
{
|
|
2953
|
+
updateRectElementAttribute($el, parsedStyle);
|
|
2954
|
+
break;
|
|
2955
|
+
}
|
|
2956
|
+
case gLite.Shape.LINE:
|
|
2957
|
+
{
|
|
2958
|
+
updateLineElementAttribute($el, parsedStyle);
|
|
2959
|
+
break;
|
|
2960
|
+
}
|
|
2961
|
+
case gLite.Shape.POLYGON:
|
|
2962
|
+
case gLite.Shape.POLYLINE:
|
|
2963
|
+
{
|
|
2964
|
+
updatePolylineElementAttribute($el, parsedStyle);
|
|
2965
|
+
break;
|
|
2966
|
+
}
|
|
2967
|
+
case gLite.Shape.PATH:
|
|
2968
|
+
{
|
|
2969
|
+
updatePathElementAttribute($el, parsedStyle);
|
|
2970
|
+
break;
|
|
2971
|
+
}
|
|
2972
|
+
case gLite.Shape.TEXT:
|
|
2973
|
+
{
|
|
2974
|
+
updateTextElementAttribute($el, parsedStyle);
|
|
2975
|
+
break;
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
}]);
|
|
2579
2980
|
return DefaultElementLifeCycleContribution;
|
|
2580
2981
|
}();
|
|
2581
2982
|
var FILTER_PREFIX = 'g-filter-';
|
|
@@ -2586,7 +2987,7 @@
|
|
|
2586
2987
|
function createOrUpdateFilter(document, $def, object, $el, filters) {
|
|
2587
2988
|
// eg. filter="url(#f1) url(#f2)"
|
|
2588
2989
|
var filterName = FILTER_PREFIX + object.entity;
|
|
2589
|
-
var $existedFilters = $def.querySelectorAll("[name="
|
|
2990
|
+
var $existedFilters = $def.querySelectorAll("[name=".concat(filterName, "]"));
|
|
2590
2991
|
if ($existedFilters.length) {
|
|
2591
2992
|
$existedFilters.forEach(function ($filter) {
|
|
2592
2993
|
$def.removeChild($filter);
|
|
@@ -2621,7 +3022,7 @@
|
|
|
2621
3022
|
} else if (name === 'invert') {
|
|
2622
3023
|
createInvert(document, $filter, params);
|
|
2623
3024
|
}
|
|
2624
|
-
$filter.id = filterName
|
|
3025
|
+
$filter.id = "".concat(filterName, "-").concat(i);
|
|
2625
3026
|
$filter.setAttribute('name', filterName);
|
|
2626
3027
|
$def.appendChild($filter);
|
|
2627
3028
|
return $filter.id;
|
|
@@ -2629,7 +3030,7 @@
|
|
|
2629
3030
|
// @see https://github.com/antvis/G/issues/1114
|
|
2630
3031
|
setTimeout(function () {
|
|
2631
3032
|
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', filterIds.map(function (filterId) {
|
|
2632
|
-
return "url(#"
|
|
3033
|
+
return "url(#".concat(filterId, ")");
|
|
2633
3034
|
}).join(' '));
|
|
2634
3035
|
});
|
|
2635
3036
|
}
|
|
@@ -2643,7 +3044,7 @@
|
|
|
2643
3044
|
function createBlur(document, $filter, params) {
|
|
2644
3045
|
var $feGaussianBlur = createSVGElement('feGaussianBlur', document);
|
|
2645
3046
|
$feGaussianBlur.setAttribute('in', 'SourceGraphic');
|
|
2646
|
-
$feGaussianBlur.setAttribute('stdDeviation', ""
|
|
3047
|
+
$feGaussianBlur.setAttribute('stdDeviation', "".concat(params[0].value));
|
|
2647
3048
|
$filter.appendChild($feGaussianBlur);
|
|
2648
3049
|
}
|
|
2649
3050
|
function createFeComponentTransfer(document, $filter, _ref2) {
|
|
@@ -2655,10 +3056,10 @@
|
|
|
2655
3056
|
[createSVGElement('feFuncR', document), createSVGElement('feFuncG', document), createSVGElement('feFuncB', document)].forEach(function ($feFunc) {
|
|
2656
3057
|
$feFunc.setAttribute('type', type);
|
|
2657
3058
|
if (type === 'table') {
|
|
2658
|
-
$feFunc.setAttribute('tableValues', ""
|
|
3059
|
+
$feFunc.setAttribute('tableValues', "".concat(tableValues));
|
|
2659
3060
|
} else {
|
|
2660
|
-
$feFunc.setAttribute('slope', ""
|
|
2661
|
-
$feFunc.setAttribute('intercept', ""
|
|
3061
|
+
$feFunc.setAttribute('slope', "".concat(slope));
|
|
3062
|
+
$feFunc.setAttribute('intercept', "".concat(intercept));
|
|
2662
3063
|
}
|
|
2663
3064
|
$feComponentTransfer.appendChild($feFunc);
|
|
2664
3065
|
});
|
|
@@ -2676,7 +3077,7 @@
|
|
|
2676
3077
|
var amount = convertToAbsoluteValue(params[0]);
|
|
2677
3078
|
createFeComponentTransfer(document, $filter, {
|
|
2678
3079
|
type: 'table',
|
|
2679
|
-
tableValues: amount
|
|
3080
|
+
tableValues: "".concat(amount, " ").concat(1 - amount)
|
|
2680
3081
|
});
|
|
2681
3082
|
}
|
|
2682
3083
|
function createBrightness(document, $filter, params) {
|
|
@@ -2691,13 +3092,13 @@
|
|
|
2691
3092
|
var amount = convertToAbsoluteValue(params[0]);
|
|
2692
3093
|
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
2693
3094
|
$feColorMatrix.setAttribute('type', 'saturate');
|
|
2694
|
-
$feColorMatrix.setAttribute('values', ""
|
|
3095
|
+
$feColorMatrix.setAttribute('values', "".concat(amount));
|
|
2695
3096
|
$filter.appendChild($feColorMatrix);
|
|
2696
3097
|
}
|
|
2697
3098
|
function createHueRotate(document, $filter, params) {
|
|
2698
3099
|
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
2699
3100
|
$feColorMatrix.setAttribute('type', 'hueRotate');
|
|
2700
|
-
$feColorMatrix.setAttribute('values', ""
|
|
3101
|
+
$feColorMatrix.setAttribute('values', "".concat(params[0].to(gLite.UnitType.kDegrees).value));
|
|
2701
3102
|
$filter.appendChild($feColorMatrix);
|
|
2702
3103
|
}
|
|
2703
3104
|
function createDropShadow(document, $filter, params) {
|
|
@@ -2708,11 +3109,11 @@
|
|
|
2708
3109
|
var shadowColor = params[3].formatted;
|
|
2709
3110
|
var $feGaussianBlur = createSVGElement('feGaussianBlur', document);
|
|
2710
3111
|
$feGaussianBlur.setAttribute('in', 'SourceAlpha');
|
|
2711
|
-
$feGaussianBlur.setAttribute('stdDeviation', ""
|
|
3112
|
+
$feGaussianBlur.setAttribute('stdDeviation', "".concat(shadowBlur));
|
|
2712
3113
|
$filter.appendChild($feGaussianBlur);
|
|
2713
3114
|
var $feOffset = createSVGElement('feOffset', document);
|
|
2714
|
-
$feOffset.setAttribute('dx', ""
|
|
2715
|
-
$feOffset.setAttribute('dy', ""
|
|
3115
|
+
$feOffset.setAttribute('dx', "".concat(shadowOffsetX));
|
|
3116
|
+
$feOffset.setAttribute('dy', "".concat(shadowOffsetY));
|
|
2716
3117
|
$feOffset.setAttribute('result', 'offsetblur');
|
|
2717
3118
|
$filter.appendChild($feOffset);
|
|
2718
3119
|
var $feFlood = createSVGElement('feFlood', document);
|
|
@@ -2770,34 +3171,32 @@
|
|
|
2770
3171
|
var patternId = createOrUpdatePattern(document, $def, object, parsedColor, createImage, plugin);
|
|
2771
3172
|
// use style instead of attribute when applying <pattern>
|
|
2772
3173
|
// @see https://stackoverflow.com/a/7723115
|
|
2773
|
-
$el.style[name] = "url(#"
|
|
3174
|
+
$el.style[name] = "url(#".concat(patternId, ")");
|
|
2774
3175
|
return patternId;
|
|
2775
3176
|
} else {
|
|
2776
3177
|
if (parsedColor.length === 1) {
|
|
2777
3178
|
var gradientId = createOrUpdateGradient(document, object, $def, $el, parsedColor[0]);
|
|
2778
|
-
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, "url(#"
|
|
3179
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, "url(#".concat(gradientId, ")"));
|
|
2779
3180
|
return gradientId;
|
|
2780
3181
|
} else {
|
|
2781
3182
|
// @see https://stackoverflow.com/questions/20671502/can-i-blend-gradients-in-svg
|
|
2782
3183
|
var filterId = createOrUpdateMultiGradient(document, object, $def, $el, parsedColor);
|
|
2783
|
-
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', "url(#"
|
|
3184
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', "url(#".concat(filterId, ")"));
|
|
2784
3185
|
$el === null || $el === void 0 ? void 0 : $el.setAttribute('fill', 'black');
|
|
2785
3186
|
return filterId;
|
|
2786
3187
|
}
|
|
2787
3188
|
}
|
|
2788
3189
|
return '';
|
|
2789
3190
|
}
|
|
2790
|
-
function generateCacheKey(src
|
|
2791
|
-
|
|
2792
|
-
options = {};
|
|
2793
|
-
}
|
|
3191
|
+
function generateCacheKey(src) {
|
|
3192
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2794
3193
|
var cacheKey = '';
|
|
2795
3194
|
if (src instanceof gLite.CSSGradientValue) {
|
|
2796
3195
|
var type = src.type,
|
|
2797
3196
|
value = src.value;
|
|
2798
3197
|
if (type === gLite.GradientType.LinearGradient || type === gLite.GradientType.RadialGradient) {
|
|
2799
3198
|
// @ts-ignore
|
|
2800
|
-
var _value$options =
|
|
3199
|
+
var _value$options = _objectSpread2(_objectSpread2({}, value), options),
|
|
2801
3200
|
_type = _value$options.type,
|
|
2802
3201
|
width = _value$options.width,
|
|
2803
3202
|
height = _value$options.height,
|
|
@@ -2806,25 +3205,25 @@
|
|
|
2806
3205
|
cx = _value$options.cx,
|
|
2807
3206
|
cy = _value$options.cy,
|
|
2808
3207
|
size = _value$options.size;
|
|
2809
|
-
cacheKey = "gradient-"
|
|
3208
|
+
cacheKey = "gradient-".concat(_type, "-").concat((angle === null || angle === void 0 ? void 0 : angle.toString()) || 0, "-").concat((cx === null || cx === void 0 ? void 0 : cx.toString()) || 0, "-").concat((cy === null || cy === void 0 ? void 0 : cy.toString()) || 0, "-").concat((size === null || size === void 0 ? void 0 : size.toString()) || 0, "-").concat(width, "-").concat(height, "-").concat(steps.map(function (_ref) {
|
|
2810
3209
|
var offset = _ref.offset,
|
|
2811
3210
|
color = _ref.color;
|
|
2812
|
-
return ""
|
|
2813
|
-
}).join('-');
|
|
3211
|
+
return "".concat(offset).concat(color);
|
|
3212
|
+
}).join('-'));
|
|
2814
3213
|
}
|
|
2815
3214
|
} else if (gLite.isPattern(src)) {
|
|
2816
3215
|
if (isString(src.image)) {
|
|
2817
|
-
cacheKey = "pattern-"
|
|
3216
|
+
cacheKey = "pattern-".concat(src.image, "-").concat(src.repetition);
|
|
2818
3217
|
} else if (src.image instanceof gLite.Rect) {
|
|
2819
3218
|
// use rect's entity as key
|
|
2820
|
-
cacheKey = "pattern-rect-"
|
|
3219
|
+
cacheKey = "pattern-rect-".concat(src.image.entity);
|
|
2821
3220
|
} else {
|
|
2822
|
-
cacheKey = "pattern-"
|
|
3221
|
+
cacheKey = "pattern-".concat(counter);
|
|
2823
3222
|
}
|
|
2824
3223
|
}
|
|
2825
3224
|
if (cacheKey) {
|
|
2826
3225
|
if (!cacheKey2IDMap[cacheKey]) {
|
|
2827
|
-
cacheKey2IDMap[cacheKey] = PATTERN_PREFIX +
|
|
3226
|
+
cacheKey2IDMap[cacheKey] = PATTERN_PREFIX + "".concat(counter++);
|
|
2828
3227
|
}
|
|
2829
3228
|
}
|
|
2830
3229
|
return cacheKey2IDMap[cacheKey];
|
|
@@ -2836,55 +3235,56 @@
|
|
|
2836
3235
|
var t = parsed.t,
|
|
2837
3236
|
d = parsed.d;
|
|
2838
3237
|
if (t === 'translate') {
|
|
2839
|
-
return "translate("
|
|
3238
|
+
return "translate(".concat(d[0].value, " ").concat(d[1].value, ")");
|
|
2840
3239
|
} else if (t === 'translatex') {
|
|
2841
|
-
return "translate("
|
|
3240
|
+
return "translate(".concat(d[0].value, " 0)");
|
|
2842
3241
|
} else if (t === 'translatey') {
|
|
2843
|
-
return "translate(0 "
|
|
3242
|
+
return "translate(0 ".concat(d[0].value, ")");
|
|
2844
3243
|
} else if (t === 'rotate') {
|
|
2845
|
-
return "rotate("
|
|
3244
|
+
return "rotate(".concat(d[0].value, ")");
|
|
2846
3245
|
} else if (t === 'scale') {
|
|
2847
3246
|
// scale(1) scale(1, 1)
|
|
2848
3247
|
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
2849
3248
|
return s.value;
|
|
2850
3249
|
})) || [1, 1];
|
|
2851
|
-
return "scale("
|
|
3250
|
+
return "scale(".concat(newScale[0], ", ").concat(newScale[1], ")");
|
|
2852
3251
|
} else if (t === 'scalex') {
|
|
2853
3252
|
var _newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
2854
3253
|
return s.value;
|
|
2855
3254
|
})) || [1];
|
|
2856
|
-
return "scale("
|
|
3255
|
+
return "scale(".concat(_newScale[0], ", 1)");
|
|
2857
3256
|
} else if (t === 'scaley') {
|
|
2858
3257
|
var _newScale2 = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
2859
3258
|
return s.value;
|
|
2860
3259
|
})) || [1];
|
|
2861
|
-
return "scale(1, "
|
|
3260
|
+
return "scale(1, ".concat(_newScale2[0], ")");
|
|
2862
3261
|
} else if (t === 'skew') {
|
|
2863
3262
|
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
2864
3263
|
return s.value;
|
|
2865
3264
|
})) || [0, 0];
|
|
2866
|
-
return "skewX("
|
|
3265
|
+
return "skewX(".concat(newSkew[0], ") skewY(").concat(newSkew[1], ")");
|
|
2867
3266
|
} else if (t === 'skewx') {
|
|
2868
3267
|
var _newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
2869
3268
|
return s.value;
|
|
2870
3269
|
})) || [0];
|
|
2871
|
-
return "skewX("
|
|
3270
|
+
return "skewX(".concat(_newSkew[0], ")");
|
|
2872
3271
|
} else if (t === 'skewy') {
|
|
2873
3272
|
var _newSkew2 = (d === null || d === void 0 ? void 0 : d.map(function (s) {
|
|
2874
3273
|
return s.value;
|
|
2875
3274
|
})) || [0];
|
|
2876
|
-
return "skewY("
|
|
3275
|
+
return "skewY(".concat(_newSkew2[0], ")");
|
|
2877
3276
|
} else if (t === 'matrix') {
|
|
2878
3277
|
var _d$map = d.map(function (s) {
|
|
2879
3278
|
return s.value;
|
|
2880
3279
|
}),
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
3280
|
+
_d$map2 = _slicedToArray(_d$map, 6),
|
|
3281
|
+
a = _d$map2[0],
|
|
3282
|
+
b = _d$map2[1],
|
|
3283
|
+
c = _d$map2[2],
|
|
3284
|
+
dd = _d$map2[3],
|
|
3285
|
+
tx = _d$map2[4],
|
|
3286
|
+
ty = _d$map2[5];
|
|
3287
|
+
return "matrix(".concat(a, " ").concat(b, " ").concat(c, " ").concat(dd, " ").concat(tx, " ").concat(ty, ")");
|
|
2888
3288
|
}
|
|
2889
3289
|
}).join(' ');
|
|
2890
3290
|
}
|
|
@@ -2915,13 +3315,13 @@
|
|
|
2915
3315
|
patternWidth = halfExtents[0] * 2;
|
|
2916
3316
|
patternHeight = halfExtents[1] * 2;
|
|
2917
3317
|
}
|
|
2918
|
-
$pattern.setAttribute('width', ""
|
|
2919
|
-
$pattern.setAttribute('height', ""
|
|
3318
|
+
$pattern.setAttribute('width', "".concat(patternWidth));
|
|
3319
|
+
$pattern.setAttribute('height', "".concat(patternHeight));
|
|
2920
3320
|
return $pattern;
|
|
2921
3321
|
}
|
|
2922
3322
|
function createOrUpdatePattern(document, $def, object, pattern, createImage, plugin) {
|
|
2923
3323
|
var patternId = generateCacheKey(pattern);
|
|
2924
|
-
var $existed = $def.querySelector("#"
|
|
3324
|
+
var $existed = $def.querySelector("#".concat(patternId));
|
|
2925
3325
|
if (!$existed) {
|
|
2926
3326
|
var image = pattern.image;
|
|
2927
3327
|
var imageURL = '';
|
|
@@ -2958,8 +3358,8 @@
|
|
|
2958
3358
|
$pattern.appendChild($image);
|
|
2959
3359
|
$image.setAttribute('x', '0');
|
|
2960
3360
|
$image.setAttribute('y', '0');
|
|
2961
|
-
$image.setAttribute('width', ""
|
|
2962
|
-
$image.setAttribute('height', ""
|
|
3361
|
+
$image.setAttribute('width', "".concat(img.width));
|
|
3362
|
+
$image.setAttribute('height', "".concat(img.height));
|
|
2963
3363
|
};
|
|
2964
3364
|
if (img.complete) {
|
|
2965
3365
|
onload();
|
|
@@ -3000,7 +3400,7 @@
|
|
|
3000
3400
|
width: width,
|
|
3001
3401
|
height: height
|
|
3002
3402
|
});
|
|
3003
|
-
var $existed = $def.querySelector("#"
|
|
3403
|
+
var $existed = $def.querySelector("#".concat(gradientId));
|
|
3004
3404
|
if (!$existed) {
|
|
3005
3405
|
// <linearGradient> <radialGradient>
|
|
3006
3406
|
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/linearGradient
|
|
@@ -3018,7 +3418,7 @@
|
|
|
3018
3418
|
var offset = _ref2.offset,
|
|
3019
3419
|
color = _ref2.color;
|
|
3020
3420
|
// TODO: support absolute unit like `px`
|
|
3021
|
-
innerHTML += "<stop offset=\""
|
|
3421
|
+
innerHTML += "<stop offset=\"".concat(offset.value / 100, "\" stop-color=\"").concat(color, "\"></stop>");
|
|
3022
3422
|
});
|
|
3023
3423
|
$existed.innerHTML = innerHTML;
|
|
3024
3424
|
$existed.id = gradientId;
|
|
@@ -3031,10 +3431,10 @@
|
|
|
3031
3431
|
y1 = _computeLinearGradien.y1,
|
|
3032
3432
|
x2 = _computeLinearGradien.x2,
|
|
3033
3433
|
y2 = _computeLinearGradien.y2;
|
|
3034
|
-
$existed.setAttribute('x1', ""
|
|
3035
|
-
$existed.setAttribute('y1', ""
|
|
3036
|
-
$existed.setAttribute('x2', ""
|
|
3037
|
-
$existed.setAttribute('y2', ""
|
|
3434
|
+
$existed.setAttribute('x1', "".concat(x1));
|
|
3435
|
+
$existed.setAttribute('y1', "".concat(y1));
|
|
3436
|
+
$existed.setAttribute('x2', "".concat(x2));
|
|
3437
|
+
$existed.setAttribute('y2', "".concat(y2));
|
|
3038
3438
|
// $existed.setAttribute('gradientTransform', `rotate(${angle})`);
|
|
3039
3439
|
} else {
|
|
3040
3440
|
var _parsedColor$value = parsedColor.value,
|
|
@@ -3045,15 +3445,15 @@
|
|
|
3045
3445
|
x = _computeRadialGradien.x,
|
|
3046
3446
|
y = _computeRadialGradien.y,
|
|
3047
3447
|
r = _computeRadialGradien.r;
|
|
3048
|
-
$existed.setAttribute('cx', ""
|
|
3049
|
-
$existed.setAttribute('cy', ""
|
|
3050
|
-
$existed.setAttribute('r', ""
|
|
3448
|
+
$existed.setAttribute('cx', "".concat(x));
|
|
3449
|
+
$existed.setAttribute('cy', "".concat(y));
|
|
3450
|
+
$existed.setAttribute('r', "".concat(r));
|
|
3051
3451
|
}
|
|
3052
3452
|
return gradientId;
|
|
3053
3453
|
}
|
|
3054
3454
|
function createOrUpdateMultiGradient(document, object, $def, $el, gradients) {
|
|
3055
3455
|
var filterId = FILTER_PREFIX + object.entity + '-gradient';
|
|
3056
|
-
var $existed = $def.querySelector("#"
|
|
3456
|
+
var $existed = $def.querySelector("#".concat(filterId));
|
|
3057
3457
|
if (!$existed) {
|
|
3058
3458
|
$existed = createSVGElement('filter', document);
|
|
3059
3459
|
$existed.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
@@ -3083,25 +3483,25 @@
|
|
|
3083
3483
|
$rect.setAttribute('y', '0');
|
|
3084
3484
|
$rect.setAttribute('width', '100%');
|
|
3085
3485
|
$rect.setAttribute('height', '100%');
|
|
3086
|
-
$rect.setAttribute('fill', "url(#"
|
|
3486
|
+
$rect.setAttribute('fill', "url(#".concat(gradientId, ")"));
|
|
3087
3487
|
$rect.id = rectId;
|
|
3088
3488
|
$def.appendChild($rect);
|
|
3089
3489
|
var $feImage = createSVGElement('feImage', document);
|
|
3090
|
-
$feImage.setAttribute('href', "#"
|
|
3091
|
-
$feImage.setAttribute('result', filterId
|
|
3490
|
+
$feImage.setAttribute('href', "#".concat(rectId));
|
|
3491
|
+
$feImage.setAttribute('result', "".concat(filterId, "-").concat(i));
|
|
3092
3492
|
$existed.appendChild($feImage);
|
|
3093
3493
|
if (i > 0) {
|
|
3094
3494
|
var $feBlend = createSVGElement('feBlend', document);
|
|
3095
|
-
$feBlend.setAttribute('in', i === 1 ? filterId
|
|
3096
|
-
$feBlend.setAttribute('in2', filterId
|
|
3097
|
-
$feBlend.setAttribute('result', filterId
|
|
3495
|
+
$feBlend.setAttribute('in', i === 1 ? "".concat(filterId, "-").concat(i - 1) : "".concat(filterId, "-blended-").concat(blended - 1));
|
|
3496
|
+
$feBlend.setAttribute('in2', "".concat(filterId, "-").concat(i));
|
|
3497
|
+
$feBlend.setAttribute('result', "".concat(filterId, "-blended-").concat(blended++));
|
|
3098
3498
|
// @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/blend-mode
|
|
3099
3499
|
$feBlend.setAttribute('mode', 'multiply');
|
|
3100
3500
|
$existed.appendChild($feBlend);
|
|
3101
3501
|
}
|
|
3102
3502
|
});
|
|
3103
3503
|
var $feComposite = createSVGElement('feComposite', document);
|
|
3104
|
-
$feComposite.setAttribute('in', filterId
|
|
3504
|
+
$feComposite.setAttribute('in', "".concat(filterId, "-blended-").concat(blended));
|
|
3105
3505
|
$feComposite.setAttribute('in2', 'SourceGraphic');
|
|
3106
3506
|
$feComposite.setAttribute('operator', 'in');
|
|
3107
3507
|
$existed.appendChild($feComposite);
|
|
@@ -3121,7 +3521,7 @@
|
|
|
3121
3521
|
shadowOffsetY = _object$parsedStyle.shadowOffsetY;
|
|
3122
3522
|
var hasShadow = !isNil(shadowColor) && shadowBlur > 0;
|
|
3123
3523
|
var shadowId = FILTER_DROPSHADOW_PREFIX + object.entity;
|
|
3124
|
-
var $existedFilter = $def.querySelector("#"
|
|
3524
|
+
var $existedFilter = $def.querySelector("#".concat(shadowId));
|
|
3125
3525
|
if ($existedFilter) {
|
|
3126
3526
|
var existedShadowType = $existedFilter.getAttribute('data-type');
|
|
3127
3527
|
if (existedShadowType !== shadowType || !hasShadow) {
|
|
@@ -3135,7 +3535,7 @@
|
|
|
3135
3535
|
if (hasShadow) {
|
|
3136
3536
|
// use filter <feDropShadow>
|
|
3137
3537
|
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow
|
|
3138
|
-
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', "url(#"
|
|
3538
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', "url(#".concat(shadowId, ")"));
|
|
3139
3539
|
} else {
|
|
3140
3540
|
$el === null || $el === void 0 ? void 0 : $el.removeAttribute('filter');
|
|
3141
3541
|
return;
|
|
@@ -3145,9 +3545,9 @@
|
|
|
3145
3545
|
$existedFilter.setAttribute('data-type', shadowType);
|
|
3146
3546
|
if (shadowType === 'outer') {
|
|
3147
3547
|
var $feDropShadow = createSVGElement('feDropShadow', document);
|
|
3148
|
-
$feDropShadow.setAttribute('dx', ""
|
|
3149
|
-
$feDropShadow.setAttribute('dy', ""
|
|
3150
|
-
$feDropShadow.setAttribute('stdDeviation', ""
|
|
3548
|
+
$feDropShadow.setAttribute('dx', "".concat((shadowOffsetX || 0) / 2));
|
|
3549
|
+
$feDropShadow.setAttribute('dy', "".concat((shadowOffsetY || 0) / 2));
|
|
3550
|
+
$feDropShadow.setAttribute('stdDeviation', "".concat((shadowBlur || 0) / 4));
|
|
3151
3551
|
$feDropShadow.setAttribute('flood-color', shadowColor.toString());
|
|
3152
3552
|
$existedFilter.appendChild($feDropShadow);
|
|
3153
3553
|
} else if (shadowType === 'inner') {
|
|
@@ -3159,11 +3559,11 @@
|
|
|
3159
3559
|
$feComponentTransfer.appendChild($feFuncA);
|
|
3160
3560
|
$existedFilter.appendChild($feComponentTransfer);
|
|
3161
3561
|
var $feGaussianBlur = createSVGElement('feGaussianBlur', document);
|
|
3162
|
-
$feGaussianBlur.setAttribute('stdDeviation', ""
|
|
3562
|
+
$feGaussianBlur.setAttribute('stdDeviation', "".concat((shadowBlur || 0) / 4));
|
|
3163
3563
|
$existedFilter.appendChild($feGaussianBlur);
|
|
3164
3564
|
var $feOffset = createSVGElement('feOffset', document);
|
|
3165
|
-
$feOffset.setAttribute('dx', ""
|
|
3166
|
-
$feOffset.setAttribute('dy', ""
|
|
3565
|
+
$feOffset.setAttribute('dx', "".concat((shadowOffsetX || 0) / 2));
|
|
3566
|
+
$feOffset.setAttribute('dy', "".concat((shadowOffsetY || 0) / 2));
|
|
3167
3567
|
$feOffset.setAttribute('result', 'offsetblur');
|
|
3168
3568
|
$existedFilter.appendChild($feOffset);
|
|
3169
3569
|
var $feFlood = createSVGElement('feFlood', document);
|
|
@@ -3202,11 +3602,11 @@
|
|
|
3202
3602
|
// half the blur radius
|
|
3203
3603
|
// @see https://drafts.csswg.org/css-backgrounds/#shadow-blur
|
|
3204
3604
|
// @see https://css-tricks.com/breaking-css-box-shadow-vs-drop-shadow/
|
|
3205
|
-
_$feGaussianBlur.setAttribute('stdDeviation', ""
|
|
3605
|
+
_$feGaussianBlur.setAttribute('stdDeviation', "".concat((shadowBlur || 0) / 4));
|
|
3206
3606
|
} else if (name === 'shadowOffsetX') {
|
|
3207
|
-
_$feOffset.setAttribute('dx', ""
|
|
3607
|
+
_$feOffset.setAttribute('dx', "".concat((shadowOffsetX || 0) / 2));
|
|
3208
3608
|
} else if (name === 'shadowOffsetY') {
|
|
3209
|
-
_$feOffset.setAttribute('dy', ""
|
|
3609
|
+
_$feOffset.setAttribute('dy', "".concat((shadowOffsetY || 0) / 2));
|
|
3210
3610
|
}
|
|
3211
3611
|
} else if (shadowType === 'outer') {
|
|
3212
3612
|
var _$feDropShadow = $existedFilter.children[0];
|
|
@@ -3216,17 +3616,18 @@
|
|
|
3216
3616
|
// half the blur radius
|
|
3217
3617
|
// @see https://drafts.csswg.org/css-backgrounds/#shadow-blur
|
|
3218
3618
|
// @see https://css-tricks.com/breaking-css-box-shadow-vs-drop-shadow/
|
|
3219
|
-
_$feDropShadow.setAttribute('stdDeviation', ""
|
|
3619
|
+
_$feDropShadow.setAttribute('stdDeviation', "".concat((shadowBlur || 0) / 4));
|
|
3220
3620
|
} else if (name === 'shadowOffsetX') {
|
|
3221
|
-
_$feDropShadow.setAttribute('dx', ""
|
|
3621
|
+
_$feDropShadow.setAttribute('dx', "".concat((shadowOffsetX || 0) / 2));
|
|
3222
3622
|
} else if (name === 'shadowOffsetY') {
|
|
3223
|
-
_$feDropShadow.setAttribute('dy', ""
|
|
3623
|
+
_$feDropShadow.setAttribute('dy', "".concat((shadowOffsetY || 0) / 2));
|
|
3224
3624
|
}
|
|
3225
3625
|
}
|
|
3226
3626
|
}
|
|
3227
3627
|
var urlRegexp = /url\("?#(.*)\)/;
|
|
3228
3628
|
var DefElementManager = /*#__PURE__*/function () {
|
|
3229
3629
|
function DefElementManager(context) {
|
|
3630
|
+
_classCallCheck$2(this, DefElementManager);
|
|
3230
3631
|
this.context = void 0;
|
|
3231
3632
|
this.$def = void 0;
|
|
3232
3633
|
this.gradientCache = {};
|
|
@@ -3235,106 +3636,124 @@
|
|
|
3235
3636
|
/**
|
|
3236
3637
|
* container for <gradient> <clipPath>...
|
|
3237
3638
|
*/
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
_proto.init = function init() {
|
|
3243
|
-
var document = this.context.config.document;
|
|
3244
|
-
var $svg = this.context.contextService.getContext();
|
|
3245
|
-
this.$def = createSVGElement('defs', document);
|
|
3246
|
-
$svg.appendChild(this.$def);
|
|
3247
|
-
};
|
|
3248
|
-
_proto.clear = function clear(entity) {
|
|
3249
|
-
var _this = this;
|
|
3250
|
-
Object.keys(this.gradientCache).forEach(function (id) {
|
|
3251
|
-
_this.clearUnusedDefElement(_this.gradientCache, id, entity);
|
|
3252
|
-
});
|
|
3253
|
-
};
|
|
3254
|
-
_proto.clearUnusedDefElement = function clearUnusedDefElement(cache, id, entity) {
|
|
3255
|
-
if (cache[id] && cache[id].size === 1 && cache[id].has(entity)) {
|
|
3256
|
-
var targetElement = this.$def.querySelector("#" + id);
|
|
3257
|
-
if (targetElement) {
|
|
3258
|
-
this.$def.removeChild(targetElement);
|
|
3259
|
-
}
|
|
3639
|
+
_createClass$2(DefElementManager, [{
|
|
3640
|
+
key: "getDefElement",
|
|
3641
|
+
value: function getDefElement() {
|
|
3642
|
+
return this.$def;
|
|
3260
3643
|
}
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3644
|
+
}, {
|
|
3645
|
+
key: "init",
|
|
3646
|
+
value: function init() {
|
|
3647
|
+
var document = this.context.config.document;
|
|
3648
|
+
var $svg = this.context.contextService.getContext();
|
|
3649
|
+
this.$def = createSVGElement('defs', document);
|
|
3650
|
+
$svg.appendChild(this.$def);
|
|
3651
|
+
}
|
|
3652
|
+
}, {
|
|
3653
|
+
key: "clear",
|
|
3654
|
+
value: function clear(entity) {
|
|
3655
|
+
var _this = this;
|
|
3656
|
+
Object.keys(this.gradientCache).forEach(function (id) {
|
|
3657
|
+
_this.clearUnusedDefElement(_this.gradientCache, id, entity);
|
|
3658
|
+
});
|
|
3659
|
+
}
|
|
3660
|
+
}, {
|
|
3661
|
+
key: "clearUnusedDefElement",
|
|
3662
|
+
value: function clearUnusedDefElement(cache, id, entity) {
|
|
3663
|
+
if (cache[id] && cache[id].size === 1 && cache[id].has(entity)) {
|
|
3664
|
+
var targetElement = this.$def.querySelector("#".concat(id));
|
|
3665
|
+
if (targetElement) {
|
|
3666
|
+
this.$def.removeChild(targetElement);
|
|
3667
|
+
}
|
|
3278
3668
|
}
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3669
|
+
}
|
|
3670
|
+
}, {
|
|
3671
|
+
key: "createOrUpdateGradientAndPattern",
|
|
3672
|
+
value: function createOrUpdateGradientAndPattern$1(object, $el, parsedColor, name, plugin) {
|
|
3673
|
+
var _this$context$config = this.context.config,
|
|
3674
|
+
doc = _this$context$config.document,
|
|
3675
|
+
createImage = _this$context$config.createImage;
|
|
3676
|
+
if ($el) {
|
|
3677
|
+
var attributeValue = '';
|
|
3678
|
+
if (gLite.isPattern(parsedColor)) {
|
|
3679
|
+
// `fill: url(#${patternId})`
|
|
3680
|
+
attributeValue = $el.style[name];
|
|
3681
|
+
} else {
|
|
3682
|
+
// `url(#${gradientId})`
|
|
3683
|
+
attributeValue = $el.getAttribute(name) || '';
|
|
3684
|
+
}
|
|
3685
|
+
var matches = attributeValue.match(urlRegexp);
|
|
3686
|
+
if (matches && matches.length > 1) {
|
|
3687
|
+
this.clearUnusedDefElement(this.gradientCache, matches[1].replace('"', ''), object.entity);
|
|
3688
|
+
}
|
|
3689
|
+
var newDefElementId = createOrUpdateGradientAndPattern(doc || document, this.$def, object, $el, parsedColor, name, createImage, plugin);
|
|
3690
|
+
if (newDefElementId) {
|
|
3691
|
+
if (!this.gradientCache[newDefElementId]) {
|
|
3692
|
+
this.gradientCache[newDefElementId] = new Set();
|
|
3693
|
+
}
|
|
3694
|
+
this.gradientCache[newDefElementId].add(object.entity);
|
|
3283
3695
|
}
|
|
3284
|
-
this.gradientCache[newDefElementId].add(object.entity);
|
|
3285
3696
|
}
|
|
3286
3697
|
}
|
|
3287
|
-
}
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
createOrUpdateFilter
|
|
3295
|
-
|
|
3698
|
+
}, {
|
|
3699
|
+
key: "createOrUpdateShadow",
|
|
3700
|
+
value: function createOrUpdateShadow$1(object, $el, name) {
|
|
3701
|
+
var doc = this.context.config.document;
|
|
3702
|
+
createOrUpdateShadow(doc || document, this.$def, object, $el, name);
|
|
3703
|
+
}
|
|
3704
|
+
}, {
|
|
3705
|
+
key: "createOrUpdateFilter",
|
|
3706
|
+
value: function createOrUpdateFilter$1(object, $el, filters) {
|
|
3707
|
+
var doc = this.context.config.document;
|
|
3708
|
+
createOrUpdateFilter(doc || document, this.$def, object, $el, filters);
|
|
3709
|
+
}
|
|
3710
|
+
}]);
|
|
3296
3711
|
return DefElementManager;
|
|
3297
3712
|
}();
|
|
3298
3713
|
var Plugin$1 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
3299
|
-
|
|
3300
|
-
|
|
3714
|
+
_inherits$2(Plugin, _AbstractRendererPlug);
|
|
3715
|
+
var _super = _createSuper$2(Plugin);
|
|
3716
|
+
function Plugin() {
|
|
3301
3717
|
var _this;
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
_this = _AbstractRendererPlug.call(this) || this;
|
|
3718
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3719
|
+
_classCallCheck$2(this, Plugin);
|
|
3720
|
+
_this = _super.call(this);
|
|
3306
3721
|
_this.options = void 0;
|
|
3307
3722
|
_this.name = 'svg-renderer';
|
|
3308
3723
|
_this.options = options;
|
|
3309
3724
|
return _this;
|
|
3310
3725
|
}
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3726
|
+
_createClass$2(Plugin, [{
|
|
3727
|
+
key: "init",
|
|
3728
|
+
value: function init() {
|
|
3729
|
+
var _this$options = this.options,
|
|
3730
|
+
outputSVGElementId = _this$options.outputSVGElementId,
|
|
3731
|
+
outputSVGElementName = _this$options.outputSVGElementName;
|
|
3732
|
+
var defElementManager = new DefElementManager(this.context);
|
|
3733
|
+
// default implementation
|
|
3734
|
+
var defaultElementLifeCycleContribution = new DefaultElementLifeCycleContribution(this.context);
|
|
3735
|
+
// @ts-ignore
|
|
3736
|
+
this.context.defaultElementLifeCycleContribution = defaultElementLifeCycleContribution;
|
|
3737
|
+
// @ts-ignore
|
|
3738
|
+
this.context.SVGElementLifeCycleContribution = defaultElementLifeCycleContribution;
|
|
3739
|
+
var SVGRendererPluginOptions = {
|
|
3740
|
+
outputSVGElementId: !isNil(outputSVGElementId) ? !!outputSVGElementId : true,
|
|
3741
|
+
outputSVGElementName: !isNil(outputSVGElementName) ? !!outputSVGElementName : true
|
|
3742
|
+
};
|
|
3743
|
+
this.addRenderingPlugin(
|
|
3744
|
+
// @ts-ignore
|
|
3745
|
+
new SVGRendererPlugin(SVGRendererPluginOptions, defElementManager, this.context));
|
|
3746
|
+
}
|
|
3747
|
+
}, {
|
|
3748
|
+
key: "destroy",
|
|
3749
|
+
value: function destroy() {
|
|
3750
|
+
this.removeAllRenderingPlugins();
|
|
3751
|
+
// @ts-ignore
|
|
3752
|
+
delete this.context.defaultElementLifeCycleContribution;
|
|
3753
|
+
// @ts-ignore
|
|
3754
|
+
delete this.context.SVGElementLifeCycleContribution;
|
|
3755
|
+
}
|
|
3756
|
+
}]);
|
|
3338
3757
|
return Plugin;
|
|
3339
3758
|
}(gLite.AbstractRendererPlugin);
|
|
3340
3759
|
|
|
@@ -3436,7 +3855,7 @@
|
|
|
3436
3855
|
if ("throw" !== record.type) {
|
|
3437
3856
|
var result = record.arg,
|
|
3438
3857
|
value = result.value;
|
|
3439
|
-
return value && "object" ==
|
|
3858
|
+
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
3440
3859
|
invoke("next", value, resolve, reject);
|
|
3441
3860
|
}, function (err) {
|
|
3442
3861
|
invoke("throw", err, resolve, reject);
|
|
@@ -3697,10 +4116,49 @@
|
|
|
3697
4116
|
});
|
|
3698
4117
|
};
|
|
3699
4118
|
}
|
|
3700
|
-
function
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
4119
|
+
function _classCallCheck$3(instance, Constructor) {
|
|
4120
|
+
if (!(instance instanceof Constructor)) {
|
|
4121
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4124
|
+
function _defineProperties$3(target, props) {
|
|
4125
|
+
for (var i = 0; i < props.length; i++) {
|
|
4126
|
+
var descriptor = props[i];
|
|
4127
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
4128
|
+
descriptor.configurable = true;
|
|
4129
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
4130
|
+
Object.defineProperty(target, _toPropertyKey$3(descriptor.key), descriptor);
|
|
4131
|
+
}
|
|
4132
|
+
}
|
|
4133
|
+
function _createClass$3(Constructor, protoProps, staticProps) {
|
|
4134
|
+
if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
|
|
4135
|
+
if (staticProps) _defineProperties$3(Constructor, staticProps);
|
|
4136
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
4137
|
+
writable: false
|
|
4138
|
+
});
|
|
4139
|
+
return Constructor;
|
|
4140
|
+
}
|
|
4141
|
+
function _inherits$3(subClass, superClass) {
|
|
4142
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
4143
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
4144
|
+
}
|
|
4145
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
4146
|
+
constructor: {
|
|
4147
|
+
value: subClass,
|
|
4148
|
+
writable: true,
|
|
4149
|
+
configurable: true
|
|
4150
|
+
}
|
|
4151
|
+
});
|
|
4152
|
+
Object.defineProperty(subClass, "prototype", {
|
|
4153
|
+
writable: false
|
|
4154
|
+
});
|
|
4155
|
+
if (superClass) _setPrototypeOf$3(subClass, superClass);
|
|
4156
|
+
}
|
|
4157
|
+
function _getPrototypeOf$3(o) {
|
|
4158
|
+
_getPrototypeOf$3 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
4159
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
4160
|
+
};
|
|
4161
|
+
return _getPrototypeOf$3(o);
|
|
3704
4162
|
}
|
|
3705
4163
|
function _setPrototypeOf$3(o, p) {
|
|
3706
4164
|
_setPrototypeOf$3 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
@@ -3709,38 +4167,124 @@
|
|
|
3709
4167
|
};
|
|
3710
4168
|
return _setPrototypeOf$3(o, p);
|
|
3711
4169
|
}
|
|
3712
|
-
function
|
|
4170
|
+
function _isNativeReflectConstruct$3() {
|
|
4171
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
4172
|
+
if (Reflect.construct.sham) return false;
|
|
4173
|
+
if (typeof Proxy === "function") return true;
|
|
4174
|
+
try {
|
|
4175
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
4176
|
+
return true;
|
|
4177
|
+
} catch (e) {
|
|
4178
|
+
return false;
|
|
4179
|
+
}
|
|
4180
|
+
}
|
|
4181
|
+
function _assertThisInitialized$3(self) {
|
|
4182
|
+
if (self === void 0) {
|
|
4183
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4184
|
+
}
|
|
4185
|
+
return self;
|
|
4186
|
+
}
|
|
4187
|
+
function _possibleConstructorReturn$3(self, call) {
|
|
4188
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
4189
|
+
return call;
|
|
4190
|
+
} else if (call !== void 0) {
|
|
4191
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
4192
|
+
}
|
|
4193
|
+
return _assertThisInitialized$3(self);
|
|
4194
|
+
}
|
|
4195
|
+
function _createSuper$3(Derived) {
|
|
4196
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
|
|
4197
|
+
return function _createSuperInternal() {
|
|
4198
|
+
var Super = _getPrototypeOf$3(Derived),
|
|
4199
|
+
result;
|
|
4200
|
+
if (hasNativeReflectConstruct) {
|
|
4201
|
+
var NewTarget = _getPrototypeOf$3(this).constructor;
|
|
4202
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
4203
|
+
} else {
|
|
4204
|
+
result = Super.apply(this, arguments);
|
|
4205
|
+
}
|
|
4206
|
+
return _possibleConstructorReturn$3(this, result);
|
|
4207
|
+
};
|
|
4208
|
+
}
|
|
4209
|
+
function _unsupportedIterableToArray$1(o, minLen) {
|
|
3713
4210
|
if (!o) return;
|
|
3714
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
4211
|
+
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
|
3715
4212
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3716
4213
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3717
4214
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3718
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
4215
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
|
3719
4216
|
}
|
|
3720
|
-
function _arrayLikeToArray(arr, len) {
|
|
4217
|
+
function _arrayLikeToArray$1(arr, len) {
|
|
3721
4218
|
if (len == null || len > arr.length) len = arr.length;
|
|
3722
4219
|
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
3723
4220
|
arr2[i] = arr[i];
|
|
3724
4221
|
}
|
|
3725
4222
|
return arr2;
|
|
3726
4223
|
}
|
|
3727
|
-
function
|
|
4224
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
3728
4225
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
3729
|
-
if (it)
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
if (i >= o.length) return {
|
|
3735
|
-
done: true
|
|
3736
|
-
};
|
|
4226
|
+
if (!it) {
|
|
4227
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
4228
|
+
if (it) o = it;
|
|
4229
|
+
var i = 0;
|
|
4230
|
+
var F = function F() {};
|
|
3737
4231
|
return {
|
|
3738
|
-
|
|
3739
|
-
|
|
4232
|
+
s: F,
|
|
4233
|
+
n: function n() {
|
|
4234
|
+
if (i >= o.length) return {
|
|
4235
|
+
done: true
|
|
4236
|
+
};
|
|
4237
|
+
return {
|
|
4238
|
+
done: false,
|
|
4239
|
+
value: o[i++]
|
|
4240
|
+
};
|
|
4241
|
+
},
|
|
4242
|
+
e: function e(_e) {
|
|
4243
|
+
throw _e;
|
|
4244
|
+
},
|
|
4245
|
+
f: F
|
|
3740
4246
|
};
|
|
3741
|
-
}
|
|
4247
|
+
}
|
|
4248
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4249
|
+
}
|
|
4250
|
+
var normalCompletion = true,
|
|
4251
|
+
didErr = false,
|
|
4252
|
+
err;
|
|
4253
|
+
return {
|
|
4254
|
+
s: function s() {
|
|
4255
|
+
it = it.call(o);
|
|
4256
|
+
},
|
|
4257
|
+
n: function n() {
|
|
4258
|
+
var step = it.next();
|
|
4259
|
+
normalCompletion = step.done;
|
|
4260
|
+
return step;
|
|
4261
|
+
},
|
|
4262
|
+
e: function e(_e2) {
|
|
4263
|
+
didErr = true;
|
|
4264
|
+
err = _e2;
|
|
4265
|
+
},
|
|
4266
|
+
f: function f() {
|
|
4267
|
+
try {
|
|
4268
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
4269
|
+
} finally {
|
|
4270
|
+
if (didErr) throw err;
|
|
4271
|
+
}
|
|
4272
|
+
}
|
|
4273
|
+
};
|
|
4274
|
+
}
|
|
4275
|
+
function _toPrimitive$3(input, hint) {
|
|
4276
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
4277
|
+
var prim = input[Symbol.toPrimitive];
|
|
4278
|
+
if (prim !== undefined) {
|
|
4279
|
+
var res = prim.call(input, hint || "default");
|
|
4280
|
+
if (_typeof(res) !== "object") return res;
|
|
4281
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3742
4282
|
}
|
|
3743
|
-
|
|
4283
|
+
return (hint === "string" ? String : Number)(input);
|
|
4284
|
+
}
|
|
4285
|
+
function _toPropertyKey$3(arg) {
|
|
4286
|
+
var key = _toPrimitive$3(arg, "string");
|
|
4287
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
3744
4288
|
}
|
|
3745
4289
|
|
|
3746
4290
|
/**
|
|
@@ -3750,86 +4294,106 @@
|
|
|
3750
4294
|
* 2. use elementFromPoint
|
|
3751
4295
|
*/
|
|
3752
4296
|
var SVGPickerPlugin = /*#__PURE__*/function () {
|
|
3753
|
-
function SVGPickerPlugin() {
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
var
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
4297
|
+
function SVGPickerPlugin() {
|
|
4298
|
+
_classCallCheck$3(this, SVGPickerPlugin);
|
|
4299
|
+
}
|
|
4300
|
+
_createClass$3(SVGPickerPlugin, [{
|
|
4301
|
+
key: "apply",
|
|
4302
|
+
value: function apply(context) {
|
|
4303
|
+
var _this = this;
|
|
4304
|
+
var doc = context.config.document,
|
|
4305
|
+
renderingService = context.renderingService;
|
|
4306
|
+
renderingService.hooks.pick.tapPromise(SVGPickerPlugin.tag, /*#__PURE__*/function () {
|
|
4307
|
+
var _ref = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee(result) {
|
|
4308
|
+
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
4309
|
+
while (1) {
|
|
4310
|
+
switch (_context.prev = _context.next) {
|
|
4311
|
+
case 0:
|
|
4312
|
+
return _context.abrupt("return", _this.pick(doc, result));
|
|
4313
|
+
case 1:
|
|
4314
|
+
case "end":
|
|
4315
|
+
return _context.stop();
|
|
4316
|
+
}
|
|
3769
4317
|
}
|
|
3770
|
-
}
|
|
3771
|
-
}
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
};
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
}
|
|
3780
|
-
}
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
var
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
4318
|
+
}, _callee);
|
|
4319
|
+
}));
|
|
4320
|
+
return function (_x) {
|
|
4321
|
+
return _ref.apply(this, arguments);
|
|
4322
|
+
};
|
|
4323
|
+
}());
|
|
4324
|
+
renderingService.hooks.pickSync.tap(SVGPickerPlugin.tag, function (result) {
|
|
4325
|
+
return _this.pick(doc, result);
|
|
4326
|
+
});
|
|
4327
|
+
}
|
|
4328
|
+
}, {
|
|
4329
|
+
key: "pick",
|
|
4330
|
+
value: function pick(doc, result) {
|
|
4331
|
+
var topmost = result.topmost,
|
|
4332
|
+
_result$position = result.position,
|
|
4333
|
+
clientX = _result$position.clientX,
|
|
4334
|
+
clientY = _result$position.clientY;
|
|
4335
|
+
try {
|
|
4336
|
+
var targets = [];
|
|
4337
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/elementsFromPoint
|
|
4338
|
+
var _iterator = _createForOfIteratorHelper((doc || document).elementsFromPoint(clientX, clientY)),
|
|
4339
|
+
_step;
|
|
4340
|
+
try {
|
|
4341
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4342
|
+
var element = _step.value;
|
|
4343
|
+
// eg. g_svg_circle_345
|
|
4344
|
+
var id = element && element.getAttribute('id');
|
|
4345
|
+
if (id && id.startsWith(G_SVG_PREFIX)) {
|
|
4346
|
+
var index = id.lastIndexOf('-');
|
|
4347
|
+
var target = gLite.runtime.displayObjectPool.getByEntity(id.substring(index + 1));
|
|
4348
|
+
// don't need to account for `visibility` since DOM API already does
|
|
4349
|
+
if (target && target.isInteractive()) {
|
|
4350
|
+
targets.push(target);
|
|
4351
|
+
if (topmost) {
|
|
4352
|
+
result.picked = targets;
|
|
4353
|
+
return result;
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
3802
4356
|
}
|
|
3803
4357
|
}
|
|
4358
|
+
} catch (err) {
|
|
4359
|
+
_iterator.e(err);
|
|
4360
|
+
} finally {
|
|
4361
|
+
_iterator.f();
|
|
3804
4362
|
}
|
|
4363
|
+
result.picked = targets;
|
|
4364
|
+
} catch (e) {
|
|
4365
|
+
result.picked = [];
|
|
3805
4366
|
}
|
|
3806
|
-
result
|
|
3807
|
-
} catch (e) {
|
|
3808
|
-
result.picked = [];
|
|
4367
|
+
return result;
|
|
3809
4368
|
}
|
|
3810
|
-
|
|
3811
|
-
};
|
|
4369
|
+
}]);
|
|
3812
4370
|
return SVGPickerPlugin;
|
|
3813
4371
|
}();
|
|
3814
4372
|
SVGPickerPlugin.tag = 'SVGPicker';
|
|
3815
4373
|
var Plugin$2 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
3816
|
-
|
|
4374
|
+
_inherits$3(Plugin, _AbstractRendererPlug);
|
|
4375
|
+
var _super = _createSuper$3(Plugin);
|
|
3817
4376
|
function Plugin() {
|
|
3818
4377
|
var _this;
|
|
4378
|
+
_classCallCheck$3(this, Plugin);
|
|
3819
4379
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3820
4380
|
args[_key] = arguments[_key];
|
|
3821
4381
|
}
|
|
3822
|
-
_this =
|
|
4382
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
3823
4383
|
_this.name = 'svg-picker';
|
|
3824
4384
|
return _this;
|
|
3825
4385
|
}
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
4386
|
+
_createClass$3(Plugin, [{
|
|
4387
|
+
key: "init",
|
|
4388
|
+
value: function init() {
|
|
4389
|
+
this.addRenderingPlugin(new SVGPickerPlugin());
|
|
4390
|
+
}
|
|
4391
|
+
}, {
|
|
4392
|
+
key: "destroy",
|
|
4393
|
+
value: function destroy() {
|
|
4394
|
+
this.removeAllRenderingPlugins();
|
|
4395
|
+
}
|
|
4396
|
+
}]);
|
|
3833
4397
|
return Plugin;
|
|
3834
4398
|
}(gLite.AbstractRendererPlugin);
|
|
3835
4399
|
|
|
@@ -3840,137 +4404,163 @@
|
|
|
3840
4404
|
|
|
3841
4405
|
var SVGContextService = /*#__PURE__*/function () {
|
|
3842
4406
|
function SVGContextService(context) {
|
|
4407
|
+
_classCallCheck(this, SVGContextService);
|
|
3843
4408
|
this.$container = void 0;
|
|
3844
4409
|
this.$namespace = void 0;
|
|
3845
4410
|
this.dpr = void 0;
|
|
3846
4411
|
this.canvasConfig = void 0;
|
|
3847
4412
|
this.canvasConfig = context.config;
|
|
3848
4413
|
}
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
var
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
if (
|
|
3861
|
-
this.$container.style.position
|
|
4414
|
+
_createClass(SVGContextService, [{
|
|
4415
|
+
key: "init",
|
|
4416
|
+
value: function () {
|
|
4417
|
+
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
4418
|
+
var _this$canvasConfig, container, doc, devicePixelRatio, $namespace, dpr;
|
|
4419
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4420
|
+
while (1) {
|
|
4421
|
+
switch (_context.prev = _context.next) {
|
|
4422
|
+
case 0:
|
|
4423
|
+
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document, devicePixelRatio = _this$canvasConfig.devicePixelRatio; // create container
|
|
4424
|
+
this.$container = isString(container) ? (doc || document).getElementById(container) : container;
|
|
4425
|
+
if (this.$container) {
|
|
4426
|
+
if (!this.$container.style.position) {
|
|
4427
|
+
this.$container.style.position = 'relative';
|
|
4428
|
+
}
|
|
4429
|
+
$namespace = createSVGElement('svg', doc);
|
|
4430
|
+
$namespace.setAttribute('width', "".concat(this.canvasConfig.width));
|
|
4431
|
+
$namespace.setAttribute('height', "".concat(this.canvasConfig.height));
|
|
4432
|
+
this.$container.appendChild($namespace);
|
|
4433
|
+
this.$namespace = $namespace;
|
|
3862
4434
|
}
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
this
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
3872
|
-
this.dpr = dpr;
|
|
3873
|
-
case 6:
|
|
3874
|
-
case "end":
|
|
3875
|
-
return _context.stop();
|
|
4435
|
+
// use user-defined dpr first
|
|
4436
|
+
dpr = devicePixelRatio || gLite.isBrowser && window.devicePixelRatio || 1;
|
|
4437
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
4438
|
+
this.dpr = dpr;
|
|
4439
|
+
case 6:
|
|
4440
|
+
case "end":
|
|
4441
|
+
return _context.stop();
|
|
4442
|
+
}
|
|
3876
4443
|
}
|
|
3877
|
-
}
|
|
3878
|
-
}
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
}
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
};
|
|
3889
|
-
_proto.getContext = function getContext() {
|
|
3890
|
-
return this.$namespace;
|
|
3891
|
-
};
|
|
3892
|
-
_proto.getDPR = function getDPR() {
|
|
3893
|
-
return this.dpr;
|
|
3894
|
-
};
|
|
3895
|
-
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
3896
|
-
var _this$$namespace;
|
|
3897
|
-
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
3898
|
-
};
|
|
3899
|
-
_proto.destroy = function destroy() {
|
|
3900
|
-
// destroy context
|
|
3901
|
-
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
3902
|
-
this.$container.removeChild(this.$namespace);
|
|
4444
|
+
}, _callee, this);
|
|
4445
|
+
}));
|
|
4446
|
+
function init() {
|
|
4447
|
+
return _init.apply(this, arguments);
|
|
4448
|
+
}
|
|
4449
|
+
return init;
|
|
4450
|
+
}() // @ts-ignore
|
|
4451
|
+
}, {
|
|
4452
|
+
key: "getDomElement",
|
|
4453
|
+
value: function getDomElement() {
|
|
4454
|
+
return this.$namespace;
|
|
3903
4455
|
}
|
|
3904
|
-
}
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
this.$namespace.setAttribute('width', "" + width);
|
|
3909
|
-
this.$namespace.setAttribute('height', "" + height);
|
|
4456
|
+
}, {
|
|
4457
|
+
key: "getContext",
|
|
4458
|
+
value: function getContext() {
|
|
4459
|
+
return this.$namespace;
|
|
3910
4460
|
}
|
|
3911
|
-
}
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
this
|
|
4461
|
+
}, {
|
|
4462
|
+
key: "getDPR",
|
|
4463
|
+
value: function getDPR() {
|
|
4464
|
+
return this.dpr;
|
|
3915
4465
|
}
|
|
3916
|
-
}
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
var
|
|
3920
|
-
return
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
case 6:
|
|
3930
|
-
case "end":
|
|
3931
|
-
return _context2.stop();
|
|
3932
|
-
}
|
|
3933
|
-
}
|
|
3934
|
-
}, _callee2, this);
|
|
3935
|
-
}));
|
|
3936
|
-
function toDataURL(_x) {
|
|
3937
|
-
return _toDataURL.apply(this, arguments);
|
|
4466
|
+
}, {
|
|
4467
|
+
key: "getBoundingClientRect",
|
|
4468
|
+
value: function getBoundingClientRect() {
|
|
4469
|
+
var _this$$namespace;
|
|
4470
|
+
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
4471
|
+
}
|
|
4472
|
+
}, {
|
|
4473
|
+
key: "destroy",
|
|
4474
|
+
value: function destroy() {
|
|
4475
|
+
// destroy context
|
|
4476
|
+
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
4477
|
+
this.$container.removeChild(this.$namespace);
|
|
4478
|
+
}
|
|
3938
4479
|
}
|
|
3939
|
-
|
|
3940
|
-
|
|
4480
|
+
}, {
|
|
4481
|
+
key: "resize",
|
|
4482
|
+
value: function resize(width, height) {
|
|
4483
|
+
// SVG should ignore DPR
|
|
4484
|
+
if (this.$namespace) {
|
|
4485
|
+
this.$namespace.setAttribute('width', "".concat(width));
|
|
4486
|
+
this.$namespace.setAttribute('height', "".concat(height));
|
|
4487
|
+
}
|
|
4488
|
+
}
|
|
4489
|
+
}, {
|
|
4490
|
+
key: "applyCursorStyle",
|
|
4491
|
+
value: function applyCursorStyle(cursor) {
|
|
4492
|
+
if (this.$container) {
|
|
4493
|
+
this.$container.style.cursor = cursor;
|
|
4494
|
+
}
|
|
4495
|
+
}
|
|
4496
|
+
}, {
|
|
4497
|
+
key: "toDataURL",
|
|
4498
|
+
value: function () {
|
|
4499
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
4500
|
+
var cloneNode,
|
|
4501
|
+
svgDocType,
|
|
4502
|
+
svgDoc;
|
|
4503
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
4504
|
+
while (1) {
|
|
4505
|
+
switch (_context2.prev = _context2.next) {
|
|
4506
|
+
case 0:
|
|
4507
|
+
cloneNode = this.$namespace.cloneNode(true);
|
|
4508
|
+
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
4509
|
+
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
4510
|
+
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
4511
|
+
return _context2.abrupt("return", "data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svgDoc))));
|
|
4512
|
+
case 6:
|
|
4513
|
+
case "end":
|
|
4514
|
+
return _context2.stop();
|
|
4515
|
+
}
|
|
4516
|
+
}
|
|
4517
|
+
}, _callee2, this);
|
|
4518
|
+
}));
|
|
4519
|
+
function toDataURL() {
|
|
4520
|
+
return _toDataURL.apply(this, arguments);
|
|
4521
|
+
}
|
|
4522
|
+
return toDataURL;
|
|
4523
|
+
}()
|
|
4524
|
+
}]);
|
|
3941
4525
|
return SVGContextService;
|
|
3942
4526
|
}();
|
|
3943
4527
|
|
|
3944
4528
|
var ContextRegisterPlugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
3945
|
-
|
|
4529
|
+
_inherits(ContextRegisterPlugin, _AbstractRendererPlug);
|
|
4530
|
+
var _super = _createSuper(ContextRegisterPlugin);
|
|
3946
4531
|
function ContextRegisterPlugin() {
|
|
3947
4532
|
var _this;
|
|
4533
|
+
_classCallCheck(this, ContextRegisterPlugin);
|
|
3948
4534
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3949
4535
|
args[_key] = arguments[_key];
|
|
3950
4536
|
}
|
|
3951
|
-
_this =
|
|
4537
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
3952
4538
|
_this.name = 'svg-context-register';
|
|
3953
4539
|
return _this;
|
|
3954
4540
|
}
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
4541
|
+
_createClass(ContextRegisterPlugin, [{
|
|
4542
|
+
key: "init",
|
|
4543
|
+
value: function init() {
|
|
4544
|
+
// @ts-ignore
|
|
4545
|
+
this.context.ContextService = SVGContextService;
|
|
4546
|
+
}
|
|
4547
|
+
}, {
|
|
4548
|
+
key: "destroy",
|
|
4549
|
+
value: function destroy() {
|
|
4550
|
+
delete this.context.ContextService;
|
|
4551
|
+
}
|
|
4552
|
+
}]);
|
|
3963
4553
|
return ContextRegisterPlugin;
|
|
3964
4554
|
}(gLite.AbstractRendererPlugin);
|
|
3965
4555
|
|
|
3966
4556
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
3967
|
-
|
|
3968
|
-
|
|
4557
|
+
_inherits(Renderer, _AbstractRenderer);
|
|
4558
|
+
var _super = _createSuper(Renderer);
|
|
4559
|
+
function Renderer() {
|
|
3969
4560
|
var _this;
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
_this = _AbstractRenderer.call(this, config) || this;
|
|
4561
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4562
|
+
_classCallCheck(this, Renderer);
|
|
4563
|
+
_this = _super.call(this, config);
|
|
3974
4564
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
3975
4565
|
_this.registerPlugin(new Plugin$1({
|
|
3976
4566
|
outputSVGElementId: config.outputSVGElementId
|
|
@@ -3979,7 +4569,7 @@
|
|
|
3979
4569
|
_this.registerPlugin(new Plugin$2());
|
|
3980
4570
|
return _this;
|
|
3981
4571
|
}
|
|
3982
|
-
return Renderer;
|
|
4572
|
+
return _createClass(Renderer);
|
|
3983
4573
|
}(gLite.AbstractRenderer);
|
|
3984
4574
|
|
|
3985
4575
|
exports.DomInteraction = index_esm;
|