@antv/g-svg 1.8.29 → 1.8.31
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/SVGContextService.d.ts +2 -0
- package/dist/SVGContextService.d.ts.map +1 -1
- package/dist/index.esm.js +240 -222
- package/dist/index.js +239 -221
- package/dist/index.umd.js +1196 -1640
- package/dist/index.umd.min.js +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -363,49 +363,10 @@ function _asyncToGenerator(fn) {
|
|
|
363
363
|
});
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
function _defineProperties(target, props) {
|
|
372
|
-
for (var i = 0; i < props.length; i++) {
|
|
373
|
-
var descriptor = props[i];
|
|
374
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
375
|
-
descriptor.configurable = true;
|
|
376
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
377
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
381
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
382
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
383
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
384
|
-
writable: false
|
|
385
|
-
});
|
|
386
|
-
return Constructor;
|
|
387
|
-
}
|
|
388
|
-
function _inherits(subClass, superClass) {
|
|
389
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
390
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
391
|
-
}
|
|
392
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
393
|
-
constructor: {
|
|
394
|
-
value: subClass,
|
|
395
|
-
writable: true,
|
|
396
|
-
configurable: true
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
Object.defineProperty(subClass, "prototype", {
|
|
400
|
-
writable: false
|
|
401
|
-
});
|
|
402
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
403
|
-
}
|
|
404
|
-
function _getPrototypeOf(o) {
|
|
405
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
406
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
407
|
-
};
|
|
408
|
-
return _getPrototypeOf(o);
|
|
366
|
+
function _inheritsLoose(subClass, superClass) {
|
|
367
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
368
|
+
subClass.prototype.constructor = subClass;
|
|
369
|
+
_setPrototypeOf(subClass, superClass);
|
|
409
370
|
}
|
|
410
371
|
function _setPrototypeOf(o, p) {
|
|
411
372
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
@@ -414,219 +375,276 @@ function _setPrototypeOf(o, p) {
|
|
|
414
375
|
};
|
|
415
376
|
return _setPrototypeOf(o, p);
|
|
416
377
|
}
|
|
417
|
-
function
|
|
418
|
-
if (
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
function _assertThisInitialized(self) {
|
|
429
|
-
if (self === void 0) {
|
|
430
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
431
|
-
}
|
|
432
|
-
return self;
|
|
433
|
-
}
|
|
434
|
-
function _possibleConstructorReturn(self, call) {
|
|
435
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
436
|
-
return call;
|
|
437
|
-
} else if (call !== void 0) {
|
|
438
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
378
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
379
|
+
if (source == null) return {};
|
|
380
|
+
var target = {};
|
|
381
|
+
var sourceKeys = Object.keys(source);
|
|
382
|
+
var key, i;
|
|
383
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
384
|
+
key = sourceKeys[i];
|
|
385
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
386
|
+
target[key] = source[key];
|
|
439
387
|
}
|
|
440
|
-
return
|
|
441
|
-
}
|
|
442
|
-
function _createSuper(Derived) {
|
|
443
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
444
|
-
return function _createSuperInternal() {
|
|
445
|
-
var Super = _getPrototypeOf(Derived),
|
|
446
|
-
result;
|
|
447
|
-
if (hasNativeReflectConstruct) {
|
|
448
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
449
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
450
|
-
} else {
|
|
451
|
-
result = Super.apply(this, arguments);
|
|
452
|
-
}
|
|
453
|
-
return _possibleConstructorReturn(this, result);
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
function _toPrimitive(input, hint) {
|
|
457
|
-
if (typeof input !== "object" || input === null) return input;
|
|
458
|
-
var prim = input[Symbol.toPrimitive];
|
|
459
|
-
if (prim !== undefined) {
|
|
460
|
-
var res = prim.call(input, hint || "default");
|
|
461
|
-
if (typeof res !== "object") return res;
|
|
462
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
463
|
-
}
|
|
464
|
-
return (hint === "string" ? String : Number)(input);
|
|
465
|
-
}
|
|
466
|
-
function _toPropertyKey(arg) {
|
|
467
|
-
var key = _toPrimitive(arg, "string");
|
|
468
|
-
return typeof key === "symbol" ? key : String(key);
|
|
388
|
+
return target;
|
|
469
389
|
}
|
|
470
390
|
|
|
391
|
+
var _excluded = ["offset", "composite", "computedOffset", "easing"],
|
|
392
|
+
_excluded2 = ["offset", "composite", "computedOffset", "easing", "transformOrigin"],
|
|
393
|
+
_excluded3 = ["offset", "composite", "computedOffset", "easing", "transformOrigin"],
|
|
394
|
+
_excluded4 = ["offset", "composite", "computedOffset", "easing", "transformOrigin"];
|
|
471
395
|
var SVGContextService = /*#__PURE__*/function () {
|
|
472
396
|
function SVGContextService(context) {
|
|
473
|
-
|
|
397
|
+
this.context = void 0;
|
|
474
398
|
this.$container = void 0;
|
|
475
399
|
this.$namespace = void 0;
|
|
476
400
|
this.dpr = void 0;
|
|
477
401
|
this.canvasConfig = void 0;
|
|
402
|
+
this.context = context;
|
|
478
403
|
this.canvasConfig = context.config;
|
|
479
404
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
var
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
if (this.$container) {
|
|
492
|
-
|
|
493
|
-
this.$container.style.position = 'relative';
|
|
494
|
-
}
|
|
495
|
-
$namespace = SVGRenderer.createSVGElement('svg', doc);
|
|
496
|
-
$namespace.setAttribute('width', "".concat(this.canvasConfig.width));
|
|
497
|
-
$namespace.setAttribute('height', "".concat(this.canvasConfig.height));
|
|
498
|
-
this.$container.appendChild($namespace);
|
|
499
|
-
this.$namespace = $namespace;
|
|
405
|
+
var _proto = SVGContextService.prototype;
|
|
406
|
+
_proto.init = /*#__PURE__*/function () {
|
|
407
|
+
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
408
|
+
var _this$canvasConfig, container, doc, devicePixelRatio, $namespace, dpr;
|
|
409
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
410
|
+
while (1) {
|
|
411
|
+
switch (_context.prev = _context.next) {
|
|
412
|
+
case 0:
|
|
413
|
+
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document, devicePixelRatio = _this$canvasConfig.devicePixelRatio; // create container
|
|
414
|
+
this.$container = util.isString(container) ? (doc || document).getElementById(container) : container;
|
|
415
|
+
if (this.$container) {
|
|
416
|
+
if (!this.$container.style.position) {
|
|
417
|
+
this.$container.style.position = 'relative';
|
|
500
418
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
this.
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
419
|
+
$namespace = SVGRenderer.createSVGElement('svg', doc);
|
|
420
|
+
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
421
|
+
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
422
|
+
this.$container.appendChild($namespace);
|
|
423
|
+
this.$namespace = $namespace;
|
|
424
|
+
}
|
|
425
|
+
// use user-defined dpr first
|
|
426
|
+
dpr = devicePixelRatio || gLite.isBrowser && window.devicePixelRatio || 1;
|
|
427
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
428
|
+
this.dpr = dpr;
|
|
429
|
+
case 6:
|
|
430
|
+
case "end":
|
|
431
|
+
return _context.stop();
|
|
509
432
|
}
|
|
510
|
-
}
|
|
511
|
-
})
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
return init;
|
|
516
|
-
}() // @ts-ignore
|
|
517
|
-
}, {
|
|
518
|
-
key: "getDomElement",
|
|
519
|
-
value: function getDomElement() {
|
|
520
|
-
return this.$namespace;
|
|
521
|
-
}
|
|
522
|
-
}, {
|
|
523
|
-
key: "getContext",
|
|
524
|
-
value: function getContext() {
|
|
525
|
-
return this.$namespace;
|
|
526
|
-
}
|
|
527
|
-
}, {
|
|
528
|
-
key: "getDPR",
|
|
529
|
-
value: function getDPR() {
|
|
530
|
-
return this.dpr;
|
|
433
|
+
}
|
|
434
|
+
}, _callee, this);
|
|
435
|
+
}));
|
|
436
|
+
function init() {
|
|
437
|
+
return _init.apply(this, arguments);
|
|
531
438
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
439
|
+
return init;
|
|
440
|
+
}() // @ts-ignore
|
|
441
|
+
;
|
|
442
|
+
_proto.getDomElement = function getDomElement() {
|
|
443
|
+
return this.$namespace;
|
|
444
|
+
};
|
|
445
|
+
_proto.getContext = function getContext() {
|
|
446
|
+
return this.$namespace;
|
|
447
|
+
};
|
|
448
|
+
_proto.getDPR = function getDPR() {
|
|
449
|
+
return this.dpr;
|
|
450
|
+
};
|
|
451
|
+
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
452
|
+
var _this$$namespace;
|
|
453
|
+
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
454
|
+
};
|
|
455
|
+
_proto.destroy = function destroy() {
|
|
456
|
+
// destroy context
|
|
457
|
+
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
458
|
+
this.$container.removeChild(this.$namespace);
|
|
537
459
|
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
460
|
+
};
|
|
461
|
+
_proto.resize = function resize(width, height) {
|
|
462
|
+
// SVG should ignore DPR
|
|
463
|
+
if (this.$namespace) {
|
|
464
|
+
this.$namespace.setAttribute('width', "" + width);
|
|
465
|
+
this.$namespace.setAttribute('height', "" + height);
|
|
545
466
|
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
if (this.$namespace) {
|
|
551
|
-
this.$namespace.setAttribute('width', "".concat(width));
|
|
552
|
-
this.$namespace.setAttribute('height', "".concat(height));
|
|
553
|
-
}
|
|
467
|
+
};
|
|
468
|
+
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
|
|
469
|
+
if (this.$container) {
|
|
470
|
+
this.$container.style.cursor = cursor;
|
|
554
471
|
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
this.$container.style.cursor = cursor;
|
|
560
|
-
}
|
|
472
|
+
};
|
|
473
|
+
_proto.generateCSSText = function generateCSSText(animationName, selector, keyframes, timing, prefixes) {
|
|
474
|
+
if (prefixes === void 0) {
|
|
475
|
+
prefixes = {};
|
|
561
476
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
477
|
+
var duration = timing.duration,
|
|
478
|
+
easing = timing.easing,
|
|
479
|
+
delay = timing.delay,
|
|
480
|
+
direction = timing.direction,
|
|
481
|
+
iterations = timing.iterations,
|
|
482
|
+
fill = timing.fill;
|
|
483
|
+
return "@keyframes " + animationName + "{" + keyframes.map(function (keyframe) {
|
|
484
|
+
var offset = keyframe.offset,
|
|
485
|
+
composite = keyframe.composite,
|
|
486
|
+
computedOffset = keyframe.computedOffset,
|
|
487
|
+
easing = keyframe.easing,
|
|
488
|
+
rest = _objectWithoutPropertiesLoose(keyframe, _excluded);
|
|
489
|
+
var rules = Object.keys(rest).map(function (attributeName) {
|
|
490
|
+
return attributeName + ":" + (prefixes[attributeName] || '') + rest[attributeName] + ";";
|
|
491
|
+
}).join('');
|
|
492
|
+
return computedOffset * 100 + "%{" + rules + "}";
|
|
493
|
+
}).join('') + "}" + (selector + " {animation: " + animationName + " " + duration + "ms " + easing + " " + delay + "ms " + (iterations === Infinity ? 'infinite' : iterations) + " " + direction + " " + fill + ";}");
|
|
494
|
+
};
|
|
495
|
+
_proto.toDataURL = /*#__PURE__*/function () {
|
|
496
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
497
|
+
var _this = this;
|
|
498
|
+
var cloneNode, doc, animationCounter, $style, svgDocType, svgDoc;
|
|
499
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
500
|
+
while (1) {
|
|
501
|
+
switch (_context2.prev = _context2.next) {
|
|
502
|
+
case 0:
|
|
503
|
+
cloneNode = this.$namespace.cloneNode(true);
|
|
504
|
+
doc = this.canvasConfig.document;
|
|
505
|
+
animationCounter = 0;
|
|
506
|
+
$style = null;
|
|
507
|
+
this.context.renderingContext.root.forEach(function (object) {
|
|
508
|
+
var animations = object.getAnimations();
|
|
509
|
+
if (animations.length) {
|
|
510
|
+
if (!$style) {
|
|
511
|
+
// export animations to <style>, using CSS Transformation
|
|
512
|
+
$style = (doc || document).createElement('style');
|
|
513
|
+
cloneNode.appendChild($style);
|
|
514
|
+
}
|
|
515
|
+
// @ts-ignore
|
|
516
|
+
var svgElement = object.elementSVG;
|
|
517
|
+
var selfSelector = "#" + svgElement.$el.id;
|
|
518
|
+
var groupSelector = "#" + svgElement.$groupEl.id;
|
|
519
|
+
var selfCssText = '';
|
|
520
|
+
var groupCssText = '';
|
|
521
|
+
animations.forEach(function (animation) {
|
|
522
|
+
var keyframes = animation.effect.getKeyframes();
|
|
523
|
+
// split attributes into self and group
|
|
524
|
+
if (keyframes.length) {
|
|
525
|
+
var selfAttributes = [];
|
|
526
|
+
var groupAttributes = [];
|
|
527
|
+
var _keyframes$ = keyframes[0],
|
|
528
|
+
offset = _keyframes$.offset,
|
|
529
|
+
composite = _keyframes$.composite,
|
|
530
|
+
computedOffset = _keyframes$.computedOffset,
|
|
531
|
+
easing = _keyframes$.easing,
|
|
532
|
+
transformOrigin = _keyframes$.transformOrigin,
|
|
533
|
+
rest = _objectWithoutPropertiesLoose(_keyframes$, _excluded2);
|
|
534
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
535
|
+
var _propertyMetadataCach;
|
|
536
|
+
if (attributeName === 'transform') {
|
|
537
|
+
groupAttributes.push(attributeName);
|
|
538
|
+
}
|
|
539
|
+
var inherited = !!((_propertyMetadataCach = gLite.propertyMetadataCache[attributeName]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.inh);
|
|
540
|
+
if (inherited) {
|
|
541
|
+
groupAttributes.push(attributeName);
|
|
542
|
+
} else if (attributeName !== 'transform') {
|
|
543
|
+
selfAttributes.push(attributeName);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
if (groupAttributes.length) {
|
|
547
|
+
var keyframesWithGroup = keyframes.map(function (keyframe) {
|
|
548
|
+
var offset = keyframe.offset,
|
|
549
|
+
composite = keyframe.composite,
|
|
550
|
+
computedOffset = keyframe.computedOffset,
|
|
551
|
+
easing = keyframe.easing,
|
|
552
|
+
transformOrigin = keyframe.transformOrigin,
|
|
553
|
+
rest = _objectWithoutPropertiesLoose(keyframe, _excluded3);
|
|
554
|
+
var ret = {
|
|
555
|
+
offset: offset,
|
|
556
|
+
composite: composite,
|
|
557
|
+
computedOffset: computedOffset,
|
|
558
|
+
easing: easing
|
|
559
|
+
};
|
|
560
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
561
|
+
if (groupAttributes.includes(attributeName)) {
|
|
562
|
+
ret[attributeName] = keyframe[attributeName];
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
return ret;
|
|
566
|
+
});
|
|
567
|
+
groupCssText += _this.generateCSSText("a" + animationCounter++, groupSelector, keyframesWithGroup, animation.effect.getComputedTiming(), {
|
|
568
|
+
transform: svgElement.$groupEl.getAttribute('transform')
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
if (selfAttributes.length) {
|
|
572
|
+
var keyframesWithSelf = keyframes.map(function (keyframe) {
|
|
573
|
+
var offset = keyframe.offset,
|
|
574
|
+
composite = keyframe.composite,
|
|
575
|
+
computedOffset = keyframe.computedOffset,
|
|
576
|
+
easing = keyframe.easing,
|
|
577
|
+
transformOrigin = keyframe.transformOrigin,
|
|
578
|
+
rest = _objectWithoutPropertiesLoose(keyframe, _excluded4);
|
|
579
|
+
var ret = {
|
|
580
|
+
offset: offset,
|
|
581
|
+
composite: composite,
|
|
582
|
+
computedOffset: computedOffset,
|
|
583
|
+
easing: easing
|
|
584
|
+
};
|
|
585
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
586
|
+
if (selfAttributes.includes(attributeName)) {
|
|
587
|
+
ret[attributeName] = keyframe[attributeName];
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
return ret;
|
|
591
|
+
});
|
|
592
|
+
selfCssText += _this.generateCSSText("a" + animationCounter++, selfSelector, keyframesWithSelf, animation.effect.getComputedTiming());
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
$style.textContent += selfCssText + groupCssText;
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
600
|
+
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
601
|
+
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
602
|
+
return _context2.abrupt("return", "data:image/svg+xml;charset=utf8," + encodeURIComponent(new XMLSerializer().serializeToString(svgDoc)));
|
|
603
|
+
case 10:
|
|
604
|
+
case "end":
|
|
605
|
+
return _context2.stop();
|
|
582
606
|
}
|
|
583
|
-
}
|
|
584
|
-
})
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
}
|
|
607
|
+
}
|
|
608
|
+
}, _callee2, this);
|
|
609
|
+
}));
|
|
610
|
+
function toDataURL(_x) {
|
|
611
|
+
return _toDataURL.apply(this, arguments);
|
|
612
|
+
}
|
|
613
|
+
return toDataURL;
|
|
614
|
+
}();
|
|
591
615
|
return SVGContextService;
|
|
592
616
|
}();
|
|
593
617
|
|
|
594
618
|
var ContextRegisterPlugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
595
|
-
|
|
596
|
-
var _super = _createSuper(ContextRegisterPlugin);
|
|
619
|
+
_inheritsLoose(ContextRegisterPlugin, _AbstractRendererPlug);
|
|
597
620
|
function ContextRegisterPlugin() {
|
|
598
621
|
var _this;
|
|
599
|
-
_classCallCheck(this, ContextRegisterPlugin);
|
|
600
622
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
601
623
|
args[_key] = arguments[_key];
|
|
602
624
|
}
|
|
603
|
-
_this =
|
|
625
|
+
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
604
626
|
_this.name = 'svg-context-register';
|
|
605
627
|
return _this;
|
|
606
628
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
value: function destroy() {
|
|
616
|
-
delete this.context.ContextService;
|
|
617
|
-
}
|
|
618
|
-
}]);
|
|
629
|
+
var _proto = ContextRegisterPlugin.prototype;
|
|
630
|
+
_proto.init = function init() {
|
|
631
|
+
// @ts-ignore
|
|
632
|
+
this.context.ContextService = SVGContextService;
|
|
633
|
+
};
|
|
634
|
+
_proto.destroy = function destroy() {
|
|
635
|
+
delete this.context.ContextService;
|
|
636
|
+
};
|
|
619
637
|
return ContextRegisterPlugin;
|
|
620
638
|
}(gLite.AbstractRendererPlugin);
|
|
621
639
|
|
|
622
640
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
function Renderer() {
|
|
641
|
+
_inheritsLoose(Renderer, _AbstractRenderer);
|
|
642
|
+
function Renderer(config) {
|
|
626
643
|
var _this;
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
644
|
+
if (config === void 0) {
|
|
645
|
+
config = {};
|
|
646
|
+
}
|
|
647
|
+
_this = _AbstractRenderer.call(this, config) || this;
|
|
630
648
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
631
649
|
_this.registerPlugin(new SVGRenderer.Plugin({
|
|
632
650
|
outputSVGElementId: config.outputSVGElementId
|
|
@@ -635,7 +653,7 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
|
635
653
|
_this.registerPlugin(new SVGPicker.Plugin());
|
|
636
654
|
return _this;
|
|
637
655
|
}
|
|
638
|
-
return
|
|
656
|
+
return Renderer;
|
|
639
657
|
}(gLite.AbstractRenderer);
|
|
640
658
|
|
|
641
659
|
exports.DomInteraction = DomInteraction__namespace;
|