@antv/g-canvas 1.9.8 → 1.9.10
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/Canvas2DContextService.d.ts +4 -6
- package/dist/Canvas2DContextService.d.ts.map +1 -1
- package/dist/ContextRegisterPlugin.d.ts.map +1 -1
- package/dist/index.esm.js +8 -19
- package/dist/index.js +7 -18
- package/dist/index.umd.js +1716 -2114
- package/dist/index.umd.min.js +6 -6
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -400,32 +400,6 @@
|
|
|
400
400
|
return _setPrototypeOf(o, p);
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
/******************************************************************************
|
|
404
|
-
Copyright (c) Microsoft Corporation.
|
|
405
|
-
|
|
406
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
407
|
-
purpose with or without fee is hereby granted.
|
|
408
|
-
|
|
409
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
410
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
411
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
412
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
413
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
414
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
415
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
416
|
-
***************************************************************************** */
|
|
417
|
-
|
|
418
|
-
function __decorate(decorators, target, key, desc) {
|
|
419
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
420
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
421
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
422
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function __param(paramIndex, decorator) {
|
|
426
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
427
|
-
}
|
|
428
|
-
|
|
429
403
|
var toString = {}.toString;
|
|
430
404
|
var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
|
|
431
405
|
|
|
@@ -467,9 +441,6 @@
|
|
|
467
441
|
return _setPrototypeOf$1(o, p);
|
|
468
442
|
}
|
|
469
443
|
|
|
470
|
-
var PathGeneratorFactory = gLite.Syringe.defineToken('');
|
|
471
|
-
var PathGenerator = gLite.Syringe.defineToken('');
|
|
472
|
-
|
|
473
444
|
function generatePath(context, parsedStyle) {
|
|
474
445
|
var r = parsedStyle.r;
|
|
475
446
|
context.arc(r, r, r, 0, Math.PI * 2, false);
|
|
@@ -761,73 +732,6 @@
|
|
|
761
732
|
}
|
|
762
733
|
}
|
|
763
734
|
|
|
764
|
-
var containerModule = gLite.Module(function (register) {
|
|
765
|
-
/**
|
|
766
|
-
* register shape renderers
|
|
767
|
-
*/
|
|
768
|
-
register({
|
|
769
|
-
token: {
|
|
770
|
-
token: PathGenerator,
|
|
771
|
-
named: gLite.Shape.CIRCLE
|
|
772
|
-
},
|
|
773
|
-
useValue: generatePath
|
|
774
|
-
});
|
|
775
|
-
register({
|
|
776
|
-
token: {
|
|
777
|
-
token: PathGenerator,
|
|
778
|
-
named: gLite.Shape.ELLIPSE
|
|
779
|
-
},
|
|
780
|
-
useValue: generatePath$1
|
|
781
|
-
});
|
|
782
|
-
register({
|
|
783
|
-
token: {
|
|
784
|
-
token: PathGenerator,
|
|
785
|
-
named: gLite.Shape.RECT
|
|
786
|
-
},
|
|
787
|
-
useValue: generatePath$6
|
|
788
|
-
});
|
|
789
|
-
register({
|
|
790
|
-
token: {
|
|
791
|
-
token: PathGenerator,
|
|
792
|
-
named: gLite.Shape.LINE
|
|
793
|
-
},
|
|
794
|
-
useValue: generatePath$2
|
|
795
|
-
});
|
|
796
|
-
register({
|
|
797
|
-
token: {
|
|
798
|
-
token: PathGenerator,
|
|
799
|
-
named: gLite.Shape.POLYLINE
|
|
800
|
-
},
|
|
801
|
-
useValue: generatePath$5
|
|
802
|
-
});
|
|
803
|
-
register({
|
|
804
|
-
token: {
|
|
805
|
-
token: PathGenerator,
|
|
806
|
-
named: gLite.Shape.POLYGON
|
|
807
|
-
},
|
|
808
|
-
useValue: generatePath$4
|
|
809
|
-
});
|
|
810
|
-
register({
|
|
811
|
-
token: {
|
|
812
|
-
token: PathGenerator,
|
|
813
|
-
named: gLite.Shape.PATH
|
|
814
|
-
},
|
|
815
|
-
useValue: generatePath$3
|
|
816
|
-
});
|
|
817
|
-
register({
|
|
818
|
-
token: PathGeneratorFactory,
|
|
819
|
-
useFactory: function useFactory(ctx) {
|
|
820
|
-
return function (tagName) {
|
|
821
|
-
if (ctx.container.isBoundNamed(PathGenerator, tagName)) {
|
|
822
|
-
return ctx.container.getNamed(PathGenerator, tagName);
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
return null;
|
|
826
|
-
};
|
|
827
|
-
}
|
|
828
|
-
});
|
|
829
|
-
});
|
|
830
|
-
|
|
831
735
|
var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
832
736
|
_inheritsLoose$1(Plugin, _AbstractRendererPlug);
|
|
833
737
|
|
|
@@ -846,11 +750,16 @@
|
|
|
846
750
|
var _proto = Plugin.prototype;
|
|
847
751
|
|
|
848
752
|
_proto.init = function init() {
|
|
849
|
-
|
|
753
|
+
var _pathGeneratorFactory;
|
|
754
|
+
|
|
755
|
+
var pathGeneratorFactory = (_pathGeneratorFactory = {}, _pathGeneratorFactory[gLite.Shape.CIRCLE] = generatePath, _pathGeneratorFactory[gLite.Shape.ELLIPSE] = generatePath$1, _pathGeneratorFactory[gLite.Shape.RECT] = generatePath$6, _pathGeneratorFactory[gLite.Shape.LINE] = generatePath$2, _pathGeneratorFactory[gLite.Shape.POLYLINE] = generatePath$5, _pathGeneratorFactory[gLite.Shape.POLYGON] = generatePath$4, _pathGeneratorFactory[gLite.Shape.PATH] = generatePath$3, _pathGeneratorFactory[gLite.Shape.TEXT] = undefined, _pathGeneratorFactory[gLite.Shape.GROUP] = undefined, _pathGeneratorFactory[gLite.Shape.IMAGE] = undefined, _pathGeneratorFactory[gLite.Shape.HTML] = undefined, _pathGeneratorFactory[gLite.Shape.MESH] = undefined, _pathGeneratorFactory); // @ts-ignore
|
|
756
|
+
|
|
757
|
+
this.context.pathGeneratorFactory = pathGeneratorFactory;
|
|
850
758
|
};
|
|
851
759
|
|
|
852
760
|
_proto.destroy = function destroy() {
|
|
853
|
-
|
|
761
|
+
// @ts-ignore
|
|
762
|
+
delete this.context.pathGeneratorFactory;
|
|
854
763
|
};
|
|
855
764
|
|
|
856
765
|
return Plugin;
|
|
@@ -858,8 +767,6 @@
|
|
|
858
767
|
|
|
859
768
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
860
769
|
__proto__: null,
|
|
861
|
-
PathGenerator: PathGenerator,
|
|
862
|
-
PathGeneratorFactory: PathGeneratorFactory,
|
|
863
770
|
Plugin: Plugin
|
|
864
771
|
});
|
|
865
772
|
|
|
@@ -1419,68 +1326,6 @@
|
|
|
1419
1326
|
out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
|
|
1420
1327
|
return out;
|
|
1421
1328
|
}
|
|
1422
|
-
/**
|
|
1423
|
-
* Multiplies two mat4s
|
|
1424
|
-
*
|
|
1425
|
-
* @param {mat4} out the receiving matrix
|
|
1426
|
-
* @param {ReadonlyMat4} a the first operand
|
|
1427
|
-
* @param {ReadonlyMat4} b the second operand
|
|
1428
|
-
* @returns {mat4} out
|
|
1429
|
-
*/
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
function multiply(out, a, b) {
|
|
1433
|
-
var a00 = a[0],
|
|
1434
|
-
a01 = a[1],
|
|
1435
|
-
a02 = a[2],
|
|
1436
|
-
a03 = a[3];
|
|
1437
|
-
var a10 = a[4],
|
|
1438
|
-
a11 = a[5],
|
|
1439
|
-
a12 = a[6],
|
|
1440
|
-
a13 = a[7];
|
|
1441
|
-
var a20 = a[8],
|
|
1442
|
-
a21 = a[9],
|
|
1443
|
-
a22 = a[10],
|
|
1444
|
-
a23 = a[11];
|
|
1445
|
-
var a30 = a[12],
|
|
1446
|
-
a31 = a[13],
|
|
1447
|
-
a32 = a[14],
|
|
1448
|
-
a33 = a[15]; // Cache only the current line of the second matrix
|
|
1449
|
-
|
|
1450
|
-
var b0 = b[0],
|
|
1451
|
-
b1 = b[1],
|
|
1452
|
-
b2 = b[2],
|
|
1453
|
-
b3 = b[3];
|
|
1454
|
-
out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
1455
|
-
out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
1456
|
-
out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
1457
|
-
out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
1458
|
-
b0 = b[4];
|
|
1459
|
-
b1 = b[5];
|
|
1460
|
-
b2 = b[6];
|
|
1461
|
-
b3 = b[7];
|
|
1462
|
-
out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
1463
|
-
out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
1464
|
-
out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
1465
|
-
out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
1466
|
-
b0 = b[8];
|
|
1467
|
-
b1 = b[9];
|
|
1468
|
-
b2 = b[10];
|
|
1469
|
-
b3 = b[11];
|
|
1470
|
-
out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
1471
|
-
out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
1472
|
-
out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
1473
|
-
out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
1474
|
-
b0 = b[12];
|
|
1475
|
-
b1 = b[13];
|
|
1476
|
-
b2 = b[14];
|
|
1477
|
-
b3 = b[15];
|
|
1478
|
-
out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
1479
|
-
out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
1480
|
-
out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
1481
|
-
out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
1482
|
-
return out;
|
|
1483
|
-
}
|
|
1484
1329
|
/**
|
|
1485
1330
|
* 3 Dimensional Vector
|
|
1486
1331
|
* @module vec3
|
|
@@ -1703,10 +1548,6 @@
|
|
|
1703
1548
|
};
|
|
1704
1549
|
}();
|
|
1705
1550
|
|
|
1706
|
-
var _class;
|
|
1707
|
-
|
|
1708
|
-
var CanvasPickerPlugin_1;
|
|
1709
|
-
var PointInPathPickerFactory = gLite.Syringe.defineToken('');
|
|
1710
1551
|
var tmpVec3a = create$1();
|
|
1711
1552
|
var tmpVec3b = create$1();
|
|
1712
1553
|
var tmpVec3c = create$1();
|
|
@@ -1718,20 +1559,17 @@
|
|
|
1718
1559
|
* 2. do math calculation with geometry in an accurate way
|
|
1719
1560
|
*/
|
|
1720
1561
|
|
|
1721
|
-
var CanvasPickerPlugin =
|
|
1722
|
-
function CanvasPickerPlugin(
|
|
1562
|
+
var CanvasPickerPlugin = /*#__PURE__*/function () {
|
|
1563
|
+
function CanvasPickerPlugin() {
|
|
1723
1564
|
var _this = this;
|
|
1724
1565
|
|
|
1725
|
-
this.renderingContext = void 0;
|
|
1726
1566
|
this.canvasConfig = void 0;
|
|
1727
|
-
this.offscreenCanvas = void 0;
|
|
1728
1567
|
this.pathGeneratorFactory = void 0;
|
|
1729
1568
|
this.pointInPathPickerFactory = void 0;
|
|
1730
|
-
this.pathGeneratorFactoryCache = {};
|
|
1731
1569
|
|
|
1732
1570
|
this.isHit = function (displayObject, position, worldTransform) {
|
|
1733
1571
|
// use picker for current shape's type
|
|
1734
|
-
var pick = _this.pointInPathPickerFactory
|
|
1572
|
+
var pick = _this.pointInPathPickerFactory[displayObject.nodeName];
|
|
1735
1573
|
|
|
1736
1574
|
if (pick) {
|
|
1737
1575
|
// invert with world matrix
|
|
@@ -1755,13 +1593,8 @@
|
|
|
1755
1593
|
};
|
|
1756
1594
|
|
|
1757
1595
|
this.isPointInPath = function (displayObject, position) {
|
|
1758
|
-
var context =
|
|
1759
|
-
|
|
1760
|
-
if (_this.pathGeneratorFactoryCache[displayObject.nodeName] === undefined) {
|
|
1761
|
-
_this.pathGeneratorFactoryCache[displayObject.nodeName] = _this.pathGeneratorFactory(displayObject.nodeName);
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
var generatePath = _this.pathGeneratorFactoryCache[displayObject.nodeName];
|
|
1596
|
+
var context = gLite.runtime.offscreenCanvas.getOrCreateContext(_this.canvasConfig.offscreenCanvas);
|
|
1597
|
+
var generatePath = _this.pathGeneratorFactory[displayObject.nodeName];
|
|
1765
1598
|
|
|
1766
1599
|
if (generatePath) {
|
|
1767
1600
|
context.beginPath();
|
|
@@ -1771,22 +1604,24 @@
|
|
|
1771
1604
|
|
|
1772
1605
|
return context.isPointInPath(position.x, position.y);
|
|
1773
1606
|
};
|
|
1774
|
-
|
|
1775
|
-
this.renderingContext = renderingContext;
|
|
1776
|
-
this.canvasConfig = canvasConfig;
|
|
1777
|
-
this.offscreenCanvas = offscreenCanvas;
|
|
1778
|
-
this.pathGeneratorFactory = pathGeneratorFactory;
|
|
1779
|
-
this.pointInPathPickerFactory = pointInPathPickerFactory;
|
|
1780
1607
|
}
|
|
1781
1608
|
|
|
1782
1609
|
var _proto = CanvasPickerPlugin.prototype;
|
|
1783
1610
|
|
|
1784
|
-
_proto.apply = function apply(
|
|
1785
|
-
var
|
|
1611
|
+
_proto.apply = function apply(context) {
|
|
1612
|
+
var _renderingContext$roo,
|
|
1786
1613
|
_this2 = this;
|
|
1787
1614
|
|
|
1788
|
-
var
|
|
1789
|
-
|
|
1615
|
+
var config = context.config,
|
|
1616
|
+
renderingService = context.renderingService,
|
|
1617
|
+
renderingContext = context.renderingContext,
|
|
1618
|
+
pathGeneratorFactory = context.pathGeneratorFactory,
|
|
1619
|
+
pointInPathPickerFactory = context.pointInPathPickerFactory;
|
|
1620
|
+
this.canvasConfig = config;
|
|
1621
|
+
this.pathGeneratorFactory = pathGeneratorFactory;
|
|
1622
|
+
this.pointInPathPickerFactory = pointInPathPickerFactory;
|
|
1623
|
+
var document = (_renderingContext$roo = renderingContext.root) === null || _renderingContext$roo === void 0 ? void 0 : _renderingContext$roo.ownerDocument;
|
|
1624
|
+
renderingService.hooks.pick.tapPromise(CanvasPickerPlugin.tag, /*#__PURE__*/function () {
|
|
1790
1625
|
var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee(result) {
|
|
1791
1626
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
1792
1627
|
while (1) {
|
|
@@ -1806,7 +1641,7 @@
|
|
|
1806
1641
|
return _ref.apply(this, arguments);
|
|
1807
1642
|
};
|
|
1808
1643
|
}());
|
|
1809
|
-
renderingService.hooks.pickSync.tap(
|
|
1644
|
+
renderingService.hooks.pickSync.tap(CanvasPickerPlugin.tag, function (result) {
|
|
1810
1645
|
return _this2.pick(document, result);
|
|
1811
1646
|
});
|
|
1812
1647
|
};
|
|
@@ -1819,44 +1654,7 @@
|
|
|
1819
1654
|
|
|
1820
1655
|
var position = set(tmpVec3a, x, y, 0); // query by AABB first with spatial index(r-tree)
|
|
1821
1656
|
|
|
1822
|
-
var hitTestList = document.elementsFromBBox(position[0], position[1], position[0], position[1]); //
|
|
1823
|
-
// minX: position[0],
|
|
1824
|
-
// minY: position[1],
|
|
1825
|
-
// maxX: position[0],
|
|
1826
|
-
// maxY: position[1],
|
|
1827
|
-
// });
|
|
1828
|
-
// const queriedIds = rBushNodes.map((node) => node.id);
|
|
1829
|
-
// const hitTestList: DisplayObject[] = [];
|
|
1830
|
-
// rBushNodes.forEach(({ id }) => {
|
|
1831
|
-
// const displayObject = this.displayObjectPool.getByEntity(id);
|
|
1832
|
-
// const { pointerEvents } = displayObject.parsedStyle as ParsedBaseStyleProps;
|
|
1833
|
-
// // account for `visibility`
|
|
1834
|
-
// // @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
1835
|
-
// const isVisibilityAffected = [
|
|
1836
|
-
// 'auto',
|
|
1837
|
-
// 'visiblepainted',
|
|
1838
|
-
// 'visiblefill',
|
|
1839
|
-
// 'visiblestroke',
|
|
1840
|
-
// 'visible',
|
|
1841
|
-
// ].includes(pointerEvents);
|
|
1842
|
-
// if (
|
|
1843
|
-
// (!isVisibilityAffected || (isVisibilityAffected && displayObject.isVisible())) &&
|
|
1844
|
-
// !displayObject.isCulled() &&
|
|
1845
|
-
// displayObject.isInteractive()
|
|
1846
|
-
// ) {
|
|
1847
|
-
// // parent is not included, eg. parent is clipped
|
|
1848
|
-
// if (
|
|
1849
|
-
// displayObject.parentNode &&
|
|
1850
|
-
// queriedIds.indexOf((displayObject.parentNode as Element).entity) === -1
|
|
1851
|
-
// ) {
|
|
1852
|
-
// return;
|
|
1853
|
-
// }
|
|
1854
|
-
// hitTestList.push(displayObject);
|
|
1855
|
-
// }
|
|
1856
|
-
// });
|
|
1857
|
-
// // find group with max z-index
|
|
1858
|
-
// hitTestList.sort((a, b) => b.sortable.renderOrder - a.sortable.renderOrder);
|
|
1859
|
-
// test with clip path & origin shape
|
|
1657
|
+
var hitTestList = document.elementsFromBBox(position[0], position[1], position[0], position[1]); // test with clip path & origin shape
|
|
1860
1658
|
// @see https://github.com/antvis/g/issues/1064
|
|
1861
1659
|
|
|
1862
1660
|
var pickedDisplayObjects = [];
|
|
@@ -1871,9 +1669,8 @@
|
|
|
1871
1669
|
var clipped = gLite.findClosestClipPathTarget(displayObject);
|
|
1872
1670
|
|
|
1873
1671
|
if (clipped) {
|
|
1874
|
-
var clipPath = clipped.
|
|
1875
|
-
|
|
1876
|
-
var isHitClipPath = this.isHit(clipPath, position, worldTransform);
|
|
1672
|
+
var clipPath = clipped.parsedStyle.clipPath;
|
|
1673
|
+
var isHitClipPath = this.isHit(clipPath, position, clipPath.getWorldTransform());
|
|
1877
1674
|
|
|
1878
1675
|
if (isHitClipPath) {
|
|
1879
1676
|
if (topmost) {
|
|
@@ -1899,10 +1696,9 @@
|
|
|
1899
1696
|
};
|
|
1900
1697
|
|
|
1901
1698
|
return CanvasPickerPlugin;
|
|
1902
|
-
}()
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
}), __param(0, gLite.inject(gLite.RenderingContext)), __param(1, gLite.inject(gLite.CanvasConfig)), __param(2, gLite.inject(gLite.OffscreenCanvasCreator)), __param(3, gLite.inject(PathGeneratorFactory)), __param(4, gLite.inject(PointInPathPickerFactory))], CanvasPickerPlugin);
|
|
1699
|
+
}();
|
|
1700
|
+
|
|
1701
|
+
CanvasPickerPlugin.tag = 'CanvasPicker';
|
|
1906
1702
|
/**
|
|
1907
1703
|
* 两点之间的距离
|
|
1908
1704
|
* @param {number} x1 起始点 x
|
|
@@ -2735,39 +2531,6 @@
|
|
|
2735
2531
|
return inLine(minX + tlr, minY, minX + width - trr, minY, lineWidth, x, y) || inLine(minX + width, minY + trr, minX + width, minY + height - brr, lineWidth, x, y) || inLine(minX + width - brr, minY + height, minX + blr, minY + height, lineWidth, x, y) || inLine(minX, minY + height - blr, minX, minY + tlr, lineWidth, x, y) || inArc(minX + width - trr, minY + trr, trr, 1.5 * Math.PI, 2 * Math.PI, lineWidth, x, y) || inArc(minX + width - brr, minY + height - brr, brr, 0, 0.5 * Math.PI, lineWidth, x, y) || inArc(minX + blr, minY + height - blr, blr, 0.5 * Math.PI, Math.PI, lineWidth, x, y) || inArc(minX + tlr, minY + tlr, tlr, Math.PI, 1.5 * Math.PI, lineWidth, x, y);
|
|
2736
2532
|
}
|
|
2737
2533
|
|
|
2738
|
-
var containerModule$1 = gLite.Module(function (register) {
|
|
2739
|
-
register({
|
|
2740
|
-
token: PointInPathPickerFactory,
|
|
2741
|
-
useFactory: function useFactory(context) {
|
|
2742
|
-
return function (tagName) {
|
|
2743
|
-
if (tagName === gLite.Shape.CIRCLE) {
|
|
2744
|
-
return isPointInPath;
|
|
2745
|
-
} else if (tagName === gLite.Shape.ELLIPSE) {
|
|
2746
|
-
return isPointInPath$1;
|
|
2747
|
-
} else if (tagName === gLite.Shape.RECT) {
|
|
2748
|
-
return isPointInPath$6;
|
|
2749
|
-
} else if (tagName === gLite.Shape.LINE) {
|
|
2750
|
-
return isPointInPath$2;
|
|
2751
|
-
} else if (tagName === gLite.Shape.POLYLINE) {
|
|
2752
|
-
return isPointInPath$5;
|
|
2753
|
-
} else if (tagName === gLite.Shape.POLYGON) {
|
|
2754
|
-
return isPointInPath$4;
|
|
2755
|
-
} else if (tagName === gLite.Shape.PATH) {
|
|
2756
|
-
return isPointInPath$3;
|
|
2757
|
-
} else if (tagName === gLite.Shape.IMAGE || tagName === gLite.Shape.TEXT // tagName === Shape.GROUP
|
|
2758
|
-
) {
|
|
2759
|
-
return function () {
|
|
2760
|
-
return true;
|
|
2761
|
-
};
|
|
2762
|
-
}
|
|
2763
|
-
|
|
2764
|
-
return null;
|
|
2765
|
-
};
|
|
2766
|
-
}
|
|
2767
|
-
});
|
|
2768
|
-
register(CanvasPickerPlugin);
|
|
2769
|
-
});
|
|
2770
|
-
|
|
2771
2534
|
var Plugin$1 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
2772
2535
|
_inheritsLoose$2(Plugin, _AbstractRendererPlug);
|
|
2773
2536
|
|
|
@@ -2786,11 +2549,22 @@
|
|
|
2786
2549
|
var _proto = Plugin.prototype;
|
|
2787
2550
|
|
|
2788
2551
|
_proto.init = function init() {
|
|
2789
|
-
|
|
2552
|
+
var _pointInPathPickerFac;
|
|
2553
|
+
|
|
2554
|
+
var trueFunc = function trueFunc() {
|
|
2555
|
+
return true;
|
|
2556
|
+
};
|
|
2557
|
+
|
|
2558
|
+
var pointInPathPickerFactory = (_pointInPathPickerFac = {}, _pointInPathPickerFac[gLite.Shape.CIRCLE] = isPointInPath, _pointInPathPickerFac[gLite.Shape.ELLIPSE] = isPointInPath$1, _pointInPathPickerFac[gLite.Shape.RECT] = isPointInPath$6, _pointInPathPickerFac[gLite.Shape.LINE] = isPointInPath$2, _pointInPathPickerFac[gLite.Shape.POLYLINE] = isPointInPath$5, _pointInPathPickerFac[gLite.Shape.POLYGON] = isPointInPath$4, _pointInPathPickerFac[gLite.Shape.PATH] = isPointInPath$3, _pointInPathPickerFac[gLite.Shape.TEXT] = trueFunc, _pointInPathPickerFac[gLite.Shape.GROUP] = null, _pointInPathPickerFac[gLite.Shape.IMAGE] = trueFunc, _pointInPathPickerFac[gLite.Shape.HTML] = null, _pointInPathPickerFac[gLite.Shape.MESH] = null, _pointInPathPickerFac); // @ts-ignore
|
|
2559
|
+
|
|
2560
|
+
this.context.pointInPathPickerFactory = pointInPathPickerFactory;
|
|
2561
|
+
this.addRenderingPlugin(new CanvasPickerPlugin());
|
|
2790
2562
|
};
|
|
2791
2563
|
|
|
2792
2564
|
_proto.destroy = function destroy() {
|
|
2793
|
-
|
|
2565
|
+
// @ts-ignore
|
|
2566
|
+
delete this.context.pointInPathPickerFactory;
|
|
2567
|
+
this.removeAllRenderingPlugins();
|
|
2794
2568
|
};
|
|
2795
2569
|
|
|
2796
2570
|
return Plugin;
|
|
@@ -3187,6 +2961,23 @@
|
|
|
3187
2961
|
};
|
|
3188
2962
|
}
|
|
3189
2963
|
|
|
2964
|
+
function _extends() {
|
|
2965
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
2966
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
2967
|
+
var source = arguments[i];
|
|
2968
|
+
|
|
2969
|
+
for (var key in source) {
|
|
2970
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2971
|
+
target[key] = source[key];
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
return target;
|
|
2977
|
+
};
|
|
2978
|
+
return _extends.apply(this, arguments);
|
|
2979
|
+
}
|
|
2980
|
+
|
|
3190
2981
|
function _inheritsLoose$3(subClass, superClass) {
|
|
3191
2982
|
subClass.prototype = Object.create(superClass.prototype);
|
|
3192
2983
|
subClass.prototype.constructor = subClass;
|
|
@@ -3201,1081 +2992,834 @@
|
|
|
3201
2992
|
};
|
|
3202
2993
|
return _setPrototypeOf$3(o, p);
|
|
3203
2994
|
}
|
|
2995
|
+
/**
|
|
2996
|
+
* Common utilities
|
|
2997
|
+
* @module glMatrix
|
|
2998
|
+
*/
|
|
3204
2999
|
|
|
3205
|
-
var ImagePool = /*#__PURE__*/function () {
|
|
3206
|
-
function ImagePool(canvasConfig) {
|
|
3207
|
-
this.canvasConfig = void 0;
|
|
3208
|
-
this.imageCache = {};
|
|
3209
|
-
this.gradientCache = {};
|
|
3210
|
-
this.patternCache = {};
|
|
3211
|
-
this.canvasConfig = canvasConfig;
|
|
3212
|
-
}
|
|
3213
3000
|
|
|
3214
|
-
|
|
3001
|
+
var ARRAY_TYPE$1 = typeof Float32Array !== 'undefined' ? Float32Array : Array;
|
|
3002
|
+
if (!Math.hypot) Math.hypot = function () {
|
|
3003
|
+
var y = 0,
|
|
3004
|
+
i = arguments.length;
|
|
3215
3005
|
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
if (callback) {
|
|
3220
|
-
callback();
|
|
3221
|
-
}
|
|
3222
|
-
});
|
|
3223
|
-
} else {
|
|
3224
|
-
if (callback) {
|
|
3225
|
-
callback();
|
|
3226
|
-
}
|
|
3227
|
-
}
|
|
3006
|
+
while (i--) {
|
|
3007
|
+
y += arguments[i] * arguments[i];
|
|
3008
|
+
}
|
|
3228
3009
|
|
|
3229
|
-
|
|
3230
|
-
|
|
3010
|
+
return Math.sqrt(y);
|
|
3011
|
+
};
|
|
3012
|
+
/**
|
|
3013
|
+
* 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
|
|
3014
|
+
* @module mat4
|
|
3015
|
+
*/
|
|
3231
3016
|
|
|
3232
|
-
|
|
3233
|
-
|
|
3017
|
+
/**
|
|
3018
|
+
* Creates a new identity mat4
|
|
3019
|
+
*
|
|
3020
|
+
* @returns {mat4} a new 4x4 matrix
|
|
3021
|
+
*/
|
|
3234
3022
|
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
} // @see https://github.com/antvis/g/issues/938
|
|
3023
|
+
function create$3() {
|
|
3024
|
+
var out = new ARRAY_TYPE$1(16);
|
|
3238
3025
|
|
|
3026
|
+
if (ARRAY_TYPE$1 != Float32Array) {
|
|
3027
|
+
out[1] = 0;
|
|
3028
|
+
out[2] = 0;
|
|
3029
|
+
out[3] = 0;
|
|
3030
|
+
out[4] = 0;
|
|
3031
|
+
out[6] = 0;
|
|
3032
|
+
out[7] = 0;
|
|
3033
|
+
out[8] = 0;
|
|
3034
|
+
out[9] = 0;
|
|
3035
|
+
out[11] = 0;
|
|
3036
|
+
out[12] = 0;
|
|
3037
|
+
out[13] = 0;
|
|
3038
|
+
out[14] = 0;
|
|
3039
|
+
}
|
|
3239
3040
|
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3041
|
+
out[0] = 1;
|
|
3042
|
+
out[5] = 1;
|
|
3043
|
+
out[10] = 1;
|
|
3044
|
+
out[15] = 1;
|
|
3045
|
+
return out;
|
|
3046
|
+
}
|
|
3047
|
+
/**
|
|
3048
|
+
* Copy the values from one mat4 to another
|
|
3049
|
+
*
|
|
3050
|
+
* @param {mat4} out the receiving matrix
|
|
3051
|
+
* @param {ReadonlyMat4} a the source matrix
|
|
3052
|
+
* @returns {mat4} out
|
|
3053
|
+
*/
|
|
3243
3054
|
|
|
3244
|
-
if (createImage) {
|
|
3245
|
-
image = createImage(src);
|
|
3246
|
-
} else if (gLite.isBrowser) {
|
|
3247
|
-
image = new window.Image();
|
|
3248
|
-
}
|
|
3249
3055
|
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3056
|
+
function copy(out, a) {
|
|
3057
|
+
out[0] = a[0];
|
|
3058
|
+
out[1] = a[1];
|
|
3059
|
+
out[2] = a[2];
|
|
3060
|
+
out[3] = a[3];
|
|
3061
|
+
out[4] = a[4];
|
|
3062
|
+
out[5] = a[5];
|
|
3063
|
+
out[6] = a[6];
|
|
3064
|
+
out[7] = a[7];
|
|
3065
|
+
out[8] = a[8];
|
|
3066
|
+
out[9] = a[9];
|
|
3067
|
+
out[10] = a[10];
|
|
3068
|
+
out[11] = a[11];
|
|
3069
|
+
out[12] = a[12];
|
|
3070
|
+
out[13] = a[13];
|
|
3071
|
+
out[14] = a[14];
|
|
3072
|
+
out[15] = a[15];
|
|
3073
|
+
return out;
|
|
3074
|
+
}
|
|
3075
|
+
/**
|
|
3076
|
+
* Multiplies two mat4s
|
|
3077
|
+
*
|
|
3078
|
+
* @param {mat4} out the receiving matrix
|
|
3079
|
+
* @param {ReadonlyMat4} a the first operand
|
|
3080
|
+
* @param {ReadonlyMat4} b the second operand
|
|
3081
|
+
* @returns {mat4} out
|
|
3082
|
+
*/
|
|
3254
3083
|
|
|
3255
|
-
image.onerror = function (ev) {
|
|
3256
|
-
reject(ev);
|
|
3257
|
-
};
|
|
3258
3084
|
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
if (isString(image)) {
|
|
3278
|
-
src = this.getImageSync(image, callback);
|
|
3279
|
-
} else {
|
|
3280
|
-
src = image;
|
|
3281
|
-
} // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createPattern
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
var canvasPattern = src && context.createPattern(src, repetition);
|
|
3285
|
-
|
|
3286
|
-
if (patternKey && canvasPattern) {
|
|
3287
|
-
this.patternCache[patternKey] = canvasPattern;
|
|
3288
|
-
}
|
|
3289
|
-
|
|
3290
|
-
return canvasPattern;
|
|
3291
|
-
};
|
|
3292
|
-
|
|
3293
|
-
_proto.getOrCreateGradient = function getOrCreateGradient(params, context) {
|
|
3294
|
-
var key = this.generateGradientKey(params);
|
|
3295
|
-
var type = params.type,
|
|
3296
|
-
steps = params.steps,
|
|
3297
|
-
width = params.width,
|
|
3298
|
-
height = params.height,
|
|
3299
|
-
angle = params.angle,
|
|
3300
|
-
cx = params.cx,
|
|
3301
|
-
cy = params.cy,
|
|
3302
|
-
size = params.size;
|
|
3303
|
-
|
|
3304
|
-
if (this.gradientCache[key]) {
|
|
3305
|
-
return this.gradientCache[key];
|
|
3306
|
-
}
|
|
3307
|
-
|
|
3308
|
-
var gradient = null;
|
|
3309
|
-
|
|
3310
|
-
if (type === gLite.GradientType.LinearGradient) {
|
|
3311
|
-
var _computeLinearGradien = gLite.computeLinearGradient(width, height, angle),
|
|
3312
|
-
x1 = _computeLinearGradien.x1,
|
|
3313
|
-
y1 = _computeLinearGradien.y1,
|
|
3314
|
-
x2 = _computeLinearGradien.x2,
|
|
3315
|
-
y2 = _computeLinearGradien.y2; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createLinearGradient
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
gradient = context.createLinearGradient(x1, y1, x2, y2);
|
|
3319
|
-
} else if (type === gLite.GradientType.RadialGradient) {
|
|
3320
|
-
var _computeRadialGradien = gLite.computeRadialGradient(width, height, cx, cy, size),
|
|
3321
|
-
x = _computeRadialGradien.x,
|
|
3322
|
-
y = _computeRadialGradien.y,
|
|
3323
|
-
r = _computeRadialGradien.r; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createRadialGradient
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
gradient = context.createRadialGradient(x, y, 0, x, y, r);
|
|
3327
|
-
}
|
|
3328
|
-
|
|
3329
|
-
if (gradient) {
|
|
3330
|
-
steps.forEach(function (_ref) {
|
|
3331
|
-
var offset = _ref.offset,
|
|
3332
|
-
color = _ref.color;
|
|
3333
|
-
|
|
3334
|
-
if (offset.unit === gLite.UnitType.kPercentage) {
|
|
3335
|
-
var _gradient;
|
|
3336
|
-
|
|
3337
|
-
(_gradient = gradient) === null || _gradient === void 0 ? void 0 : _gradient.addColorStop(offset.value / 100, color.toString());
|
|
3338
|
-
}
|
|
3339
|
-
});
|
|
3340
|
-
this.gradientCache[key] = gradient;
|
|
3341
|
-
}
|
|
3342
|
-
|
|
3343
|
-
return this.gradientCache[key];
|
|
3344
|
-
};
|
|
3345
|
-
|
|
3346
|
-
_proto.generateGradientKey = function generateGradientKey(params) {
|
|
3347
|
-
var type = params.type,
|
|
3348
|
-
width = params.width,
|
|
3349
|
-
height = params.height,
|
|
3350
|
-
steps = params.steps,
|
|
3351
|
-
angle = params.angle,
|
|
3352
|
-
cx = params.cx,
|
|
3353
|
-
cy = params.cy,
|
|
3354
|
-
size = params.size;
|
|
3355
|
-
return "gradient-" + type + "-" + ((angle === null || angle === void 0 ? void 0 : angle.toString()) || 0) + "-" + ((cx === null || cx === void 0 ? void 0 : cx.toString()) || 0) + "-" + ((cy === null || cy === void 0 ? void 0 : cy.toString()) || 0) + "-" + ((size === null || size === void 0 ? void 0 : size.toString()) || 0) + "-" + width + "-" + height + "-" + steps.map(function (_ref2) {
|
|
3356
|
-
var offset = _ref2.offset,
|
|
3357
|
-
color = _ref2.color;
|
|
3358
|
-
return "" + offset + color;
|
|
3359
|
-
}).join('-');
|
|
3360
|
-
};
|
|
3361
|
-
|
|
3362
|
-
_proto.generatePatternKey = function generatePatternKey(pattern) {
|
|
3363
|
-
var image = pattern.image,
|
|
3364
|
-
repetition = pattern.repetition; // only generate cache for Image
|
|
3365
|
-
|
|
3366
|
-
if (isString(image)) {
|
|
3367
|
-
return "pattern-" + image + "-" + repetition;
|
|
3368
|
-
}
|
|
3369
|
-
};
|
|
3370
|
-
|
|
3371
|
-
return ImagePool;
|
|
3372
|
-
}();
|
|
3373
|
-
|
|
3374
|
-
ImagePool = __decorate([gLite.singleton(), __param(0, gLite.inject(gLite.CanvasConfig))], ImagePool);
|
|
3375
|
-
|
|
3376
|
-
var _class$1;
|
|
3377
|
-
|
|
3378
|
-
var LoadImagePlugin_1;
|
|
3379
|
-
var LoadImagePlugin = LoadImagePlugin_1 = (_class$1 = /*#__PURE__*/function () {
|
|
3380
|
-
function LoadImagePlugin(imagePool, renderingContext) {
|
|
3381
|
-
this.imagePool = void 0;
|
|
3382
|
-
this.renderingContext = void 0;
|
|
3383
|
-
this.imagePool = imagePool;
|
|
3384
|
-
this.renderingContext = renderingContext;
|
|
3385
|
-
}
|
|
3386
|
-
|
|
3387
|
-
var _proto = LoadImagePlugin.prototype;
|
|
3388
|
-
|
|
3389
|
-
_proto.apply = function apply(renderingService) {
|
|
3390
|
-
var _this = this;
|
|
3391
|
-
|
|
3392
|
-
var handleMounted = function handleMounted(e) {
|
|
3393
|
-
var object = e.target;
|
|
3394
|
-
var nodeName = object.nodeName,
|
|
3395
|
-
attributes = object.attributes;
|
|
3396
|
-
|
|
3397
|
-
if (nodeName === gLite.Shape.IMAGE) {
|
|
3398
|
-
var img = attributes.img;
|
|
3399
|
-
|
|
3400
|
-
if (isString(img)) {
|
|
3401
|
-
_this.imagePool.getImageSync(img, function () {
|
|
3402
|
-
// set dirty rectangle flag
|
|
3403
|
-
object.renderable.dirty = true;
|
|
3404
|
-
renderingService.dirtify();
|
|
3405
|
-
});
|
|
3406
|
-
}
|
|
3407
|
-
}
|
|
3408
|
-
};
|
|
3409
|
-
|
|
3410
|
-
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
3411
|
-
var object = e.target;
|
|
3412
|
-
var attrName = e.attrName,
|
|
3413
|
-
newValue = e.newValue;
|
|
3414
|
-
|
|
3415
|
-
if (object.nodeName === gLite.Shape.IMAGE) {
|
|
3416
|
-
if (attrName === 'img') {
|
|
3417
|
-
if (isString(newValue)) {
|
|
3418
|
-
_this.imagePool.getOrCreateImage(newValue).then(function () {
|
|
3419
|
-
// set dirty rectangle flag
|
|
3420
|
-
object.renderable.dirty = true;
|
|
3421
|
-
renderingService.dirtify();
|
|
3422
|
-
});
|
|
3423
|
-
}
|
|
3424
|
-
}
|
|
3425
|
-
}
|
|
3426
|
-
};
|
|
3427
|
-
|
|
3428
|
-
renderingService.hooks.init.tapPromise(LoadImagePlugin_1.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
3429
|
-
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
3430
|
-
while (1) {
|
|
3431
|
-
switch (_context.prev = _context.next) {
|
|
3432
|
-
case 0:
|
|
3433
|
-
_this.renderingContext.root.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
3434
|
-
|
|
3435
|
-
_this.renderingContext.root.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
3436
|
-
|
|
3437
|
-
case 2:
|
|
3438
|
-
case "end":
|
|
3439
|
-
return _context.stop();
|
|
3440
|
-
}
|
|
3441
|
-
}
|
|
3442
|
-
}, _callee);
|
|
3443
|
-
})));
|
|
3444
|
-
renderingService.hooks.destroy.tap(LoadImagePlugin_1.tag, function () {
|
|
3445
|
-
_this.renderingContext.root.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
3446
|
-
|
|
3447
|
-
_this.renderingContext.root.removeEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
3448
|
-
});
|
|
3449
|
-
};
|
|
3450
|
-
|
|
3451
|
-
return LoadImagePlugin;
|
|
3452
|
-
}(), _class$1.tag = 'LoadImage', _class$1);
|
|
3453
|
-
LoadImagePlugin = LoadImagePlugin_1 = __decorate([gLite.singleton({
|
|
3454
|
-
contrib: gLite.RenderingPluginContribution
|
|
3455
|
-
}), __param(0, gLite.inject(ImagePool)), __param(1, gLite.inject(gLite.RenderingContext))], LoadImagePlugin);
|
|
3456
|
-
var containerModule$2 = gLite.Module(function (register) {
|
|
3457
|
-
register(ImagePool);
|
|
3458
|
-
register(LoadImagePlugin);
|
|
3459
|
-
});
|
|
3460
|
-
|
|
3461
|
-
var Plugin$2 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
3462
|
-
_inheritsLoose$3(Plugin, _AbstractRendererPlug);
|
|
3463
|
-
|
|
3464
|
-
function Plugin() {
|
|
3465
|
-
var _this;
|
|
3466
|
-
|
|
3467
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3468
|
-
args[_key] = arguments[_key];
|
|
3469
|
-
}
|
|
3470
|
-
|
|
3471
|
-
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
3472
|
-
_this.name = 'image-loader';
|
|
3473
|
-
return _this;
|
|
3474
|
-
}
|
|
3475
|
-
|
|
3476
|
-
var _proto = Plugin.prototype;
|
|
3477
|
-
|
|
3478
|
-
_proto.init = function init() {
|
|
3479
|
-
this.container.load(containerModule$2, true);
|
|
3480
|
-
};
|
|
3481
|
-
|
|
3482
|
-
_proto.destroy = function destroy() {
|
|
3483
|
-
this.container.unload(containerModule$2);
|
|
3484
|
-
};
|
|
3485
|
-
|
|
3486
|
-
return Plugin;
|
|
3487
|
-
}(gLite.AbstractRendererPlugin);
|
|
3488
|
-
|
|
3489
|
-
var index_esm$2 = /*#__PURE__*/Object.freeze({
|
|
3490
|
-
__proto__: null,
|
|
3491
|
-
get ImagePool () { return ImagePool; },
|
|
3492
|
-
Plugin: Plugin$2
|
|
3493
|
-
});
|
|
3494
|
-
|
|
3495
|
-
function _regeneratorRuntime$3() {
|
|
3496
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3497
|
-
_regeneratorRuntime$3 = function _regeneratorRuntime() {
|
|
3498
|
-
return exports;
|
|
3499
|
-
};
|
|
3500
|
-
|
|
3501
|
-
var exports = {},
|
|
3502
|
-
Op = Object.prototype,
|
|
3503
|
-
hasOwn = Op.hasOwnProperty,
|
|
3504
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
3505
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
3506
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
3507
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
3508
|
-
|
|
3509
|
-
function define(obj, key, value) {
|
|
3510
|
-
return Object.defineProperty(obj, key, {
|
|
3511
|
-
value: value,
|
|
3512
|
-
enumerable: !0,
|
|
3513
|
-
configurable: !0,
|
|
3514
|
-
writable: !0
|
|
3515
|
-
}), obj[key];
|
|
3516
|
-
}
|
|
3517
|
-
|
|
3518
|
-
try {
|
|
3519
|
-
define({}, "");
|
|
3520
|
-
} catch (err) {
|
|
3521
|
-
define = function define(obj, key, value) {
|
|
3522
|
-
return obj[key] = value;
|
|
3523
|
-
};
|
|
3524
|
-
}
|
|
3525
|
-
|
|
3526
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
3527
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
3528
|
-
generator = Object.create(protoGenerator.prototype),
|
|
3529
|
-
context = new Context(tryLocsList || []);
|
|
3530
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
3531
|
-
var state = "suspendedStart";
|
|
3532
|
-
return function (method, arg) {
|
|
3533
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
3534
|
-
|
|
3535
|
-
if ("completed" === state) {
|
|
3536
|
-
if ("throw" === method) throw arg;
|
|
3537
|
-
return doneResult();
|
|
3538
|
-
}
|
|
3539
|
-
|
|
3540
|
-
for (context.method = method, context.arg = arg;;) {
|
|
3541
|
-
var delegate = context.delegate;
|
|
3542
|
-
|
|
3543
|
-
if (delegate) {
|
|
3544
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
3085
|
+
function multiply(out, a, b) {
|
|
3086
|
+
var a00 = a[0],
|
|
3087
|
+
a01 = a[1],
|
|
3088
|
+
a02 = a[2],
|
|
3089
|
+
a03 = a[3];
|
|
3090
|
+
var a10 = a[4],
|
|
3091
|
+
a11 = a[5],
|
|
3092
|
+
a12 = a[6],
|
|
3093
|
+
a13 = a[7];
|
|
3094
|
+
var a20 = a[8],
|
|
3095
|
+
a21 = a[9],
|
|
3096
|
+
a22 = a[10],
|
|
3097
|
+
a23 = a[11];
|
|
3098
|
+
var a30 = a[12],
|
|
3099
|
+
a31 = a[13],
|
|
3100
|
+
a32 = a[14],
|
|
3101
|
+
a33 = a[15]; // Cache only the current line of the second matrix
|
|
3545
3102
|
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3103
|
+
var b0 = b[0],
|
|
3104
|
+
b1 = b[1],
|
|
3105
|
+
b2 = b[2],
|
|
3106
|
+
b3 = b[3];
|
|
3107
|
+
out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
3108
|
+
out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
3109
|
+
out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
3110
|
+
out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
3111
|
+
b0 = b[4];
|
|
3112
|
+
b1 = b[5];
|
|
3113
|
+
b2 = b[6];
|
|
3114
|
+
b3 = b[7];
|
|
3115
|
+
out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
3116
|
+
out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
3117
|
+
out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
3118
|
+
out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
3119
|
+
b0 = b[8];
|
|
3120
|
+
b1 = b[9];
|
|
3121
|
+
b2 = b[10];
|
|
3122
|
+
b3 = b[11];
|
|
3123
|
+
out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
3124
|
+
out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
3125
|
+
out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
3126
|
+
out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
3127
|
+
b0 = b[12];
|
|
3128
|
+
b1 = b[13];
|
|
3129
|
+
b2 = b[14];
|
|
3130
|
+
b3 = b[15];
|
|
3131
|
+
out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
3132
|
+
out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
3133
|
+
out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
3134
|
+
out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
3135
|
+
return out;
|
|
3136
|
+
}
|
|
3137
|
+
/**
|
|
3138
|
+
* Translate a mat4 by the given vector
|
|
3139
|
+
*
|
|
3140
|
+
* @param {mat4} out the receiving matrix
|
|
3141
|
+
* @param {ReadonlyMat4} a the matrix to translate
|
|
3142
|
+
* @param {ReadonlyVec3} v vector to translate by
|
|
3143
|
+
* @returns {mat4} out
|
|
3144
|
+
*/
|
|
3551
3145
|
|
|
3552
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
3553
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
3554
|
-
context.dispatchException(context.arg);
|
|
3555
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
3556
|
-
state = "executing";
|
|
3557
|
-
var record = tryCatch(innerFn, self, context);
|
|
3558
3146
|
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3147
|
+
function translate(out, a, v) {
|
|
3148
|
+
var x = v[0],
|
|
3149
|
+
y = v[1],
|
|
3150
|
+
z = v[2];
|
|
3151
|
+
var a00, a01, a02, a03;
|
|
3152
|
+
var a10, a11, a12, a13;
|
|
3153
|
+
var a20, a21, a22, a23;
|
|
3566
3154
|
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3155
|
+
if (a === out) {
|
|
3156
|
+
out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
|
|
3157
|
+
out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
|
|
3158
|
+
out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
|
|
3159
|
+
out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
|
|
3160
|
+
} else {
|
|
3161
|
+
a00 = a[0];
|
|
3162
|
+
a01 = a[1];
|
|
3163
|
+
a02 = a[2];
|
|
3164
|
+
a03 = a[3];
|
|
3165
|
+
a10 = a[4];
|
|
3166
|
+
a11 = a[5];
|
|
3167
|
+
a12 = a[6];
|
|
3168
|
+
a13 = a[7];
|
|
3169
|
+
a20 = a[8];
|
|
3170
|
+
a21 = a[9];
|
|
3171
|
+
a22 = a[10];
|
|
3172
|
+
a23 = a[11];
|
|
3173
|
+
out[0] = a00;
|
|
3174
|
+
out[1] = a01;
|
|
3175
|
+
out[2] = a02;
|
|
3176
|
+
out[3] = a03;
|
|
3177
|
+
out[4] = a10;
|
|
3178
|
+
out[5] = a11;
|
|
3179
|
+
out[6] = a12;
|
|
3180
|
+
out[7] = a13;
|
|
3181
|
+
out[8] = a20;
|
|
3182
|
+
out[9] = a21;
|
|
3183
|
+
out[10] = a22;
|
|
3184
|
+
out[11] = a23;
|
|
3185
|
+
out[12] = a00 * x + a10 * y + a20 * z + a[12];
|
|
3186
|
+
out[13] = a01 * x + a11 * y + a21 * z + a[13];
|
|
3187
|
+
out[14] = a02 * x + a12 * y + a22 * z + a[14];
|
|
3188
|
+
out[15] = a03 * x + a13 * y + a23 * z + a[15];
|
|
3571
3189
|
}
|
|
3572
3190
|
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3191
|
+
return out;
|
|
3192
|
+
}
|
|
3193
|
+
/**
|
|
3194
|
+
* Creates a matrix from a vector scaling
|
|
3195
|
+
* This is equivalent to (but much faster than):
|
|
3196
|
+
*
|
|
3197
|
+
* mat4.identity(dest);
|
|
3198
|
+
* mat4.scale(dest, dest, vec);
|
|
3199
|
+
*
|
|
3200
|
+
* @param {mat4} out mat4 receiving operation result
|
|
3201
|
+
* @param {ReadonlyVec3} v Scaling vector
|
|
3202
|
+
* @returns {mat4} out
|
|
3203
|
+
*/
|
|
3586
3204
|
|
|
3587
|
-
exports.wrap = wrap;
|
|
3588
|
-
var ContinueSentinel = {};
|
|
3589
3205
|
|
|
3590
|
-
|
|
3206
|
+
function fromScaling(out, v) {
|
|
3207
|
+
out[0] = v[0];
|
|
3208
|
+
out[1] = 0;
|
|
3209
|
+
out[2] = 0;
|
|
3210
|
+
out[3] = 0;
|
|
3211
|
+
out[4] = 0;
|
|
3212
|
+
out[5] = v[1];
|
|
3213
|
+
out[6] = 0;
|
|
3214
|
+
out[7] = 0;
|
|
3215
|
+
out[8] = 0;
|
|
3216
|
+
out[9] = 0;
|
|
3217
|
+
out[10] = v[2];
|
|
3218
|
+
out[11] = 0;
|
|
3219
|
+
out[12] = 0;
|
|
3220
|
+
out[13] = 0;
|
|
3221
|
+
out[14] = 0;
|
|
3222
|
+
out[15] = 1;
|
|
3223
|
+
return out;
|
|
3224
|
+
}
|
|
3225
|
+
/**
|
|
3226
|
+
* 3 Dimensional Vector
|
|
3227
|
+
* @module vec3
|
|
3228
|
+
*/
|
|
3591
3229
|
|
|
3592
|
-
|
|
3230
|
+
/**
|
|
3231
|
+
* Creates a new, empty vec3
|
|
3232
|
+
*
|
|
3233
|
+
* @returns {vec3} a new 3D vector
|
|
3234
|
+
*/
|
|
3593
3235
|
|
|
3594
|
-
function GeneratorFunctionPrototype() {}
|
|
3595
3236
|
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
return this;
|
|
3599
|
-
});
|
|
3600
|
-
var getProto = Object.getPrototypeOf,
|
|
3601
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
3602
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
3603
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
3237
|
+
function create$1$1() {
|
|
3238
|
+
var out = new ARRAY_TYPE$1(3);
|
|
3604
3239
|
|
|
3605
|
-
|
|
3606
|
-
[
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
});
|
|
3610
|
-
});
|
|
3240
|
+
if (ARRAY_TYPE$1 != Float32Array) {
|
|
3241
|
+
out[0] = 0;
|
|
3242
|
+
out[1] = 0;
|
|
3243
|
+
out[2] = 0;
|
|
3611
3244
|
}
|
|
3612
3245
|
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3246
|
+
return out;
|
|
3247
|
+
}
|
|
3248
|
+
/**
|
|
3249
|
+
* Creates a new vec3 initialized with the given values
|
|
3250
|
+
*
|
|
3251
|
+
* @param {Number} x X component
|
|
3252
|
+
* @param {Number} y Y component
|
|
3253
|
+
* @param {Number} z Z component
|
|
3254
|
+
* @returns {vec3} a new 3D vector
|
|
3255
|
+
*/
|
|
3616
3256
|
|
|
3617
|
-
if ("throw" !== record.type) {
|
|
3618
|
-
var result = record.arg,
|
|
3619
|
-
value = result.value;
|
|
3620
|
-
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
3621
|
-
invoke("next", value, resolve, reject);
|
|
3622
|
-
}, function (err) {
|
|
3623
|
-
invoke("throw", err, resolve, reject);
|
|
3624
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
3625
|
-
result.value = unwrapped, resolve(result);
|
|
3626
|
-
}, function (error) {
|
|
3627
|
-
return invoke("throw", error, resolve, reject);
|
|
3628
|
-
});
|
|
3629
|
-
}
|
|
3630
3257
|
|
|
3631
|
-
|
|
3632
|
-
|
|
3258
|
+
function fromValues(x, y, z) {
|
|
3259
|
+
var out = new ARRAY_TYPE$1(3);
|
|
3260
|
+
out[0] = x;
|
|
3261
|
+
out[1] = y;
|
|
3262
|
+
out[2] = z;
|
|
3263
|
+
return out;
|
|
3264
|
+
}
|
|
3265
|
+
/**
|
|
3266
|
+
* Transforms the vec3 with a mat4.
|
|
3267
|
+
* 4th vector component is implicitly '1'
|
|
3268
|
+
*
|
|
3269
|
+
* @param {vec3} out the receiving vector
|
|
3270
|
+
* @param {ReadonlyVec3} a the vector to transform
|
|
3271
|
+
* @param {ReadonlyMat4} m matrix to transform with
|
|
3272
|
+
* @returns {vec3} out
|
|
3273
|
+
*/
|
|
3633
3274
|
|
|
3634
|
-
var previousPromise;
|
|
3635
3275
|
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3276
|
+
function transformMat4$1(out, a, m) {
|
|
3277
|
+
var x = a[0],
|
|
3278
|
+
y = a[1],
|
|
3279
|
+
z = a[2];
|
|
3280
|
+
var w = m[3] * x + m[7] * y + m[11] * z + m[15];
|
|
3281
|
+
w = w || 1.0;
|
|
3282
|
+
out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
|
|
3283
|
+
out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
|
|
3284
|
+
out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
|
|
3285
|
+
return out;
|
|
3286
|
+
}
|
|
3287
|
+
/**
|
|
3288
|
+
* Perform some operation over an array of vec3s.
|
|
3289
|
+
*
|
|
3290
|
+
* @param {Array} a the array of vectors to iterate over
|
|
3291
|
+
* @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
|
|
3292
|
+
* @param {Number} offset Number of elements to skip at the beginning of the array
|
|
3293
|
+
* @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
|
|
3294
|
+
* @param {Function} fn Function to call for each vector in the array
|
|
3295
|
+
* @param {Object} [arg] additional argument to pass to fn
|
|
3296
|
+
* @returns {Array} a
|
|
3297
|
+
* @function
|
|
3298
|
+
*/
|
|
3642
3299
|
|
|
3643
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
3644
|
-
};
|
|
3645
|
-
}
|
|
3646
3300
|
|
|
3647
|
-
|
|
3648
|
-
|
|
3301
|
+
var forEach$2 = function () {
|
|
3302
|
+
var vec = create$1$1();
|
|
3303
|
+
return function (a, stride, offset, count, fn, arg) {
|
|
3304
|
+
var i, l;
|
|
3649
3305
|
|
|
3650
|
-
if (
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
3654
|
-
}
|
|
3306
|
+
if (!stride) {
|
|
3307
|
+
stride = 3;
|
|
3308
|
+
}
|
|
3655
3309
|
|
|
3656
|
-
|
|
3310
|
+
if (!offset) {
|
|
3311
|
+
offset = 0;
|
|
3657
3312
|
}
|
|
3658
3313
|
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3314
|
+
if (count) {
|
|
3315
|
+
l = Math.min(count * stride + offset, a.length);
|
|
3316
|
+
} else {
|
|
3317
|
+
l = a.length;
|
|
3318
|
+
}
|
|
3664
3319
|
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3320
|
+
for (i = offset; i < l; i += stride) {
|
|
3321
|
+
vec[0] = a[i];
|
|
3322
|
+
vec[1] = a[i + 1];
|
|
3323
|
+
vec[2] = a[i + 2];
|
|
3324
|
+
fn(vec, vec, arg);
|
|
3325
|
+
a[i] = vec[0];
|
|
3326
|
+
a[i + 1] = vec[1];
|
|
3327
|
+
a[i + 2] = vec[2];
|
|
3328
|
+
}
|
|
3671
3329
|
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3330
|
+
return a;
|
|
3331
|
+
};
|
|
3332
|
+
}();
|
|
3333
|
+
/**
|
|
3334
|
+
* support 2 modes in rendering:
|
|
3335
|
+
* * immediate
|
|
3336
|
+
* * delayed: render at the end of frame with dirty-rectangle
|
|
3337
|
+
*/
|
|
3676
3338
|
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3339
|
+
|
|
3340
|
+
var CanvasRendererPlugin = /*#__PURE__*/function () {
|
|
3341
|
+
/**
|
|
3342
|
+
* RBush used in dirty rectangle rendering
|
|
3343
|
+
*/
|
|
3344
|
+
function CanvasRendererPlugin(canvasRendererPluginOptions) {
|
|
3345
|
+
this.canvasRendererPluginOptions = void 0;
|
|
3346
|
+
this.context = void 0;
|
|
3347
|
+
this.pathGeneratorFactory = void 0;
|
|
3348
|
+
this.rBush = void 0;
|
|
3349
|
+
this.removedRBushNodeAABBs = [];
|
|
3350
|
+
this.renderQueue = [];
|
|
3351
|
+
this.restoreStack = [];
|
|
3352
|
+
this.clearFullScreen = false;
|
|
3353
|
+
this.vpMatrix = create$3();
|
|
3354
|
+
this.dprMatrix = create$3();
|
|
3355
|
+
this.tmpMat4 = create$3();
|
|
3356
|
+
this.vec3a = create$1$1();
|
|
3357
|
+
this.vec3b = create$1$1();
|
|
3358
|
+
this.vec3c = create$1$1();
|
|
3359
|
+
this.vec3d = create$1$1();
|
|
3360
|
+
this.canvasRendererPluginOptions = canvasRendererPluginOptions;
|
|
3681
3361
|
}
|
|
3682
3362
|
|
|
3683
|
-
|
|
3684
|
-
if (iterable) {
|
|
3685
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
3686
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
3687
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
3363
|
+
var _proto = CanvasRendererPlugin.prototype;
|
|
3688
3364
|
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
3694
|
-
}
|
|
3365
|
+
_proto.apply = function apply(context) {
|
|
3366
|
+
var _this = this;
|
|
3367
|
+
|
|
3368
|
+
this.context = context; // @ts-ignore
|
|
3695
3369
|
|
|
3696
|
-
|
|
3697
|
-
|
|
3370
|
+
var config = context.config,
|
|
3371
|
+
camera = context.camera,
|
|
3372
|
+
renderingService = context.renderingService,
|
|
3373
|
+
renderingContext = context.renderingContext,
|
|
3374
|
+
rBushRoot = context.rBushRoot,
|
|
3375
|
+
pathGeneratorFactory = context.pathGeneratorFactory;
|
|
3376
|
+
this.rBush = rBushRoot;
|
|
3377
|
+
this.pathGeneratorFactory = pathGeneratorFactory;
|
|
3378
|
+
var contextService = context.contextService;
|
|
3379
|
+
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
3698
3380
|
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3381
|
+
var handleUnmounted = function handleUnmounted(e) {
|
|
3382
|
+
var object = e.target; // remove r-bush node
|
|
3383
|
+
// @ts-ignore
|
|
3702
3384
|
|
|
3703
|
-
|
|
3704
|
-
next: doneResult
|
|
3705
|
-
};
|
|
3706
|
-
}
|
|
3385
|
+
var rBushNode = object.rBushNode;
|
|
3707
3386
|
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3387
|
+
if (rBushNode.aabb) {
|
|
3388
|
+
// save removed aabbs for dirty-rectangle rendering later
|
|
3389
|
+
_this.removedRBushNodeAABBs.push(rBushNode.aabb);
|
|
3390
|
+
}
|
|
3712
3391
|
};
|
|
3713
|
-
}
|
|
3714
3392
|
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
3718
|
-
}, exports.mark = function (genFun) {
|
|
3719
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
3720
|
-
}, exports.awrap = function (arg) {
|
|
3721
|
-
return {
|
|
3722
|
-
__await: arg
|
|
3723
|
-
};
|
|
3724
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
3725
|
-
return this;
|
|
3726
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
3727
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
3728
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
3729
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
3730
|
-
return result.done ? result.value : iter.next();
|
|
3731
|
-
});
|
|
3732
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
3733
|
-
return this;
|
|
3734
|
-
}), define(Gp, "toString", function () {
|
|
3735
|
-
return "[object Generator]";
|
|
3736
|
-
}), exports.keys = function (object) {
|
|
3737
|
-
var keys = [];
|
|
3393
|
+
var handleCulled = function handleCulled(e) {
|
|
3394
|
+
var object = e.target; // @ts-ignore
|
|
3738
3395
|
|
|
3739
|
-
|
|
3740
|
-
keys.push(key);
|
|
3741
|
-
}
|
|
3396
|
+
var rBushNode = object.rBushNode;
|
|
3742
3397
|
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
3398
|
+
if (rBushNode.aabb) {
|
|
3399
|
+
// save removed aabbs for dirty-rectangle rendering later
|
|
3400
|
+
_this.removedRBushNodeAABBs.push(rBushNode.aabb);
|
|
3747
3401
|
}
|
|
3748
|
-
|
|
3749
|
-
return next.done = !0, next;
|
|
3750
3402
|
};
|
|
3751
|
-
}, exports.values = values, Context.prototype = {
|
|
3752
|
-
constructor: Context,
|
|
3753
|
-
reset: function reset(skipTempReset) {
|
|
3754
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
|
|
3755
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
3756
|
-
}
|
|
3757
|
-
},
|
|
3758
|
-
stop: function stop() {
|
|
3759
|
-
this.done = !0;
|
|
3760
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
3761
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
3762
|
-
return this.rval;
|
|
3763
|
-
},
|
|
3764
|
-
dispatchException: function dispatchException(exception) {
|
|
3765
|
-
if (this.done) throw exception;
|
|
3766
|
-
var context = this;
|
|
3767
3403
|
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3404
|
+
renderingService.hooks.init.tapPromise(CanvasRendererPlugin.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
3405
|
+
var dpr, width, height, context;
|
|
3406
|
+
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
3407
|
+
while (1) {
|
|
3408
|
+
switch (_context.prev = _context.next) {
|
|
3409
|
+
case 0:
|
|
3410
|
+
renderingContext.root.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
3411
|
+
renderingContext.root.addEventListener(gLite.ElementEvent.CULLED, handleCulled); // clear fullscreen
|
|
3771
3412
|
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
3413
|
+
dpr = contextService.getDPR();
|
|
3414
|
+
width = config.width, height = config.height;
|
|
3415
|
+
context = contextService.getContext();
|
|
3776
3416
|
|
|
3777
|
-
|
|
3778
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
3779
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
3417
|
+
_this.clearRect(context, 0, 0, width * dpr, height * dpr, config.background);
|
|
3780
3418
|
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
} else if (hasCatch) {
|
|
3785
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
3786
|
-
} else {
|
|
3787
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
3788
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
3419
|
+
case 6:
|
|
3420
|
+
case "end":
|
|
3421
|
+
return _context.stop();
|
|
3789
3422
|
}
|
|
3790
3423
|
}
|
|
3791
|
-
}
|
|
3792
|
-
}
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3424
|
+
}, _callee);
|
|
3425
|
+
})));
|
|
3426
|
+
renderingService.hooks.destroy.tap(CanvasRendererPlugin.tag, function () {
|
|
3427
|
+
renderingContext.root.removeEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
3428
|
+
renderingContext.root.removeEventListener(gLite.ElementEvent.CULLED, handleCulled);
|
|
3429
|
+
});
|
|
3430
|
+
renderingService.hooks.beginFrame.tap(CanvasRendererPlugin.tag, function () {
|
|
3431
|
+
var context = contextService.getContext();
|
|
3432
|
+
var dpr = contextService.getDPR();
|
|
3433
|
+
var width = config.width,
|
|
3434
|
+
height = config.height;
|
|
3435
|
+
var _this$canvasRendererP = _this.canvasRendererPluginOptions,
|
|
3436
|
+
dirtyObjectNumThreshold = _this$canvasRendererP.dirtyObjectNumThreshold,
|
|
3437
|
+
dirtyObjectRatioThreshold = _this$canvasRendererP.dirtyObjectRatioThreshold; // some heuristic conditions such as 80% object changed
|
|
3796
3438
|
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3439
|
+
var _renderingService$get = renderingService.getStats(),
|
|
3440
|
+
total = _renderingService$get.total,
|
|
3441
|
+
rendered = _renderingService$get.rendered;
|
|
3442
|
+
|
|
3443
|
+
var ratio = rendered / total;
|
|
3444
|
+
_this.clearFullScreen = renderingService.disableDirtyRectangleRendering() || rendered > dirtyObjectNumThreshold && ratio > dirtyObjectRatioThreshold;
|
|
3445
|
+
|
|
3446
|
+
if (context) {
|
|
3447
|
+
context.resetTransform();
|
|
3448
|
+
|
|
3449
|
+
if (_this.clearFullScreen) {
|
|
3450
|
+
_this.clearRect(context, 0, 0, width * dpr, height * dpr, config.background);
|
|
3800
3451
|
}
|
|
3801
3452
|
}
|
|
3453
|
+
});
|
|
3802
3454
|
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
3810
|
-
},
|
|
3811
|
-
finish: function finish(finallyLoc) {
|
|
3812
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3813
|
-
var entry = this.tryEntries[i];
|
|
3814
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
3455
|
+
var renderByZIndex = function renderByZIndex(object) {
|
|
3456
|
+
if (object.isVisible() && !object.isCulled()) {
|
|
3457
|
+
_this.renderDisplayObject(object, contextService, renderingService); // if we did a full screen rendering last frame
|
|
3458
|
+
|
|
3459
|
+
|
|
3460
|
+
_this.saveDirtyAABB(object);
|
|
3815
3461
|
}
|
|
3816
|
-
},
|
|
3817
|
-
catch: function _catch(tryLoc) {
|
|
3818
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3819
|
-
var entry = this.tryEntries[i];
|
|
3820
3462
|
|
|
3821
|
-
|
|
3822
|
-
var record = entry.completion;
|
|
3463
|
+
var sorted = object.sortable.sorted || object.childNodes; // should account for z-index
|
|
3823
3464
|
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3465
|
+
sorted.forEach(function (child) {
|
|
3466
|
+
renderByZIndex(child);
|
|
3467
|
+
});
|
|
3468
|
+
}; // render at the end of frame
|
|
3828
3469
|
|
|
3829
|
-
|
|
3470
|
+
|
|
3471
|
+
renderingService.hooks.endFrame.tap(CanvasRendererPlugin.tag, function () {
|
|
3472
|
+
var context = contextService.getContext(); // clear & clip dirty rectangle
|
|
3473
|
+
|
|
3474
|
+
var dpr = contextService.getDPR();
|
|
3475
|
+
fromScaling(_this.dprMatrix, fromValues(dpr, dpr, 1));
|
|
3476
|
+
multiply(_this.vpMatrix, _this.dprMatrix, camera.getOrthoMatrix());
|
|
3477
|
+
|
|
3478
|
+
if (_this.clearFullScreen) {
|
|
3479
|
+
renderByZIndex(renderingContext.root);
|
|
3480
|
+
} else {
|
|
3481
|
+
// merge removed AABB
|
|
3482
|
+
var dirtyRenderBounds = _this.safeMergeAABB.apply(_this, [_this.mergeDirtyAABBs(_this.renderQueue)].concat(_this.removedRBushNodeAABBs.map(function (_ref2) {
|
|
3483
|
+
var minX = _ref2.minX,
|
|
3484
|
+
minY = _ref2.minY,
|
|
3485
|
+
maxX = _ref2.maxX,
|
|
3486
|
+
maxY = _ref2.maxY;
|
|
3487
|
+
var aabb = new gLite.AABB();
|
|
3488
|
+
aabb.setMinMax(fromValues(minX, minY, 0), fromValues(maxX, maxY, 0));
|
|
3489
|
+
return aabb;
|
|
3490
|
+
})));
|
|
3491
|
+
|
|
3492
|
+
_this.removedRBushNodeAABBs = [];
|
|
3493
|
+
|
|
3494
|
+
if (gLite.AABB.isEmpty(dirtyRenderBounds)) {
|
|
3495
|
+
_this.renderQueue = [];
|
|
3496
|
+
return;
|
|
3830
3497
|
}
|
|
3831
|
-
}
|
|
3832
3498
|
|
|
3833
|
-
|
|
3834
|
-
},
|
|
3835
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
3836
|
-
return this.delegate = {
|
|
3837
|
-
iterator: values(iterable),
|
|
3838
|
-
resultName: resultName,
|
|
3839
|
-
nextLoc: nextLoc
|
|
3840
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
3841
|
-
}
|
|
3842
|
-
}, exports;
|
|
3843
|
-
}
|
|
3499
|
+
var dirtyRect = _this.convertAABB2Rect(dirtyRenderBounds);
|
|
3844
3500
|
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3501
|
+
var x = dirtyRect.x,
|
|
3502
|
+
y = dirtyRect.y,
|
|
3503
|
+
width = dirtyRect.width,
|
|
3504
|
+
height = dirtyRect.height;
|
|
3505
|
+
var tl = transformMat4$1(_this.vec3a, fromValues(x, y, 0), _this.vpMatrix);
|
|
3506
|
+
var tr = transformMat4$1(_this.vec3b, fromValues(x + width, y, 0), _this.vpMatrix);
|
|
3507
|
+
var bl = transformMat4$1(_this.vec3c, fromValues(x, y + height, 0), _this.vpMatrix);
|
|
3508
|
+
var br = transformMat4$1(_this.vec3d, fromValues(x + width, y + height, 0), _this.vpMatrix);
|
|
3509
|
+
var minx = Math.min(tl[0], tr[0], br[0], bl[0]);
|
|
3510
|
+
var miny = Math.min(tl[1], tr[1], br[1], bl[1]);
|
|
3511
|
+
var maxx = Math.max(tl[0], tr[0], br[0], bl[0]);
|
|
3512
|
+
var maxy = Math.max(tl[1], tr[1], br[1], bl[1]);
|
|
3513
|
+
var ix = Math.floor(minx);
|
|
3514
|
+
var iy = Math.floor(miny);
|
|
3515
|
+
var iwidth = Math.ceil(maxx - minx);
|
|
3516
|
+
var iheight = Math.ceil(maxy - miny);
|
|
3517
|
+
context.save();
|
|
3853
3518
|
|
|
3854
|
-
|
|
3855
|
-
resolve(value);
|
|
3856
|
-
} else {
|
|
3857
|
-
Promise.resolve(value).then(_next, _throw);
|
|
3858
|
-
}
|
|
3859
|
-
}
|
|
3519
|
+
_this.clearRect(context, ix, iy, iwidth, iheight, config.background);
|
|
3860
3520
|
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3521
|
+
context.beginPath();
|
|
3522
|
+
context.rect(ix, iy, iwidth, iheight);
|
|
3523
|
+
context.clip(); // @see https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Transformations
|
|
3524
|
+
|
|
3525
|
+
context.setTransform(_this.vpMatrix[0], _this.vpMatrix[1], _this.vpMatrix[4], _this.vpMatrix[5], _this.vpMatrix[12], _this.vpMatrix[13]); // draw dirty rectangle
|
|
3526
|
+
|
|
3527
|
+
var _config$renderer$getC = config.renderer.getConfig(),
|
|
3528
|
+
enableDirtyRectangleRenderingDebug = _config$renderer$getC.enableDirtyRectangleRenderingDebug;
|
|
3529
|
+
|
|
3530
|
+
if (enableDirtyRectangleRenderingDebug) {
|
|
3531
|
+
canvas.dispatchEvent(new gLite.CustomEvent(gLite.CanvasEvent.DIRTY_RECTANGLE, {
|
|
3532
|
+
dirtyRect: {
|
|
3533
|
+
x: ix,
|
|
3534
|
+
y: iy,
|
|
3535
|
+
width: iwidth,
|
|
3536
|
+
height: iheight
|
|
3537
|
+
}
|
|
3538
|
+
}));
|
|
3539
|
+
} // search objects intersect with dirty rectangle
|
|
3540
|
+
|
|
3541
|
+
|
|
3542
|
+
var dirtyObjects = _this.searchDirtyObjects(dirtyRenderBounds); // do rendering
|
|
3867
3543
|
|
|
3868
|
-
function _next(value) {
|
|
3869
|
-
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
|
|
3870
|
-
}
|
|
3871
3544
|
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3545
|
+
dirtyObjects // sort by z-index
|
|
3546
|
+
.sort(function (a, b) {
|
|
3547
|
+
return a.sortable.renderOrder - b.sortable.renderOrder;
|
|
3548
|
+
}).forEach(function (object) {
|
|
3549
|
+
// culled object should not be rendered
|
|
3550
|
+
if (object && object.isVisible() && !object.isCulled()) {
|
|
3551
|
+
_this.renderDisplayObject(object, contextService, renderingService);
|
|
3552
|
+
}
|
|
3553
|
+
});
|
|
3554
|
+
context.restore(); // save dirty AABBs in last frame
|
|
3875
3555
|
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
}
|
|
3556
|
+
_this.renderQueue.forEach(function (object) {
|
|
3557
|
+
_this.saveDirtyAABB(object);
|
|
3558
|
+
}); // clear queue
|
|
3880
3559
|
|
|
3881
|
-
function _extends() {
|
|
3882
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
3883
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
3884
|
-
var source = arguments[i];
|
|
3885
3560
|
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
target[key] = source[key];
|
|
3889
|
-
}
|
|
3890
|
-
}
|
|
3891
|
-
}
|
|
3561
|
+
_this.renderQueue = [];
|
|
3562
|
+
} // pop restore stack, eg. root -> parent -> child
|
|
3892
3563
|
|
|
3893
|
-
return target;
|
|
3894
|
-
};
|
|
3895
|
-
return _extends.apply(this, arguments);
|
|
3896
|
-
}
|
|
3897
3564
|
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3565
|
+
_this.restoreStack.forEach(function () {
|
|
3566
|
+
context.restore();
|
|
3567
|
+
}); // clear restore stack
|
|
3901
3568
|
|
|
3902
|
-
_setPrototypeOf$4(subClass, superClass);
|
|
3903
|
-
}
|
|
3904
3569
|
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3570
|
+
_this.restoreStack = [];
|
|
3571
|
+
});
|
|
3572
|
+
renderingService.hooks.render.tap(CanvasRendererPlugin.tag, function (object) {
|
|
3573
|
+
if (!_this.clearFullScreen) {
|
|
3574
|
+
// render at the end of frame
|
|
3575
|
+
_this.renderQueue.push(object);
|
|
3576
|
+
}
|
|
3577
|
+
});
|
|
3909
3578
|
};
|
|
3910
|
-
return _setPrototypeOf$4(o, p);
|
|
3911
|
-
}
|
|
3912
|
-
/**
|
|
3913
|
-
* Common utilities
|
|
3914
|
-
* @module glMatrix
|
|
3915
|
-
*/
|
|
3916
3579
|
|
|
3580
|
+
_proto.clearRect = function clearRect(context, x, y, width, height, background) {
|
|
3581
|
+
// clearRect is faster than fillRect @see https://stackoverflow.com/a/30830253
|
|
3582
|
+
context.clearRect(x, y, width, height);
|
|
3917
3583
|
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3584
|
+
if (background) {
|
|
3585
|
+
context.fillStyle = background;
|
|
3586
|
+
context.fillRect(x, y, width, height);
|
|
3587
|
+
}
|
|
3588
|
+
};
|
|
3922
3589
|
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3590
|
+
_proto.renderDisplayObject = function renderDisplayObject(object, contextService, renderingService) {
|
|
3591
|
+
var context = contextService.getContext();
|
|
3592
|
+
var nodeName = object.nodeName; // restore to its ancestor
|
|
3926
3593
|
|
|
3927
|
-
|
|
3928
|
-
};
|
|
3929
|
-
/**
|
|
3930
|
-
* 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
|
|
3931
|
-
* @module mat4
|
|
3932
|
-
*/
|
|
3594
|
+
var parent = this.restoreStack[this.restoreStack.length - 1];
|
|
3933
3595
|
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
*/
|
|
3596
|
+
if (parent && !(object.compareDocumentPosition(parent) & Node.DOCUMENT_POSITION_CONTAINS)) {
|
|
3597
|
+
context.restore();
|
|
3598
|
+
this.restoreStack.pop();
|
|
3599
|
+
} // @ts-ignore
|
|
3939
3600
|
|
|
3940
|
-
function create$3() {
|
|
3941
|
-
var out = new ARRAY_TYPE$1(16);
|
|
3942
3601
|
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
out[2] = 0;
|
|
3946
|
-
out[3] = 0;
|
|
3947
|
-
out[4] = 0;
|
|
3948
|
-
out[6] = 0;
|
|
3949
|
-
out[7] = 0;
|
|
3950
|
-
out[8] = 0;
|
|
3951
|
-
out[9] = 0;
|
|
3952
|
-
out[11] = 0;
|
|
3953
|
-
out[12] = 0;
|
|
3954
|
-
out[13] = 0;
|
|
3955
|
-
out[14] = 0;
|
|
3956
|
-
}
|
|
3602
|
+
var styleRenderer = this.context.styleRendererFactory[nodeName];
|
|
3603
|
+
var generatePath = this.pathGeneratorFactory[nodeName]; // clip path
|
|
3957
3604
|
|
|
3958
|
-
|
|
3959
|
-
out[5] = 1;
|
|
3960
|
-
out[10] = 1;
|
|
3961
|
-
out[15] = 1;
|
|
3962
|
-
return out;
|
|
3963
|
-
}
|
|
3964
|
-
/**
|
|
3965
|
-
* Copy the values from one mat4 to another
|
|
3966
|
-
*
|
|
3967
|
-
* @param {mat4} out the receiving matrix
|
|
3968
|
-
* @param {ReadonlyMat4} a the source matrix
|
|
3969
|
-
* @returns {mat4} out
|
|
3970
|
-
*/
|
|
3605
|
+
var clipPath = object.parsedStyle.clipPath;
|
|
3971
3606
|
|
|
3607
|
+
if (clipPath) {
|
|
3608
|
+
this.applyWorldTransform(context, clipPath); // generate path in local space
|
|
3972
3609
|
|
|
3973
|
-
|
|
3974
|
-
out[0] = a[0];
|
|
3975
|
-
out[1] = a[1];
|
|
3976
|
-
out[2] = a[2];
|
|
3977
|
-
out[3] = a[3];
|
|
3978
|
-
out[4] = a[4];
|
|
3979
|
-
out[5] = a[5];
|
|
3980
|
-
out[6] = a[6];
|
|
3981
|
-
out[7] = a[7];
|
|
3982
|
-
out[8] = a[8];
|
|
3983
|
-
out[9] = a[9];
|
|
3984
|
-
out[10] = a[10];
|
|
3985
|
-
out[11] = a[11];
|
|
3986
|
-
out[12] = a[12];
|
|
3987
|
-
out[13] = a[13];
|
|
3988
|
-
out[14] = a[14];
|
|
3989
|
-
out[15] = a[15];
|
|
3990
|
-
return out;
|
|
3991
|
-
}
|
|
3992
|
-
/**
|
|
3993
|
-
* Multiplies two mat4s
|
|
3994
|
-
*
|
|
3995
|
-
* @param {mat4} out the receiving matrix
|
|
3996
|
-
* @param {ReadonlyMat4} a the first operand
|
|
3997
|
-
* @param {ReadonlyMat4} b the second operand
|
|
3998
|
-
* @returns {mat4} out
|
|
3999
|
-
*/
|
|
3610
|
+
var _generatePath = this.pathGeneratorFactory[clipPath.nodeName];
|
|
4000
3611
|
|
|
3612
|
+
if (_generatePath) {
|
|
3613
|
+
context.save(); // save clip
|
|
4001
3614
|
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
a01 = a[1],
|
|
4005
|
-
a02 = a[2],
|
|
4006
|
-
a03 = a[3];
|
|
4007
|
-
var a10 = a[4],
|
|
4008
|
-
a11 = a[5],
|
|
4009
|
-
a12 = a[6],
|
|
4010
|
-
a13 = a[7];
|
|
4011
|
-
var a20 = a[8],
|
|
4012
|
-
a21 = a[9],
|
|
4013
|
-
a22 = a[10],
|
|
4014
|
-
a23 = a[11];
|
|
4015
|
-
var a30 = a[12],
|
|
4016
|
-
a31 = a[13],
|
|
4017
|
-
a32 = a[14],
|
|
4018
|
-
a33 = a[15]; // Cache only the current line of the second matrix
|
|
3615
|
+
this.restoreStack.push(object);
|
|
3616
|
+
context.beginPath();
|
|
4019
3617
|
|
|
4020
|
-
|
|
4021
|
-
b1 = b[1],
|
|
4022
|
-
b2 = b[2],
|
|
4023
|
-
b3 = b[3];
|
|
4024
|
-
out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
4025
|
-
out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
4026
|
-
out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
4027
|
-
out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
4028
|
-
b0 = b[4];
|
|
4029
|
-
b1 = b[5];
|
|
4030
|
-
b2 = b[6];
|
|
4031
|
-
b3 = b[7];
|
|
4032
|
-
out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
4033
|
-
out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
4034
|
-
out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
4035
|
-
out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
4036
|
-
b0 = b[8];
|
|
4037
|
-
b1 = b[9];
|
|
4038
|
-
b2 = b[10];
|
|
4039
|
-
b3 = b[11];
|
|
4040
|
-
out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
4041
|
-
out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
4042
|
-
out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
4043
|
-
out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
4044
|
-
b0 = b[12];
|
|
4045
|
-
b1 = b[13];
|
|
4046
|
-
b2 = b[14];
|
|
4047
|
-
b3 = b[15];
|
|
4048
|
-
out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
4049
|
-
out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
4050
|
-
out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
4051
|
-
out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
4052
|
-
return out;
|
|
4053
|
-
}
|
|
4054
|
-
/**
|
|
4055
|
-
* Translate a mat4 by the given vector
|
|
4056
|
-
*
|
|
4057
|
-
* @param {mat4} out the receiving matrix
|
|
4058
|
-
* @param {ReadonlyMat4} a the matrix to translate
|
|
4059
|
-
* @param {ReadonlyVec3} v vector to translate by
|
|
4060
|
-
* @returns {mat4} out
|
|
4061
|
-
*/
|
|
3618
|
+
_generatePath(context, clipPath.parsedStyle);
|
|
4062
3619
|
|
|
3620
|
+
context.closePath();
|
|
3621
|
+
context.clip();
|
|
3622
|
+
}
|
|
3623
|
+
} // fill & stroke
|
|
4063
3624
|
|
|
4064
|
-
function translate(out, a, v) {
|
|
4065
|
-
var x = v[0],
|
|
4066
|
-
y = v[1],
|
|
4067
|
-
z = v[2];
|
|
4068
|
-
var a00, a01, a02, a03;
|
|
4069
|
-
var a10, a11, a12, a13;
|
|
4070
|
-
var a20, a21, a22, a23;
|
|
4071
3625
|
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
|
|
4076
|
-
out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
|
|
4077
|
-
} else {
|
|
4078
|
-
a00 = a[0];
|
|
4079
|
-
a01 = a[1];
|
|
4080
|
-
a02 = a[2];
|
|
4081
|
-
a03 = a[3];
|
|
4082
|
-
a10 = a[4];
|
|
4083
|
-
a11 = a[5];
|
|
4084
|
-
a12 = a[6];
|
|
4085
|
-
a13 = a[7];
|
|
4086
|
-
a20 = a[8];
|
|
4087
|
-
a21 = a[9];
|
|
4088
|
-
a22 = a[10];
|
|
4089
|
-
a23 = a[11];
|
|
4090
|
-
out[0] = a00;
|
|
4091
|
-
out[1] = a01;
|
|
4092
|
-
out[2] = a02;
|
|
4093
|
-
out[3] = a03;
|
|
4094
|
-
out[4] = a10;
|
|
4095
|
-
out[5] = a11;
|
|
4096
|
-
out[6] = a12;
|
|
4097
|
-
out[7] = a13;
|
|
4098
|
-
out[8] = a20;
|
|
4099
|
-
out[9] = a21;
|
|
4100
|
-
out[10] = a22;
|
|
4101
|
-
out[11] = a23;
|
|
4102
|
-
out[12] = a00 * x + a10 * y + a20 * z + a[12];
|
|
4103
|
-
out[13] = a01 * x + a11 * y + a21 * z + a[13];
|
|
4104
|
-
out[14] = a02 * x + a12 * y + a22 * z + a[14];
|
|
4105
|
-
out[15] = a03 * x + a13 * y + a23 * z + a[15];
|
|
4106
|
-
}
|
|
3626
|
+
if (styleRenderer) {
|
|
3627
|
+
this.applyWorldTransform(context, object);
|
|
3628
|
+
context.save(); // apply attributes to context
|
|
4107
3629
|
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
/**
|
|
4111
|
-
* Creates a matrix from a vector scaling
|
|
4112
|
-
* This is equivalent to (but much faster than):
|
|
4113
|
-
*
|
|
4114
|
-
* mat4.identity(dest);
|
|
4115
|
-
* mat4.scale(dest, dest, vec);
|
|
4116
|
-
*
|
|
4117
|
-
* @param {mat4} out mat4 receiving operation result
|
|
4118
|
-
* @param {ReadonlyVec3} v Scaling vector
|
|
4119
|
-
* @returns {mat4} out
|
|
4120
|
-
*/
|
|
3630
|
+
this.applyAttributesToContext(context, object);
|
|
3631
|
+
}
|
|
4121
3632
|
|
|
3633
|
+
if (generatePath) {
|
|
3634
|
+
context.beginPath();
|
|
3635
|
+
generatePath(context, object.parsedStyle);
|
|
4122
3636
|
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
out[3] = 0;
|
|
4128
|
-
out[4] = 0;
|
|
4129
|
-
out[5] = v[1];
|
|
4130
|
-
out[6] = 0;
|
|
4131
|
-
out[7] = 0;
|
|
4132
|
-
out[8] = 0;
|
|
4133
|
-
out[9] = 0;
|
|
4134
|
-
out[10] = v[2];
|
|
4135
|
-
out[11] = 0;
|
|
4136
|
-
out[12] = 0;
|
|
4137
|
-
out[13] = 0;
|
|
4138
|
-
out[14] = 0;
|
|
4139
|
-
out[15] = 1;
|
|
4140
|
-
return out;
|
|
4141
|
-
}
|
|
4142
|
-
/**
|
|
4143
|
-
* 3 Dimensional Vector
|
|
4144
|
-
* @module vec3
|
|
4145
|
-
*/
|
|
3637
|
+
if (object.nodeName !== gLite.Shape.LINE && object.nodeName !== gLite.Shape.PATH && object.nodeName !== gLite.Shape.POLYLINE) {
|
|
3638
|
+
context.closePath();
|
|
3639
|
+
}
|
|
3640
|
+
} // fill & stroke
|
|
4146
3641
|
|
|
4147
|
-
/**
|
|
4148
|
-
* Creates a new, empty vec3
|
|
4149
|
-
*
|
|
4150
|
-
* @returns {vec3} a new 3D vector
|
|
4151
|
-
*/
|
|
4152
3642
|
|
|
3643
|
+
if (styleRenderer) {
|
|
3644
|
+
styleRenderer.render(context, object.parsedStyle, object, renderingService); // restore applied attributes, eg. shadowBlur shadowColor...
|
|
4153
3645
|
|
|
4154
|
-
|
|
4155
|
-
|
|
3646
|
+
context.restore();
|
|
3647
|
+
} // finish rendering, clear dirty flag
|
|
4156
3648
|
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
3649
|
+
|
|
3650
|
+
object.renderable.dirty = false;
|
|
3651
|
+
};
|
|
3652
|
+
|
|
3653
|
+
_proto.convertAABB2Rect = function convertAABB2Rect(aabb) {
|
|
3654
|
+
var min = aabb.getMin();
|
|
3655
|
+
var max = aabb.getMax(); // expand the rectangle a bit to avoid artifacts
|
|
3656
|
+
// @see https://www.yuque.com/antv/ou292n/bi8nix#ExvCu
|
|
3657
|
+
|
|
3658
|
+
var minX = Math.floor(min[0]);
|
|
3659
|
+
var minY = Math.floor(min[1]);
|
|
3660
|
+
var maxX = Math.ceil(max[0]);
|
|
3661
|
+
var maxY = Math.ceil(max[1]);
|
|
3662
|
+
var width = maxX - minX;
|
|
3663
|
+
var height = maxY - minY;
|
|
3664
|
+
return {
|
|
3665
|
+
x: minX,
|
|
3666
|
+
y: minY,
|
|
3667
|
+
width: width,
|
|
3668
|
+
height: height
|
|
3669
|
+
};
|
|
4161
3670
|
}
|
|
3671
|
+
/**
|
|
3672
|
+
* TODO: merge dirty rectangles with some strategies.
|
|
3673
|
+
* For now, we just simply merge all the rectangles into one.
|
|
3674
|
+
* @see https://idom.me/articles/841.html
|
|
3675
|
+
*/
|
|
3676
|
+
;
|
|
4162
3677
|
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
* @returns {vec3} a new 3D vector
|
|
4172
|
-
*/
|
|
3678
|
+
_proto.mergeDirtyAABBs = function mergeDirtyAABBs(dirtyObjects) {
|
|
3679
|
+
// merge into a big AABB
|
|
3680
|
+
// TODO: skip descendant if ancestor is caculated, but compareNodePosition is really slow
|
|
3681
|
+
var aabb = new gLite.AABB();
|
|
3682
|
+
dirtyObjects.forEach(function (object) {
|
|
3683
|
+
var renderBounds = object.getRenderBounds();
|
|
3684
|
+
aabb.add(renderBounds);
|
|
3685
|
+
var dirtyRenderBounds = object.renderable.dirtyRenderBounds;
|
|
4173
3686
|
|
|
3687
|
+
if (dirtyRenderBounds) {
|
|
3688
|
+
aabb.add(dirtyRenderBounds);
|
|
3689
|
+
}
|
|
3690
|
+
});
|
|
3691
|
+
return aabb;
|
|
3692
|
+
};
|
|
4174
3693
|
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
return out;
|
|
4181
|
-
}
|
|
4182
|
-
/**
|
|
4183
|
-
* Transforms the vec3 with a mat4.
|
|
4184
|
-
* 4th vector component is implicitly '1'
|
|
4185
|
-
*
|
|
4186
|
-
* @param {vec3} out the receiving vector
|
|
4187
|
-
* @param {ReadonlyVec3} a the vector to transform
|
|
4188
|
-
* @param {ReadonlyMat4} m matrix to transform with
|
|
4189
|
-
* @returns {vec3} out
|
|
4190
|
-
*/
|
|
3694
|
+
_proto.searchDirtyObjects = function searchDirtyObjects(dirtyRectangle) {
|
|
3695
|
+
// search in r-tree, get all affected nodes
|
|
3696
|
+
var _dirtyRectangle$getMi = dirtyRectangle.getMin(),
|
|
3697
|
+
minX = _dirtyRectangle$getMi[0],
|
|
3698
|
+
minY = _dirtyRectangle$getMi[1];
|
|
4191
3699
|
|
|
3700
|
+
var _dirtyRectangle$getMa = dirtyRectangle.getMax(),
|
|
3701
|
+
maxX = _dirtyRectangle$getMa[0],
|
|
3702
|
+
maxY = _dirtyRectangle$getMa[1];
|
|
4192
3703
|
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
/**
|
|
4205
|
-
* Perform some operation over an array of vec3s.
|
|
4206
|
-
*
|
|
4207
|
-
* @param {Array} a the array of vectors to iterate over
|
|
4208
|
-
* @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
|
|
4209
|
-
* @param {Number} offset Number of elements to skip at the beginning of the array
|
|
4210
|
-
* @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
|
|
4211
|
-
* @param {Function} fn Function to call for each vector in the array
|
|
4212
|
-
* @param {Object} [arg] additional argument to pass to fn
|
|
4213
|
-
* @returns {Array} a
|
|
4214
|
-
* @function
|
|
4215
|
-
*/
|
|
3704
|
+
var rBushNodes = this.rBush.search({
|
|
3705
|
+
minX: minX,
|
|
3706
|
+
minY: minY,
|
|
3707
|
+
maxX: maxX,
|
|
3708
|
+
maxY: maxY
|
|
3709
|
+
});
|
|
3710
|
+
return rBushNodes.map(function (_ref3) {
|
|
3711
|
+
var id = _ref3.id;
|
|
3712
|
+
return gLite.runtime.displayObjectPool.getByEntity(id);
|
|
3713
|
+
});
|
|
3714
|
+
};
|
|
4216
3715
|
|
|
3716
|
+
_proto.saveDirtyAABB = function saveDirtyAABB(object) {
|
|
3717
|
+
var renderable = object.renderable;
|
|
4217
3718
|
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
var i, l;
|
|
3719
|
+
if (!renderable.dirtyRenderBounds) {
|
|
3720
|
+
renderable.dirtyRenderBounds = new gLite.AABB();
|
|
3721
|
+
}
|
|
4222
3722
|
|
|
4223
|
-
|
|
4224
|
-
|
|
3723
|
+
var renderBounds = object.getRenderBounds();
|
|
3724
|
+
|
|
3725
|
+
if (renderBounds) {
|
|
3726
|
+
// save last dirty aabb
|
|
3727
|
+
renderable.dirtyRenderBounds.update(renderBounds.center, renderBounds.halfExtents);
|
|
4225
3728
|
}
|
|
3729
|
+
}
|
|
3730
|
+
/**
|
|
3731
|
+
* TODO: batch the same global attributes
|
|
3732
|
+
*/
|
|
3733
|
+
;
|
|
4226
3734
|
|
|
4227
|
-
|
|
4228
|
-
|
|
3735
|
+
_proto.applyAttributesToContext = function applyAttributesToContext(context, object) {
|
|
3736
|
+
var _object$parsedStyle = object.parsedStyle,
|
|
3737
|
+
stroke = _object$parsedStyle.stroke,
|
|
3738
|
+
fill = _object$parsedStyle.fill,
|
|
3739
|
+
opacity = _object$parsedStyle.opacity,
|
|
3740
|
+
lineDash = _object$parsedStyle.lineDash,
|
|
3741
|
+
lineDashOffset = _object$parsedStyle.lineDashOffset; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/setLineDash
|
|
3742
|
+
|
|
3743
|
+
if (lineDash) {
|
|
3744
|
+
context.setLineDash(lineDash);
|
|
3745
|
+
} // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/lineDashOffset
|
|
3746
|
+
|
|
3747
|
+
|
|
3748
|
+
if (!isNil(lineDashOffset)) {
|
|
3749
|
+
context.lineDashOffset = lineDashOffset;
|
|
4229
3750
|
}
|
|
4230
3751
|
|
|
4231
|
-
if (
|
|
4232
|
-
|
|
4233
|
-
}
|
|
4234
|
-
|
|
3752
|
+
if (!isNil(opacity)) {
|
|
3753
|
+
context.globalAlpha *= opacity;
|
|
3754
|
+
}
|
|
3755
|
+
|
|
3756
|
+
if (!isNil(stroke) && !Array.isArray(stroke) && !stroke.isNone) {
|
|
3757
|
+
context.strokeStyle = object.attributes.stroke;
|
|
4235
3758
|
}
|
|
4236
3759
|
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
3760
|
+
if (!isNil(fill) && !Array.isArray(fill) && !fill.isNone) {
|
|
3761
|
+
context.fillStyle = object.attributes.fill;
|
|
3762
|
+
}
|
|
3763
|
+
};
|
|
3764
|
+
|
|
3765
|
+
_proto.applyWorldTransform = function applyWorldTransform(context, object, matrix) {
|
|
3766
|
+
var tx = 0;
|
|
3767
|
+
var ty = 0;
|
|
3768
|
+
|
|
3769
|
+
var _ref4 = object.parsedStyle || {},
|
|
3770
|
+
anchor = _ref4.anchor;
|
|
3771
|
+
|
|
3772
|
+
var anchorX = anchor && anchor[0] || 0;
|
|
3773
|
+
var anchorY = anchor && anchor[1] || 0;
|
|
3774
|
+
|
|
3775
|
+
if (anchorX !== 0 || anchorY !== 0) {
|
|
3776
|
+
var bounds = object.getGeometryBounds();
|
|
3777
|
+
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
3778
|
+
var height = bounds && bounds.halfExtents[1] * 2 || 0;
|
|
3779
|
+
tx = -(anchorX * width);
|
|
3780
|
+
ty = -(anchorY * height);
|
|
3781
|
+
} // apply clip shape's RTS
|
|
3782
|
+
|
|
3783
|
+
|
|
3784
|
+
if (matrix) {
|
|
3785
|
+
copy(this.tmpMat4, object.getLocalTransform());
|
|
3786
|
+
this.vec3a[0] = tx;
|
|
3787
|
+
this.vec3a[1] = ty;
|
|
3788
|
+
this.vec3a[2] = 0;
|
|
3789
|
+
translate(this.tmpMat4, this.tmpMat4, this.vec3a);
|
|
3790
|
+
multiply(this.tmpMat4, matrix, this.tmpMat4);
|
|
3791
|
+
multiply(this.tmpMat4, this.vpMatrix, this.tmpMat4);
|
|
3792
|
+
} else {
|
|
3793
|
+
// apply RTS transformation in world space
|
|
3794
|
+
copy(this.tmpMat4, object.getWorldTransform());
|
|
3795
|
+
this.vec3a[0] = tx;
|
|
3796
|
+
this.vec3a[1] = ty;
|
|
3797
|
+
this.vec3a[2] = 0;
|
|
3798
|
+
translate(this.tmpMat4, this.tmpMat4, this.vec3a);
|
|
3799
|
+
multiply(this.tmpMat4, this.vpMatrix, this.tmpMat4);
|
|
3800
|
+
} // @see https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Transformations
|
|
3801
|
+
|
|
3802
|
+
|
|
3803
|
+
context.setTransform(this.tmpMat4[0], this.tmpMat4[1], this.tmpMat4[4], this.tmpMat4[5], this.tmpMat4[12], this.tmpMat4[13]);
|
|
3804
|
+
};
|
|
3805
|
+
|
|
3806
|
+
_proto.safeMergeAABB = function safeMergeAABB() {
|
|
3807
|
+
var merged = new gLite.AABB();
|
|
3808
|
+
|
|
3809
|
+
for (var _len = arguments.length, aabbs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3810
|
+
aabbs[_key] = arguments[_key];
|
|
4245
3811
|
}
|
|
4246
3812
|
|
|
4247
|
-
|
|
3813
|
+
aabbs.forEach(function (aabb) {
|
|
3814
|
+
merged.add(aabb);
|
|
3815
|
+
});
|
|
3816
|
+
return merged;
|
|
4248
3817
|
};
|
|
3818
|
+
|
|
3819
|
+
return CanvasRendererPlugin;
|
|
4249
3820
|
}();
|
|
4250
3821
|
|
|
4251
|
-
|
|
4252
|
-
var CircleRendererContribution = gLite.Syringe.defineToken('', {
|
|
4253
|
-
multiple: false
|
|
4254
|
-
});
|
|
4255
|
-
var EllipseRendererContribution = gLite.Syringe.defineToken('', {
|
|
4256
|
-
multiple: false
|
|
4257
|
-
});
|
|
4258
|
-
var RectRendererContribution = gLite.Syringe.defineToken('', {
|
|
4259
|
-
multiple: false
|
|
4260
|
-
});
|
|
4261
|
-
var LineRendererContribution = gLite.Syringe.defineToken('', {
|
|
4262
|
-
multiple: false
|
|
4263
|
-
});
|
|
4264
|
-
var PolylineRendererContribution = gLite.Syringe.defineToken('', {
|
|
4265
|
-
multiple: false
|
|
4266
|
-
});
|
|
4267
|
-
var PolygonRendererContribution = gLite.Syringe.defineToken('', {
|
|
4268
|
-
multiple: false
|
|
4269
|
-
});
|
|
4270
|
-
var PathRendererContribution = gLite.Syringe.defineToken('', {
|
|
4271
|
-
multiple: false
|
|
4272
|
-
});
|
|
4273
|
-
var TextRendererContribution = gLite.Syringe.defineToken('', {
|
|
4274
|
-
multiple: false
|
|
4275
|
-
});
|
|
4276
|
-
var ImageRendererContribution = gLite.Syringe.defineToken('', {
|
|
4277
|
-
multiple: false
|
|
4278
|
-
});
|
|
3822
|
+
CanvasRendererPlugin.tag = 'CanvasRenderer';
|
|
4279
3823
|
|
|
4280
3824
|
var DefaultRenderer = /*#__PURE__*/function () {
|
|
4281
3825
|
function DefaultRenderer(imagePool) {
|
|
@@ -4287,6 +3831,7 @@
|
|
|
4287
3831
|
|
|
4288
3832
|
_proto.render = function render(context, parsedStyle, object, renderingService) {
|
|
4289
3833
|
var fill = parsedStyle.fill,
|
|
3834
|
+
fillRule = parsedStyle.fillRule,
|
|
4290
3835
|
opacity = parsedStyle.opacity,
|
|
4291
3836
|
fillOpacity = parsedStyle.fillOpacity,
|
|
4292
3837
|
stroke = parsedStyle.stroke,
|
|
@@ -4315,7 +3860,7 @@
|
|
|
4315
3860
|
setShadowAndFilter(object, context, hasShadow);
|
|
4316
3861
|
}
|
|
4317
3862
|
|
|
4318
|
-
this.fill(context, object, fill, renderingService);
|
|
3863
|
+
this.fill(context, object, fill, fillRule, renderingService);
|
|
4319
3864
|
|
|
4320
3865
|
if (!shouldDrawShadowWithStroke) {
|
|
4321
3866
|
this.clearShadowAndFilter(context, hasFilter, hasShadow);
|
|
@@ -4372,20 +3917,20 @@
|
|
|
4372
3917
|
}
|
|
4373
3918
|
};
|
|
4374
3919
|
|
|
4375
|
-
_proto.fill = function fill(context, object, _fill, renderingService) {
|
|
3920
|
+
_proto.fill = function fill(context, object, _fill, fillRule, renderingService) {
|
|
4376
3921
|
var _this = this;
|
|
4377
3922
|
|
|
4378
3923
|
if (Array.isArray(_fill)) {
|
|
4379
3924
|
_fill.forEach(function (gradient) {
|
|
4380
3925
|
context.fillStyle = _this.getColor(gradient, object, context);
|
|
4381
|
-
context.fill();
|
|
3926
|
+
context.fill(fillRule);
|
|
4382
3927
|
});
|
|
4383
3928
|
} else {
|
|
4384
3929
|
if (gLite.isPattern(_fill)) {
|
|
4385
3930
|
context.fillStyle = this.getPattern(_fill, object, context, renderingService);
|
|
4386
3931
|
}
|
|
4387
3932
|
|
|
4388
|
-
context.fill();
|
|
3933
|
+
context.fill(fillRule);
|
|
4389
3934
|
}
|
|
4390
3935
|
};
|
|
4391
3936
|
|
|
@@ -4435,12 +3980,11 @@
|
|
|
4435
3980
|
|
|
4436
3981
|
return DefaultRenderer;
|
|
4437
3982
|
}();
|
|
4438
|
-
|
|
4439
|
-
DefaultRenderer = __decorate([gLite.singleton(), __param(0, gLite.inject(ImagePool))], DefaultRenderer);
|
|
4440
3983
|
/**
|
|
4441
3984
|
* apply before fill and stroke but only once
|
|
4442
3985
|
*/
|
|
4443
3986
|
|
|
3987
|
+
|
|
4444
3988
|
function setShadowAndFilter(object, context, hasShadow) {
|
|
4445
3989
|
var _object$parsedStyle = object.parsedStyle,
|
|
4446
3990
|
filter = _object$parsedStyle.filter,
|
|
@@ -4503,10 +4047,6 @@
|
|
|
4503
4047
|
return ImageRenderer;
|
|
4504
4048
|
}();
|
|
4505
4049
|
|
|
4506
|
-
ImageRenderer = __decorate([gLite.singleton({
|
|
4507
|
-
token: ImageRendererContribution
|
|
4508
|
-
}), __param(0, gLite.inject(ImagePool))], ImageRenderer);
|
|
4509
|
-
|
|
4510
4050
|
var TextRenderer = /*#__PURE__*/function () {
|
|
4511
4051
|
function TextRenderer() {}
|
|
4512
4052
|
|
|
@@ -4658,12 +4198,8 @@
|
|
|
4658
4198
|
return TextRenderer;
|
|
4659
4199
|
}();
|
|
4660
4200
|
|
|
4661
|
-
TextRenderer = __decorate([gLite.singleton({
|
|
4662
|
-
token: TextRendererContribution
|
|
4663
|
-
})], TextRenderer);
|
|
4664
|
-
|
|
4665
4201
|
var RectRenderer = /*#__PURE__*/function (_DefaultRenderer) {
|
|
4666
|
-
_inheritsLoose$
|
|
4202
|
+
_inheritsLoose$3(RectRenderer, _DefaultRenderer);
|
|
4667
4203
|
|
|
4668
4204
|
function RectRenderer() {
|
|
4669
4205
|
return _DefaultRenderer.apply(this, arguments) || this;
|
|
@@ -4672,12 +4208,8 @@
|
|
|
4672
4208
|
return RectRenderer;
|
|
4673
4209
|
}(DefaultRenderer);
|
|
4674
4210
|
|
|
4675
|
-
RectRenderer = __decorate([gLite.singleton({
|
|
4676
|
-
token: RectRendererContribution
|
|
4677
|
-
})], RectRenderer);
|
|
4678
|
-
|
|
4679
4211
|
var CircleRenderer = /*#__PURE__*/function (_DefaultRenderer) {
|
|
4680
|
-
_inheritsLoose$
|
|
4212
|
+
_inheritsLoose$3(CircleRenderer, _DefaultRenderer);
|
|
4681
4213
|
|
|
4682
4214
|
function CircleRenderer() {
|
|
4683
4215
|
return _DefaultRenderer.apply(this, arguments) || this;
|
|
@@ -4686,12 +4218,8 @@
|
|
|
4686
4218
|
return CircleRenderer;
|
|
4687
4219
|
}(DefaultRenderer);
|
|
4688
4220
|
|
|
4689
|
-
CircleRenderer = __decorate([gLite.singleton({
|
|
4690
|
-
token: CircleRendererContribution
|
|
4691
|
-
})], CircleRenderer);
|
|
4692
|
-
|
|
4693
4221
|
var EllipseRenderer = /*#__PURE__*/function (_DefaultRenderer) {
|
|
4694
|
-
_inheritsLoose$
|
|
4222
|
+
_inheritsLoose$3(EllipseRenderer, _DefaultRenderer);
|
|
4695
4223
|
|
|
4696
4224
|
function EllipseRenderer() {
|
|
4697
4225
|
return _DefaultRenderer.apply(this, arguments) || this;
|
|
@@ -4700,12 +4228,8 @@
|
|
|
4700
4228
|
return EllipseRenderer;
|
|
4701
4229
|
}(DefaultRenderer);
|
|
4702
4230
|
|
|
4703
|
-
EllipseRenderer = __decorate([gLite.singleton({
|
|
4704
|
-
token: EllipseRendererContribution
|
|
4705
|
-
})], EllipseRenderer);
|
|
4706
|
-
|
|
4707
4231
|
var LineRenderer = /*#__PURE__*/function (_DefaultRenderer) {
|
|
4708
|
-
_inheritsLoose$
|
|
4232
|
+
_inheritsLoose$3(LineRenderer, _DefaultRenderer);
|
|
4709
4233
|
|
|
4710
4234
|
function LineRenderer() {
|
|
4711
4235
|
return _DefaultRenderer.apply(this, arguments) || this;
|
|
@@ -4714,12 +4238,8 @@
|
|
|
4714
4238
|
return LineRenderer;
|
|
4715
4239
|
}(DefaultRenderer);
|
|
4716
4240
|
|
|
4717
|
-
LineRenderer = __decorate([gLite.singleton({
|
|
4718
|
-
token: LineRendererContribution
|
|
4719
|
-
})], LineRenderer);
|
|
4720
|
-
|
|
4721
4241
|
var PolylineRenderer = /*#__PURE__*/function (_DefaultRenderer) {
|
|
4722
|
-
_inheritsLoose$
|
|
4242
|
+
_inheritsLoose$3(PolylineRenderer, _DefaultRenderer);
|
|
4723
4243
|
|
|
4724
4244
|
function PolylineRenderer() {
|
|
4725
4245
|
return _DefaultRenderer.apply(this, arguments) || this;
|
|
@@ -4728,12 +4248,8 @@
|
|
|
4728
4248
|
return PolylineRenderer;
|
|
4729
4249
|
}(DefaultRenderer);
|
|
4730
4250
|
|
|
4731
|
-
PolylineRenderer = __decorate([gLite.singleton({
|
|
4732
|
-
token: PolylineRendererContribution
|
|
4733
|
-
})], PolylineRenderer);
|
|
4734
|
-
|
|
4735
4251
|
var PolygonRenderer = /*#__PURE__*/function (_DefaultRenderer) {
|
|
4736
|
-
_inheritsLoose$
|
|
4252
|
+
_inheritsLoose$3(PolygonRenderer, _DefaultRenderer);
|
|
4737
4253
|
|
|
4738
4254
|
function PolygonRenderer() {
|
|
4739
4255
|
return _DefaultRenderer.apply(this, arguments) || this;
|
|
@@ -4742,12 +4258,8 @@
|
|
|
4742
4258
|
return PolygonRenderer;
|
|
4743
4259
|
}(DefaultRenderer);
|
|
4744
4260
|
|
|
4745
|
-
PolygonRenderer = __decorate([gLite.singleton({
|
|
4746
|
-
token: PolygonRendererContribution
|
|
4747
|
-
})], PolygonRenderer);
|
|
4748
|
-
|
|
4749
4261
|
var PathRenderer = /*#__PURE__*/function (_DefaultRenderer) {
|
|
4750
|
-
_inheritsLoose$
|
|
4262
|
+
_inheritsLoose$3(PathRenderer, _DefaultRenderer);
|
|
4751
4263
|
|
|
4752
4264
|
function PathRenderer() {
|
|
4753
4265
|
return _DefaultRenderer.apply(this, arguments) || this;
|
|
@@ -4756,600 +4268,660 @@
|
|
|
4756
4268
|
return PathRenderer;
|
|
4757
4269
|
}(DefaultRenderer);
|
|
4758
4270
|
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
})], PathRenderer);
|
|
4762
|
-
var CanvasRendererPluginOptions = gLite.Syringe.defineToken('');
|
|
4271
|
+
var Plugin$2 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
4272
|
+
_inheritsLoose$3(Plugin, _AbstractRendererPlug);
|
|
4763
4273
|
|
|
4764
|
-
|
|
4274
|
+
function Plugin(options) {
|
|
4275
|
+
var _this;
|
|
4765
4276
|
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
* * immediate
|
|
4770
|
-
* * delayed: render at the end of frame with dirty-rectangle
|
|
4771
|
-
*/
|
|
4277
|
+
if (options === void 0) {
|
|
4278
|
+
options = {};
|
|
4279
|
+
}
|
|
4772
4280
|
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
rBush) {
|
|
4779
|
-
this.canvasConfig = void 0;
|
|
4780
|
-
this.camera = void 0;
|
|
4781
|
-
this.contextService = void 0;
|
|
4782
|
-
this.renderingContext = void 0;
|
|
4783
|
-
this.pathGeneratorFactory = void 0;
|
|
4784
|
-
this.styleRendererFactory = void 0;
|
|
4785
|
-
this.displayObjectPool = void 0;
|
|
4786
|
-
this.canvasRendererPluginOptions = void 0;
|
|
4787
|
-
this.rBush = void 0;
|
|
4788
|
-
this.pathGeneratorFactoryCache = {};
|
|
4789
|
-
this.styleRendererFactoryCache = {};
|
|
4790
|
-
this.removedRBushNodeAABBs = [];
|
|
4791
|
-
this.renderQueue = [];
|
|
4792
|
-
this.restoreStack = [];
|
|
4793
|
-
this.clearFullScreen = false;
|
|
4794
|
-
this.vpMatrix = create$3();
|
|
4795
|
-
this.dprMatrix = create$3();
|
|
4796
|
-
this.tmpMat4 = create$3();
|
|
4797
|
-
this.vec3a = create$1$1();
|
|
4798
|
-
this.vec3b = create$1$1();
|
|
4799
|
-
this.vec3c = create$1$1();
|
|
4800
|
-
this.vec3d = create$1$1();
|
|
4801
|
-
this.canvasConfig = canvasConfig;
|
|
4802
|
-
this.camera = camera;
|
|
4803
|
-
this.contextService = contextService;
|
|
4804
|
-
this.renderingContext = renderingContext;
|
|
4805
|
-
this.pathGeneratorFactory = pathGeneratorFactory;
|
|
4806
|
-
this.styleRendererFactory = styleRendererFactory;
|
|
4807
|
-
this.displayObjectPool = displayObjectPool;
|
|
4808
|
-
this.canvasRendererPluginOptions = canvasRendererPluginOptions;
|
|
4809
|
-
this.rBush = rBush;
|
|
4281
|
+
_this = _AbstractRendererPlug.call(this) || this;
|
|
4282
|
+
_this.options = void 0;
|
|
4283
|
+
_this.name = 'canvas-renderer';
|
|
4284
|
+
_this.options = options;
|
|
4285
|
+
return _this;
|
|
4810
4286
|
}
|
|
4811
4287
|
|
|
4812
|
-
var _proto =
|
|
4813
|
-
|
|
4814
|
-
_proto.apply = function apply(renderingService) {
|
|
4815
|
-
var _this = this;
|
|
4816
|
-
|
|
4817
|
-
var canvas = this.renderingContext.root.ownerDocument.defaultView;
|
|
4818
|
-
|
|
4819
|
-
var handleUnmounted = function handleUnmounted(e) {
|
|
4820
|
-
var object = e.target; // remove r-bush node
|
|
4821
|
-
// @ts-ignore
|
|
4288
|
+
var _proto = Plugin.prototype;
|
|
4822
4289
|
|
|
4823
|
-
|
|
4290
|
+
_proto.init = function init() {
|
|
4291
|
+
var _defaultStyleRenderer;
|
|
4824
4292
|
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
};
|
|
4293
|
+
var canvasRendererPluginOptions = _extends({
|
|
4294
|
+
dirtyObjectNumThreshold: 500,
|
|
4295
|
+
dirtyObjectRatioThreshold: 0.8
|
|
4296
|
+
}, this.options); // @ts-ignore
|
|
4830
4297
|
|
|
4831
|
-
var handleCulled = function handleCulled(e) {
|
|
4832
|
-
var object = e.target; // @ts-ignore
|
|
4833
4298
|
|
|
4834
|
-
|
|
4299
|
+
var imagePool = this.context.imagePool;
|
|
4300
|
+
var defaultRenderer = new DefaultRenderer(imagePool);
|
|
4301
|
+
var defaultStyleRendererFactory = (_defaultStyleRenderer = {}, _defaultStyleRenderer[gLite.Shape.CIRCLE] = defaultRenderer, _defaultStyleRenderer[gLite.Shape.ELLIPSE] = defaultRenderer, _defaultStyleRenderer[gLite.Shape.RECT] = defaultRenderer, _defaultStyleRenderer[gLite.Shape.IMAGE] = new ImageRenderer(imagePool), _defaultStyleRenderer[gLite.Shape.TEXT] = new TextRenderer(), _defaultStyleRenderer[gLite.Shape.LINE] = defaultRenderer, _defaultStyleRenderer[gLite.Shape.POLYLINE] = defaultRenderer, _defaultStyleRenderer[gLite.Shape.POLYGON] = defaultRenderer, _defaultStyleRenderer[gLite.Shape.PATH] = defaultRenderer, _defaultStyleRenderer[gLite.Shape.GROUP] = undefined, _defaultStyleRenderer[gLite.Shape.HTML] = undefined, _defaultStyleRenderer[gLite.Shape.MESH] = undefined, _defaultStyleRenderer); // @ts-ignore
|
|
4835
4302
|
|
|
4836
|
-
|
|
4837
|
-
// save removed aabbs for dirty-rectangle rendering later
|
|
4838
|
-
_this.removedRBushNodeAABBs.push(rBushNode.aabb);
|
|
4839
|
-
}
|
|
4840
|
-
};
|
|
4303
|
+
this.context.defaultStyleRendererFactory = defaultStyleRendererFactory; // @ts-ignore
|
|
4841
4304
|
|
|
4842
|
-
|
|
4843
|
-
|
|
4305
|
+
this.context.styleRendererFactory = defaultStyleRendererFactory;
|
|
4306
|
+
this.addRenderingPlugin(new CanvasRendererPlugin(canvasRendererPluginOptions));
|
|
4307
|
+
};
|
|
4844
4308
|
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
switch (_context.prev = _context.next) {
|
|
4848
|
-
case 0:
|
|
4849
|
-
_this.renderingContext.root.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
4309
|
+
_proto.destroy = function destroy() {
|
|
4310
|
+
this.removeAllRenderingPlugins(); // @ts-ignore
|
|
4850
4311
|
|
|
4851
|
-
|
|
4312
|
+
delete this.context.defaultStyleRendererFactory; // @ts-ignore
|
|
4852
4313
|
|
|
4314
|
+
delete this.context.styleRendererFactory;
|
|
4315
|
+
};
|
|
4853
4316
|
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
context = _this.contextService.getContext();
|
|
4317
|
+
return Plugin;
|
|
4318
|
+
}(gLite.AbstractRendererPlugin);
|
|
4857
4319
|
|
|
4858
|
-
|
|
4320
|
+
var index_esm$2 = /*#__PURE__*/Object.freeze({
|
|
4321
|
+
__proto__: null,
|
|
4322
|
+
CircleRenderer: CircleRenderer,
|
|
4323
|
+
EllipseRenderer: EllipseRenderer,
|
|
4324
|
+
ImageRenderer: ImageRenderer,
|
|
4325
|
+
LineRenderer: LineRenderer,
|
|
4326
|
+
PathRenderer: PathRenderer,
|
|
4327
|
+
Plugin: Plugin$2,
|
|
4328
|
+
PolygonRenderer: PolygonRenderer,
|
|
4329
|
+
PolylineRenderer: PolylineRenderer,
|
|
4330
|
+
RectRenderer: RectRenderer,
|
|
4331
|
+
TextRenderer: TextRenderer
|
|
4332
|
+
});
|
|
4859
4333
|
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
}, _callee);
|
|
4866
|
-
})));
|
|
4867
|
-
renderingService.hooks.destroy.tap(CanvasRendererPlugin_1.tag, function () {
|
|
4868
|
-
_this.renderingContext.root.removeEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
4334
|
+
function _regeneratorRuntime$3() {
|
|
4335
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
4336
|
+
_regeneratorRuntime$3 = function _regeneratorRuntime() {
|
|
4337
|
+
return exports;
|
|
4338
|
+
};
|
|
4869
4339
|
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4340
|
+
var exports = {},
|
|
4341
|
+
Op = Object.prototype,
|
|
4342
|
+
hasOwn = Op.hasOwnProperty,
|
|
4343
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
4344
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
4345
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
4346
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
4874
4347
|
|
|
4875
|
-
|
|
4348
|
+
function define(obj, key, value) {
|
|
4349
|
+
return Object.defineProperty(obj, key, {
|
|
4350
|
+
value: value,
|
|
4351
|
+
enumerable: !0,
|
|
4352
|
+
configurable: !0,
|
|
4353
|
+
writable: !0
|
|
4354
|
+
}), obj[key];
|
|
4355
|
+
}
|
|
4876
4356
|
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4357
|
+
try {
|
|
4358
|
+
define({}, "");
|
|
4359
|
+
} catch (err) {
|
|
4360
|
+
define = function define(obj, key, value) {
|
|
4361
|
+
return obj[key] = value;
|
|
4362
|
+
};
|
|
4363
|
+
}
|
|
4883
4364
|
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4365
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
4366
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
4367
|
+
generator = Object.create(protoGenerator.prototype),
|
|
4368
|
+
context = new Context(tryLocsList || []);
|
|
4369
|
+
return generator._invoke = function (innerFn, self, context) {
|
|
4370
|
+
var state = "suspendedStart";
|
|
4371
|
+
return function (method, arg) {
|
|
4372
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
4887
4373
|
|
|
4888
|
-
|
|
4889
|
-
|
|
4374
|
+
if ("completed" === state) {
|
|
4375
|
+
if ("throw" === method) throw arg;
|
|
4376
|
+
return doneResult();
|
|
4377
|
+
}
|
|
4890
4378
|
|
|
4891
|
-
|
|
4892
|
-
|
|
4379
|
+
for (context.method = method, context.arg = arg;;) {
|
|
4380
|
+
var delegate = context.delegate;
|
|
4893
4381
|
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
}
|
|
4897
|
-
}
|
|
4898
|
-
});
|
|
4382
|
+
if (delegate) {
|
|
4383
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
4899
4384
|
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4385
|
+
if (delegateResult) {
|
|
4386
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
4387
|
+
return delegateResult;
|
|
4388
|
+
}
|
|
4389
|
+
}
|
|
4903
4390
|
|
|
4391
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
4392
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
4393
|
+
context.dispatchException(context.arg);
|
|
4394
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
4395
|
+
state = "executing";
|
|
4396
|
+
var record = tryCatch(innerFn, self, context);
|
|
4904
4397
|
|
|
4905
|
-
|
|
4906
|
-
|
|
4398
|
+
if ("normal" === record.type) {
|
|
4399
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
4400
|
+
return {
|
|
4401
|
+
value: record.arg,
|
|
4402
|
+
done: context.done
|
|
4403
|
+
};
|
|
4404
|
+
}
|
|
4907
4405
|
|
|
4908
|
-
|
|
4406
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
4407
|
+
}
|
|
4408
|
+
};
|
|
4409
|
+
}(innerFn, self, context), generator;
|
|
4410
|
+
}
|
|
4909
4411
|
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4412
|
+
function tryCatch(fn, obj, arg) {
|
|
4413
|
+
try {
|
|
4414
|
+
return {
|
|
4415
|
+
type: "normal",
|
|
4416
|
+
arg: fn.call(obj, arg)
|
|
4417
|
+
};
|
|
4418
|
+
} catch (err) {
|
|
4419
|
+
return {
|
|
4420
|
+
type: "throw",
|
|
4421
|
+
arg: err
|
|
4422
|
+
};
|
|
4423
|
+
}
|
|
4424
|
+
}
|
|
4914
4425
|
|
|
4426
|
+
exports.wrap = wrap;
|
|
4427
|
+
var ContinueSentinel = {};
|
|
4915
4428
|
|
|
4916
|
-
|
|
4917
|
-
var context = _this.contextService.getContext(); // clear & clip dirty rectangle
|
|
4429
|
+
function Generator() {}
|
|
4918
4430
|
|
|
4431
|
+
function GeneratorFunction() {}
|
|
4919
4432
|
|
|
4920
|
-
|
|
4433
|
+
function GeneratorFunctionPrototype() {}
|
|
4921
4434
|
|
|
4922
|
-
|
|
4923
|
-
|
|
4435
|
+
var IteratorPrototype = {};
|
|
4436
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
4437
|
+
return this;
|
|
4438
|
+
});
|
|
4439
|
+
var getProto = Object.getPrototypeOf,
|
|
4440
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
4441
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
4442
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
4924
4443
|
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
maxX = _ref2.maxX,
|
|
4933
|
-
maxY = _ref2.maxY;
|
|
4934
|
-
var aabb = new gLite.AABB();
|
|
4935
|
-
aabb.setMinMax(fromValues(minX, minY, 0), fromValues(maxX, maxY, 0));
|
|
4936
|
-
return aabb;
|
|
4937
|
-
})));
|
|
4444
|
+
function defineIteratorMethods(prototype) {
|
|
4445
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
4446
|
+
define(prototype, method, function (arg) {
|
|
4447
|
+
return this._invoke(method, arg);
|
|
4448
|
+
});
|
|
4449
|
+
});
|
|
4450
|
+
}
|
|
4938
4451
|
|
|
4939
|
-
|
|
4452
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
4453
|
+
function invoke(method, arg, resolve, reject) {
|
|
4454
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
4940
4455
|
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4456
|
+
if ("throw" !== record.type) {
|
|
4457
|
+
var result = record.arg,
|
|
4458
|
+
value = result.value;
|
|
4459
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
4460
|
+
invoke("next", value, resolve, reject);
|
|
4461
|
+
}, function (err) {
|
|
4462
|
+
invoke("throw", err, resolve, reject);
|
|
4463
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
4464
|
+
result.value = unwrapped, resolve(result);
|
|
4465
|
+
}, function (error) {
|
|
4466
|
+
return invoke("throw", error, resolve, reject);
|
|
4467
|
+
});
|
|
4468
|
+
}
|
|
4945
4469
|
|
|
4946
|
-
|
|
4470
|
+
reject(record.arg);
|
|
4471
|
+
}
|
|
4947
4472
|
|
|
4948
|
-
|
|
4949
|
-
y = dirtyRect.y,
|
|
4950
|
-
width = dirtyRect.width,
|
|
4951
|
-
height = dirtyRect.height;
|
|
4952
|
-
var tl = transformMat4$1(_this.vec3a, fromValues(x, y, 0), _this.vpMatrix);
|
|
4953
|
-
var tr = transformMat4$1(_this.vec3b, fromValues(x + width, y, 0), _this.vpMatrix);
|
|
4954
|
-
var bl = transformMat4$1(_this.vec3c, fromValues(x, y + height, 0), _this.vpMatrix);
|
|
4955
|
-
var br = transformMat4$1(_this.vec3d, fromValues(x + width, y + height, 0), _this.vpMatrix);
|
|
4956
|
-
var minx = Math.min(tl[0], tr[0], br[0], bl[0]);
|
|
4957
|
-
var miny = Math.min(tl[1], tr[1], br[1], bl[1]);
|
|
4958
|
-
var maxx = Math.max(tl[0], tr[0], br[0], bl[0]);
|
|
4959
|
-
var maxy = Math.max(tl[1], tr[1], br[1], bl[1]);
|
|
4960
|
-
var ix = Math.floor(minx);
|
|
4961
|
-
var iy = Math.floor(miny);
|
|
4962
|
-
var iwidth = Math.ceil(maxx - minx);
|
|
4963
|
-
var iheight = Math.ceil(maxy - miny);
|
|
4964
|
-
context.save();
|
|
4473
|
+
var previousPromise;
|
|
4965
4474
|
|
|
4966
|
-
|
|
4475
|
+
this._invoke = function (method, arg) {
|
|
4476
|
+
function callInvokeWithMethodAndArg() {
|
|
4477
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
4478
|
+
invoke(method, arg, resolve, reject);
|
|
4479
|
+
});
|
|
4480
|
+
}
|
|
4967
4481
|
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4482
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
4483
|
+
};
|
|
4484
|
+
}
|
|
4971
4485
|
|
|
4972
|
-
|
|
4486
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
4487
|
+
var method = delegate.iterator[context.method];
|
|
4973
4488
|
|
|
4974
|
-
|
|
4975
|
-
|
|
4489
|
+
if (undefined === method) {
|
|
4490
|
+
if (context.delegate = null, "throw" === context.method) {
|
|
4491
|
+
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
4492
|
+
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
4493
|
+
}
|
|
4976
4494
|
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
dirtyRect: {
|
|
4980
|
-
x: ix,
|
|
4981
|
-
y: iy,
|
|
4982
|
-
width: iwidth,
|
|
4983
|
-
height: iheight
|
|
4984
|
-
}
|
|
4985
|
-
}));
|
|
4986
|
-
} // search objects intersect with dirty rectangle
|
|
4495
|
+
return ContinueSentinel;
|
|
4496
|
+
}
|
|
4987
4497
|
|
|
4498
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
4499
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
4500
|
+
var info = record.arg;
|
|
4501
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
4502
|
+
}
|
|
4988
4503
|
|
|
4989
|
-
|
|
4504
|
+
function pushTryEntry(locs) {
|
|
4505
|
+
var entry = {
|
|
4506
|
+
tryLoc: locs[0]
|
|
4507
|
+
};
|
|
4508
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
4509
|
+
}
|
|
4990
4510
|
|
|
4511
|
+
function resetTryEntry(entry) {
|
|
4512
|
+
var record = entry.completion || {};
|
|
4513
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
4514
|
+
}
|
|
4991
4515
|
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
if (object && object.isVisible() && !object.isCulled()) {
|
|
4998
|
-
_this.renderDisplayObject(object, renderingService);
|
|
4999
|
-
}
|
|
5000
|
-
});
|
|
5001
|
-
context.restore(); // save dirty AABBs in last frame
|
|
4516
|
+
function Context(tryLocsList) {
|
|
4517
|
+
this.tryEntries = [{
|
|
4518
|
+
tryLoc: "root"
|
|
4519
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
4520
|
+
}
|
|
5002
4521
|
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
4522
|
+
function values(iterable) {
|
|
4523
|
+
if (iterable) {
|
|
4524
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
4525
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
4526
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
5006
4527
|
|
|
4528
|
+
if (!isNaN(iterable.length)) {
|
|
4529
|
+
var i = -1,
|
|
4530
|
+
next = function next() {
|
|
4531
|
+
for (; ++i < iterable.length;) {
|
|
4532
|
+
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
4533
|
+
}
|
|
5007
4534
|
|
|
5008
|
-
|
|
5009
|
-
|
|
4535
|
+
return next.value = undefined, next.done = !0, next;
|
|
4536
|
+
};
|
|
5010
4537
|
|
|
4538
|
+
return next.next = next;
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
5011
4541
|
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
4542
|
+
return {
|
|
4543
|
+
next: doneResult
|
|
4544
|
+
};
|
|
4545
|
+
}
|
|
5015
4546
|
|
|
4547
|
+
function doneResult() {
|
|
4548
|
+
return {
|
|
4549
|
+
value: undefined,
|
|
4550
|
+
done: !0
|
|
4551
|
+
};
|
|
4552
|
+
}
|
|
5016
4553
|
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
4554
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
4555
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
4556
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
4557
|
+
}, exports.mark = function (genFun) {
|
|
4558
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
4559
|
+
}, exports.awrap = function (arg) {
|
|
4560
|
+
return {
|
|
4561
|
+
__await: arg
|
|
4562
|
+
};
|
|
4563
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
4564
|
+
return this;
|
|
4565
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
4566
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
4567
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
4568
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
4569
|
+
return result.done ? result.value : iter.next();
|
|
5024
4570
|
});
|
|
5025
|
-
}
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
var
|
|
4571
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
4572
|
+
return this;
|
|
4573
|
+
}), define(Gp, "toString", function () {
|
|
4574
|
+
return "[object Generator]";
|
|
4575
|
+
}), exports.keys = function (object) {
|
|
4576
|
+
var keys = [];
|
|
5031
4577
|
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
context.fillRect(x, y, width, height);
|
|
4578
|
+
for (var key in object) {
|
|
4579
|
+
keys.push(key);
|
|
5035
4580
|
}
|
|
5036
|
-
};
|
|
5037
4581
|
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
4582
|
+
return keys.reverse(), function next() {
|
|
4583
|
+
for (; keys.length;) {
|
|
4584
|
+
var key = keys.pop();
|
|
4585
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
4586
|
+
}
|
|
5041
4587
|
|
|
5042
|
-
|
|
4588
|
+
return next.done = !0, next;
|
|
4589
|
+
};
|
|
4590
|
+
}, exports.values = values, Context.prototype = {
|
|
4591
|
+
constructor: Context,
|
|
4592
|
+
reset: function reset(skipTempReset) {
|
|
4593
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
|
|
4594
|
+
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
4595
|
+
}
|
|
4596
|
+
},
|
|
4597
|
+
stop: function stop() {
|
|
4598
|
+
this.done = !0;
|
|
4599
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
4600
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
4601
|
+
return this.rval;
|
|
4602
|
+
},
|
|
4603
|
+
dispatchException: function dispatchException(exception) {
|
|
4604
|
+
if (this.done) throw exception;
|
|
4605
|
+
var context = this;
|
|
5043
4606
|
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
} // while (parent && object.parentNode !== parent) {
|
|
5048
|
-
// context.restore();
|
|
5049
|
-
// this.restoreStack.pop();
|
|
5050
|
-
// parent = this.restoreStack[this.restoreStack.length - 1];
|
|
5051
|
-
// }
|
|
4607
|
+
function handle(loc, caught) {
|
|
4608
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
4609
|
+
}
|
|
5052
4610
|
|
|
4611
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
4612
|
+
var entry = this.tryEntries[i],
|
|
4613
|
+
record = entry.completion;
|
|
4614
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
5053
4615
|
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
4616
|
+
if (entry.tryLoc <= this.prev) {
|
|
4617
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
4618
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
5057
4619
|
|
|
5058
|
-
|
|
4620
|
+
if (hasCatch && hasFinally) {
|
|
4621
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
4622
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
4623
|
+
} else if (hasCatch) {
|
|
4624
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
4625
|
+
} else {
|
|
4626
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
4627
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
4628
|
+
}
|
|
4629
|
+
}
|
|
4630
|
+
}
|
|
4631
|
+
},
|
|
4632
|
+
abrupt: function abrupt(type, arg) {
|
|
4633
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
4634
|
+
var entry = this.tryEntries[i];
|
|
5059
4635
|
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
4636
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
4637
|
+
var finallyEntry = entry;
|
|
4638
|
+
break;
|
|
4639
|
+
}
|
|
4640
|
+
}
|
|
5063
4641
|
|
|
5064
|
-
|
|
4642
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
4643
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
4644
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
4645
|
+
},
|
|
4646
|
+
complete: function complete(record, afterLoc) {
|
|
4647
|
+
if ("throw" === record.type) throw record.arg;
|
|
4648
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
4649
|
+
},
|
|
4650
|
+
finish: function finish(finallyLoc) {
|
|
4651
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
4652
|
+
var entry = this.tryEntries[i];
|
|
4653
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
4654
|
+
}
|
|
4655
|
+
},
|
|
4656
|
+
catch: function _catch(tryLoc) {
|
|
4657
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
4658
|
+
var entry = this.tryEntries[i];
|
|
5065
4659
|
|
|
5066
|
-
|
|
4660
|
+
if (entry.tryLoc === tryLoc) {
|
|
4661
|
+
var record = entry.completion;
|
|
5067
4662
|
|
|
5068
|
-
|
|
5069
|
-
|
|
4663
|
+
if ("throw" === record.type) {
|
|
4664
|
+
var thrown = record.arg;
|
|
4665
|
+
resetTryEntry(entry);
|
|
4666
|
+
}
|
|
5070
4667
|
|
|
5071
|
-
|
|
5072
|
-
|
|
4668
|
+
return thrown;
|
|
4669
|
+
}
|
|
5073
4670
|
}
|
|
5074
4671
|
|
|
5075
|
-
|
|
4672
|
+
throw new Error("illegal catch attempt");
|
|
4673
|
+
},
|
|
4674
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
4675
|
+
return this.delegate = {
|
|
4676
|
+
iterator: values(iterable),
|
|
4677
|
+
resultName: resultName,
|
|
4678
|
+
nextLoc: nextLoc
|
|
4679
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
4680
|
+
}
|
|
4681
|
+
}, exports;
|
|
4682
|
+
}
|
|
5076
4683
|
|
|
5077
|
-
|
|
5078
|
-
|
|
4684
|
+
function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4685
|
+
try {
|
|
4686
|
+
var info = gen[key](arg);
|
|
4687
|
+
var value = info.value;
|
|
4688
|
+
} catch (error) {
|
|
4689
|
+
reject(error);
|
|
4690
|
+
return;
|
|
4691
|
+
}
|
|
5079
4692
|
|
|
5080
|
-
|
|
5081
|
-
|
|
4693
|
+
if (info.done) {
|
|
4694
|
+
resolve(value);
|
|
4695
|
+
} else {
|
|
4696
|
+
Promise.resolve(value).then(_next, _throw);
|
|
4697
|
+
}
|
|
4698
|
+
}
|
|
5082
4699
|
|
|
5083
|
-
|
|
4700
|
+
function _asyncToGenerator$3(fn) {
|
|
4701
|
+
return function () {
|
|
4702
|
+
var self = this,
|
|
4703
|
+
args = arguments;
|
|
4704
|
+
return new Promise(function (resolve, reject) {
|
|
4705
|
+
var gen = fn.apply(self, args);
|
|
5084
4706
|
|
|
5085
|
-
|
|
5086
|
-
|
|
4707
|
+
function _next(value) {
|
|
4708
|
+
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
|
|
5087
4709
|
}
|
|
5088
|
-
} // fill & stroke
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
if (styleRenderer) {
|
|
5092
|
-
this.applyWorldTransform(context, object);
|
|
5093
|
-
context.save(); // apply attributes to context
|
|
5094
|
-
|
|
5095
|
-
this.applyAttributesToContext(context, object);
|
|
5096
|
-
}
|
|
5097
|
-
|
|
5098
|
-
if (generatePath) {
|
|
5099
|
-
context.beginPath();
|
|
5100
|
-
generatePath(context, object.parsedStyle);
|
|
5101
4710
|
|
|
5102
|
-
|
|
5103
|
-
|
|
4711
|
+
function _throw(err) {
|
|
4712
|
+
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
|
|
5104
4713
|
}
|
|
5105
|
-
} // fill & stroke
|
|
5106
4714
|
|
|
4715
|
+
_next(undefined);
|
|
4716
|
+
});
|
|
4717
|
+
};
|
|
4718
|
+
}
|
|
5107
4719
|
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
context.restore();
|
|
5112
|
-
} // finish rendering, clear dirty flag
|
|
4720
|
+
function _inheritsLoose$4(subClass, superClass) {
|
|
4721
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
4722
|
+
subClass.prototype.constructor = subClass;
|
|
5113
4723
|
|
|
4724
|
+
_setPrototypeOf$4(subClass, superClass);
|
|
4725
|
+
}
|
|
5114
4726
|
|
|
5115
|
-
|
|
4727
|
+
function _setPrototypeOf$4(o, p) {
|
|
4728
|
+
_setPrototypeOf$4 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
4729
|
+
o.__proto__ = p;
|
|
4730
|
+
return o;
|
|
5116
4731
|
};
|
|
4732
|
+
return _setPrototypeOf$4(o, p);
|
|
4733
|
+
} // const MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
|
|
5117
4734
|
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
// @see https://www.yuque.com/antv/ou292n/bi8nix#ExvCu
|
|
4735
|
+
/**
|
|
4736
|
+
* listen to mouse/touch/pointer events on DOM wrapper, trigger pointer events
|
|
4737
|
+
*/
|
|
5122
4738
|
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
var width = maxX - minX;
|
|
5128
|
-
var height = maxY - minY;
|
|
5129
|
-
return {
|
|
5130
|
-
x: minX,
|
|
5131
|
-
y: minY,
|
|
5132
|
-
width: width,
|
|
5133
|
-
height: height
|
|
5134
|
-
};
|
|
4739
|
+
|
|
4740
|
+
var DOMInteractionPlugin = /*#__PURE__*/function () {
|
|
4741
|
+
function DOMInteractionPlugin() {
|
|
4742
|
+
this.context = void 0;
|
|
5135
4743
|
}
|
|
5136
|
-
/**
|
|
5137
|
-
* TODO: merge dirty rectangles with some strategies.
|
|
5138
|
-
* For now, we just simply merge all the rectangles into one.
|
|
5139
|
-
* @see https://idom.me/articles/841.html
|
|
5140
|
-
*/
|
|
5141
|
-
;
|
|
5142
4744
|
|
|
5143
|
-
_proto
|
|
5144
|
-
// merge into a big AABB
|
|
5145
|
-
// TODO: skip descendant if ancestor is caculated, but compareNodePosition is really slow
|
|
5146
|
-
var aabb = new gLite.AABB();
|
|
5147
|
-
dirtyObjects.forEach(function (object) {
|
|
5148
|
-
var renderBounds = object.getRenderBounds();
|
|
5149
|
-
aabb.add(renderBounds);
|
|
5150
|
-
var dirtyRenderBounds = object.renderable.dirtyRenderBounds;
|
|
4745
|
+
var _proto = DOMInteractionPlugin.prototype;
|
|
5151
4746
|
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
}
|
|
5155
|
-
});
|
|
5156
|
-
return aabb;
|
|
5157
|
-
};
|
|
4747
|
+
_proto.apply = function apply(context) {
|
|
4748
|
+
var _this = this;
|
|
5158
4749
|
|
|
5159
|
-
|
|
5160
|
-
|
|
4750
|
+
var renderingService = context.renderingService,
|
|
4751
|
+
renderingContext = context.renderingContext;
|
|
4752
|
+
this.context = context;
|
|
4753
|
+
var canvas = renderingContext.root.ownerDocument.defaultView; // const SUPPORT_ONLY_TOUCH = canvas.supportsTouchEvents && MOBILE_REGEX.test(navigator.userAgent);
|
|
5161
4754
|
|
|
4755
|
+
var onPointerMove = function onPointerMove(ev) {
|
|
4756
|
+
renderingService.hooks.pointerMove.call(ev);
|
|
4757
|
+
};
|
|
5162
4758
|
|
|
5163
|
-
var
|
|
5164
|
-
|
|
5165
|
-
|
|
4759
|
+
var onPointerUp = function onPointerUp(ev) {
|
|
4760
|
+
renderingService.hooks.pointerUp.call(ev);
|
|
4761
|
+
};
|
|
5166
4762
|
|
|
5167
|
-
var
|
|
5168
|
-
|
|
5169
|
-
|
|
4763
|
+
var onPointerDown = function onPointerDown(ev) {
|
|
4764
|
+
renderingService.hooks.pointerDown.call(ev);
|
|
4765
|
+
};
|
|
5170
4766
|
|
|
5171
|
-
var
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
maxX: maxX,
|
|
5175
|
-
maxY: maxY
|
|
5176
|
-
});
|
|
5177
|
-
return rBushNodes.map(function (_ref3) {
|
|
5178
|
-
var id = _ref3.id;
|
|
5179
|
-
return _this2.displayObjectPool.getByEntity(id);
|
|
5180
|
-
});
|
|
5181
|
-
};
|
|
4767
|
+
var onPointerOver = function onPointerOver(ev) {
|
|
4768
|
+
renderingService.hooks.pointerOver.call(ev);
|
|
4769
|
+
};
|
|
5182
4770
|
|
|
5183
|
-
|
|
5184
|
-
|
|
4771
|
+
var onPointerOut = function onPointerOut(ev) {
|
|
4772
|
+
renderingService.hooks.pointerOut.call(ev);
|
|
4773
|
+
};
|
|
5185
4774
|
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
}
|
|
4775
|
+
var onPointerCancel = function onPointerCancel(ev) {
|
|
4776
|
+
renderingService.hooks.pointerCancel.call(ev);
|
|
4777
|
+
};
|
|
5189
4778
|
|
|
5190
|
-
var
|
|
4779
|
+
var onPointerWheel = function onPointerWheel(ev) {
|
|
4780
|
+
renderingService.hooks.pointerWheel.call(ev);
|
|
4781
|
+
};
|
|
5191
4782
|
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
*/
|
|
5200
|
-
;
|
|
4783
|
+
var addPointerEventListener = function addPointerEventListener($el) {
|
|
4784
|
+
globalThis.document.addEventListener('pointermove', onPointerMove, true);
|
|
4785
|
+
$el.addEventListener('pointerdown', onPointerDown, true);
|
|
4786
|
+
$el.addEventListener('pointerleave', onPointerOut, true);
|
|
4787
|
+
$el.addEventListener('pointerover', onPointerOver, true);
|
|
4788
|
+
globalThis.addEventListener('pointerup', onPointerUp, true);
|
|
4789
|
+
};
|
|
5201
4790
|
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
lineDashOffset = _object$parsedStyle.lineDashOffset; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/setLineDash
|
|
4791
|
+
var addTouchEventListener = function addTouchEventListener($el) {
|
|
4792
|
+
$el.addEventListener('touchstart', onPointerDown, true);
|
|
4793
|
+
$el.addEventListener('touchend', onPointerUp, true);
|
|
4794
|
+
$el.addEventListener('touchmove', onPointerMove, true);
|
|
4795
|
+
$el.addEventListener('touchcancel', onPointerCancel, true);
|
|
4796
|
+
};
|
|
5209
4797
|
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
4798
|
+
var addMouseEventListener = function addMouseEventListener($el) {
|
|
4799
|
+
globalThis.document.addEventListener('mousemove', onPointerMove, true);
|
|
4800
|
+
$el.addEventListener('mousedown', onPointerDown, true);
|
|
4801
|
+
$el.addEventListener('mouseout', onPointerOut, true);
|
|
4802
|
+
$el.addEventListener('mouseover', onPointerOver, true);
|
|
4803
|
+
globalThis.addEventListener('mouseup', onPointerUp, true);
|
|
4804
|
+
};
|
|
5213
4805
|
|
|
4806
|
+
var removePointerEventListener = function removePointerEventListener($el) {
|
|
4807
|
+
globalThis.document.removeEventListener('pointermove', onPointerMove, true);
|
|
4808
|
+
$el.removeEventListener('pointerdown', onPointerDown, true);
|
|
4809
|
+
$el.removeEventListener('pointerleave', onPointerOut, true);
|
|
4810
|
+
$el.removeEventListener('pointerover', onPointerOver, true);
|
|
4811
|
+
globalThis.removeEventListener('pointerup', onPointerUp, true);
|
|
4812
|
+
};
|
|
5214
4813
|
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
4814
|
+
var removeTouchEventListener = function removeTouchEventListener($el) {
|
|
4815
|
+
$el.removeEventListener('touchstart', onPointerDown, true);
|
|
4816
|
+
$el.removeEventListener('touchend', onPointerUp, true);
|
|
4817
|
+
$el.removeEventListener('touchmove', onPointerMove, true);
|
|
4818
|
+
$el.removeEventListener('touchcancel', onPointerCancel, true);
|
|
4819
|
+
};
|
|
5218
4820
|
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
4821
|
+
var removeMouseEventListener = function removeMouseEventListener($el) {
|
|
4822
|
+
globalThis.document.removeEventListener('mousemove', onPointerMove, true);
|
|
4823
|
+
$el.removeEventListener('mousedown', onPointerDown, true);
|
|
4824
|
+
$el.removeEventListener('mouseout', onPointerOut, true);
|
|
4825
|
+
$el.removeEventListener('mouseover', onPointerOver, true);
|
|
4826
|
+
globalThis.removeEventListener('mouseup', onPointerUp, true);
|
|
4827
|
+
};
|
|
5222
4828
|
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
4829
|
+
renderingService.hooks.init.tapPromise(DOMInteractionPlugin.tag, /*#__PURE__*/_asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee() {
|
|
4830
|
+
var $el;
|
|
4831
|
+
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
4832
|
+
while (1) {
|
|
4833
|
+
switch (_context.prev = _context.next) {
|
|
4834
|
+
case 0:
|
|
4835
|
+
$el = _this.context.contextService.getDomElement(); // @ts-ignore
|
|
5226
4836
|
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
4837
|
+
if (globalThis.navigator.msPointerEnabled) {
|
|
4838
|
+
// @ts-ignore
|
|
4839
|
+
$el.style.msContentZooming = 'none'; // @ts-ignore
|
|
4840
|
+
|
|
4841
|
+
$el.style.msTouchAction = 'none';
|
|
4842
|
+
} else if (canvas.supportsPointerEvents) {
|
|
4843
|
+
$el.style.touchAction = 'none';
|
|
4844
|
+
}
|
|
5231
4845
|
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
4846
|
+
if (canvas.supportsPointerEvents) {
|
|
4847
|
+
addPointerEventListener($el);
|
|
4848
|
+
} else {
|
|
4849
|
+
addMouseEventListener($el);
|
|
4850
|
+
}
|
|
5235
4851
|
|
|
5236
|
-
|
|
5237
|
-
|
|
4852
|
+
if (canvas.supportsTouchEvents) {
|
|
4853
|
+
addTouchEventListener($el);
|
|
4854
|
+
} // use passive event listeners
|
|
4855
|
+
// @see https://zhuanlan.zhihu.com/p/24555031
|
|
5238
4856
|
|
|
5239
|
-
var anchorX = anchor && anchor[0] || 0;
|
|
5240
|
-
var anchorY = anchor && anchor[1] || 0;
|
|
5241
4857
|
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
tx = -(anchorX * width);
|
|
5247
|
-
ty = -(anchorY * height);
|
|
5248
|
-
} // apply clip shape's RTS
|
|
4858
|
+
$el.addEventListener('wheel', onPointerWheel, {
|
|
4859
|
+
passive: true,
|
|
4860
|
+
capture: true
|
|
4861
|
+
});
|
|
5249
4862
|
|
|
4863
|
+
case 5:
|
|
4864
|
+
case "end":
|
|
4865
|
+
return _context.stop();
|
|
4866
|
+
}
|
|
4867
|
+
}
|
|
4868
|
+
}, _callee);
|
|
4869
|
+
})));
|
|
4870
|
+
renderingService.hooks.destroy.tap(DOMInteractionPlugin.tag, function () {
|
|
4871
|
+
var $el = _this.context.contextService.getDomElement(); // @ts-ignore
|
|
5250
4872
|
|
|
5251
|
-
if (matrix) {
|
|
5252
|
-
copy(this.tmpMat4, object.getLocalTransform());
|
|
5253
|
-
this.vec3a[0] = tx;
|
|
5254
|
-
this.vec3a[1] = ty;
|
|
5255
|
-
this.vec3a[2] = 0;
|
|
5256
|
-
translate(this.tmpMat4, this.tmpMat4, this.vec3a);
|
|
5257
|
-
multiply$1(this.tmpMat4, matrix, this.tmpMat4);
|
|
5258
|
-
multiply$1(this.tmpMat4, this.vpMatrix, this.tmpMat4);
|
|
5259
|
-
} else {
|
|
5260
|
-
// apply RTS transformation in world space
|
|
5261
|
-
copy(this.tmpMat4, object.getWorldTransform());
|
|
5262
|
-
this.vec3a[0] = tx;
|
|
5263
|
-
this.vec3a[1] = ty;
|
|
5264
|
-
this.vec3a[2] = 0;
|
|
5265
|
-
translate(this.tmpMat4, this.tmpMat4, this.vec3a);
|
|
5266
|
-
multiply$1(this.tmpMat4, this.vpMatrix, this.tmpMat4);
|
|
5267
|
-
} // @see https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Transformations
|
|
5268
4873
|
|
|
4874
|
+
if (globalThis.navigator.msPointerEnabled) {
|
|
4875
|
+
// @ts-ignore
|
|
4876
|
+
$el.style.msContentZooming = ''; // @ts-ignore
|
|
5269
4877
|
|
|
5270
|
-
|
|
5271
|
-
|
|
4878
|
+
$el.style.msTouchAction = '';
|
|
4879
|
+
} else if (canvas.supportsPointerEvents) {
|
|
4880
|
+
$el.style.touchAction = '';
|
|
4881
|
+
}
|
|
5272
4882
|
|
|
5273
|
-
|
|
5274
|
-
|
|
4883
|
+
if (canvas.supportsPointerEvents) {
|
|
4884
|
+
removePointerEventListener($el);
|
|
4885
|
+
} else {
|
|
4886
|
+
removeMouseEventListener($el);
|
|
4887
|
+
}
|
|
5275
4888
|
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
4889
|
+
if (canvas.supportsTouchEvents) {
|
|
4890
|
+
removeTouchEventListener($el);
|
|
4891
|
+
}
|
|
5279
4892
|
|
|
5280
|
-
|
|
5281
|
-
merged.add(aabb);
|
|
4893
|
+
$el.removeEventListener('wheel', onPointerWheel, true);
|
|
5282
4894
|
});
|
|
5283
|
-
return merged;
|
|
5284
4895
|
};
|
|
5285
4896
|
|
|
5286
|
-
return
|
|
5287
|
-
}()
|
|
5288
|
-
CanvasRendererPlugin = CanvasRendererPlugin_1 = __decorate([gLite.singleton({
|
|
5289
|
-
contrib: gLite.RenderingPluginContribution
|
|
5290
|
-
}), __param(0, gLite.inject(gLite.CanvasConfig)), __param(1, gLite.inject(gLite.DefaultCamera)), __param(2, gLite.inject(gLite.ContextService)), __param(3, gLite.inject(gLite.RenderingContext)), __param(4, gLite.inject(PathGeneratorFactory)), __param(5, gLite.inject(StyleRendererFactory)), __param(6, gLite.inject(gLite.DisplayObjectPool)), __param(7, gLite.inject(CanvasRendererPluginOptions)), __param(8, gLite.inject(gLite.RBushRoot))], CanvasRendererPlugin);
|
|
5291
|
-
var containerModule$3 = gLite.Module(function (register) {
|
|
5292
|
-
var _shape2Token;
|
|
5293
|
-
|
|
5294
|
-
register(CircleRenderer);
|
|
5295
|
-
register(EllipseRenderer);
|
|
5296
|
-
register(RectRenderer);
|
|
5297
|
-
register(ImageRenderer);
|
|
5298
|
-
register(TextRenderer);
|
|
5299
|
-
register(LineRenderer);
|
|
5300
|
-
register(PolylineRenderer);
|
|
5301
|
-
register(PolygonRenderer);
|
|
5302
|
-
register(PathRenderer);
|
|
5303
|
-
var shape2Token = (_shape2Token = {}, _shape2Token[gLite.Shape.CIRCLE] = CircleRendererContribution, _shape2Token[gLite.Shape.ELLIPSE] = EllipseRendererContribution, _shape2Token[gLite.Shape.RECT] = RectRendererContribution, _shape2Token[gLite.Shape.IMAGE] = ImageRendererContribution, _shape2Token[gLite.Shape.TEXT] = TextRendererContribution, _shape2Token[gLite.Shape.LINE] = LineRendererContribution, _shape2Token[gLite.Shape.POLYLINE] = PolylineRendererContribution, _shape2Token[gLite.Shape.POLYGON] = PolygonRendererContribution, _shape2Token[gLite.Shape.PATH] = PathRendererContribution, _shape2Token);
|
|
5304
|
-
register({
|
|
5305
|
-
token: StyleRendererFactory,
|
|
5306
|
-
useFactory: function useFactory(ctx) {
|
|
5307
|
-
return function (tagName) {
|
|
5308
|
-
var token = shape2Token[tagName];
|
|
5309
|
-
|
|
5310
|
-
if (token && ctx.container.isBound(token)) {
|
|
5311
|
-
return ctx.container.get(token);
|
|
5312
|
-
}
|
|
4897
|
+
return DOMInteractionPlugin;
|
|
4898
|
+
}();
|
|
5313
4899
|
|
|
5314
|
-
|
|
5315
|
-
};
|
|
5316
|
-
}
|
|
5317
|
-
});
|
|
5318
|
-
register(CanvasRendererPlugin);
|
|
5319
|
-
});
|
|
4900
|
+
DOMInteractionPlugin.tag = 'DOMInteraction';
|
|
5320
4901
|
|
|
5321
4902
|
var Plugin$3 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
5322
4903
|
_inheritsLoose$4(Plugin, _AbstractRendererPlug);
|
|
5323
4904
|
|
|
5324
|
-
function Plugin(
|
|
4905
|
+
function Plugin() {
|
|
5325
4906
|
var _this;
|
|
5326
4907
|
|
|
5327
|
-
|
|
5328
|
-
|
|
4908
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4909
|
+
args[_key] = arguments[_key];
|
|
5329
4910
|
}
|
|
5330
4911
|
|
|
5331
|
-
_this = _AbstractRendererPlug.call(this) || this;
|
|
5332
|
-
_this.
|
|
5333
|
-
_this.name = 'canvas-renderer';
|
|
5334
|
-
_this.options = options;
|
|
4912
|
+
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
4913
|
+
_this.name = 'dom-interaction';
|
|
5335
4914
|
return _this;
|
|
5336
4915
|
}
|
|
5337
4916
|
|
|
5338
4917
|
var _proto = Plugin.prototype;
|
|
5339
4918
|
|
|
5340
4919
|
_proto.init = function init() {
|
|
5341
|
-
this.
|
|
5342
|
-
useValue: _extends({
|
|
5343
|
-
dirtyObjectNumThreshold: 500,
|
|
5344
|
-
dirtyObjectRatioThreshold: 0.8
|
|
5345
|
-
}, this.options)
|
|
5346
|
-
});
|
|
5347
|
-
this.container.load(containerModule$3, true);
|
|
4920
|
+
this.addRenderingPlugin(new DOMInteractionPlugin());
|
|
5348
4921
|
};
|
|
5349
4922
|
|
|
5350
4923
|
_proto.destroy = function destroy() {
|
|
5351
|
-
this.
|
|
5352
|
-
this.container.remove(CanvasRendererPluginOptions);
|
|
4924
|
+
this.removeAllRenderingPlugins();
|
|
5353
4925
|
};
|
|
5354
4926
|
|
|
5355
4927
|
return Plugin;
|
|
@@ -5357,26 +4929,7 @@
|
|
|
5357
4929
|
|
|
5358
4930
|
var index_esm$3 = /*#__PURE__*/Object.freeze({
|
|
5359
4931
|
__proto__: null,
|
|
5360
|
-
|
|
5361
|
-
CircleRendererContribution: CircleRendererContribution,
|
|
5362
|
-
get EllipseRenderer () { return EllipseRenderer; },
|
|
5363
|
-
EllipseRendererContribution: EllipseRendererContribution,
|
|
5364
|
-
get ImageRenderer () { return ImageRenderer; },
|
|
5365
|
-
ImageRendererContribution: ImageRendererContribution,
|
|
5366
|
-
get LineRenderer () { return LineRenderer; },
|
|
5367
|
-
LineRendererContribution: LineRendererContribution,
|
|
5368
|
-
get PathRenderer () { return PathRenderer; },
|
|
5369
|
-
PathRendererContribution: PathRendererContribution,
|
|
5370
|
-
Plugin: Plugin$3,
|
|
5371
|
-
get PolygonRenderer () { return PolygonRenderer; },
|
|
5372
|
-
PolygonRendererContribution: PolygonRendererContribution,
|
|
5373
|
-
get PolylineRenderer () { return PolylineRenderer; },
|
|
5374
|
-
PolylineRendererContribution: PolylineRendererContribution,
|
|
5375
|
-
get RectRenderer () { return RectRenderer; },
|
|
5376
|
-
RectRendererContribution: RectRendererContribution,
|
|
5377
|
-
StyleRendererFactory: StyleRendererFactory,
|
|
5378
|
-
get TextRenderer () { return TextRenderer; },
|
|
5379
|
-
TextRendererContribution: TextRendererContribution
|
|
4932
|
+
Plugin: Plugin$3
|
|
5380
4933
|
});
|
|
5381
4934
|
|
|
5382
4935
|
function _regeneratorRuntime$4() {
|
|
@@ -5780,178 +5333,258 @@
|
|
|
5780
5333
|
return _setPrototypeOf$5(o, p);
|
|
5781
5334
|
}
|
|
5782
5335
|
|
|
5783
|
-
var
|
|
5784
|
-
|
|
5785
|
-
var DOMInteractionPlugin_1;
|
|
5786
|
-
/**
|
|
5787
|
-
* listen to mouse/touch/pointer events on DOM wrapper, trigger pointer events
|
|
5788
|
-
*/
|
|
5336
|
+
var HTML_PREFIX = 'g-html-';
|
|
5789
5337
|
|
|
5790
|
-
var
|
|
5791
|
-
function
|
|
5792
|
-
this.
|
|
5793
|
-
this
|
|
5794
|
-
this.contextService = contextService;
|
|
5795
|
-
this.renderingContext = renderingContext;
|
|
5338
|
+
var HTMLRenderingPlugin = /*#__PURE__*/function () {
|
|
5339
|
+
function HTMLRenderingPlugin() {
|
|
5340
|
+
this.context = void 0;
|
|
5341
|
+
this.$camera = void 0;
|
|
5796
5342
|
}
|
|
5797
5343
|
|
|
5798
|
-
var _proto =
|
|
5344
|
+
var _proto = HTMLRenderingPlugin.prototype;
|
|
5799
5345
|
|
|
5800
|
-
_proto.apply = function apply(
|
|
5346
|
+
_proto.apply = function apply(context) {
|
|
5801
5347
|
var _this = this;
|
|
5802
5348
|
|
|
5803
|
-
var
|
|
5349
|
+
var renderingContext = context.renderingContext,
|
|
5350
|
+
renderingService = context.renderingService;
|
|
5351
|
+
this.context = context;
|
|
5804
5352
|
|
|
5805
|
-
var
|
|
5806
|
-
|
|
5353
|
+
var setTransform = function setTransform(object, $el) {
|
|
5354
|
+
var worldTransform = object.getWorldTransform();
|
|
5355
|
+
$el.style.transform = "matrix(" + [worldTransform[0], worldTransform[1], worldTransform[4], worldTransform[5], worldTransform[12], worldTransform[13]].join(',') + ")";
|
|
5807
5356
|
};
|
|
5808
5357
|
|
|
5809
|
-
var
|
|
5810
|
-
|
|
5811
|
-
};
|
|
5358
|
+
var handleMounted = function handleMounted(e) {
|
|
5359
|
+
var object = e.target;
|
|
5812
5360
|
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
};
|
|
5361
|
+
if (object.nodeName === gLite.Shape.HTML) {
|
|
5362
|
+
var $el = _this.getOrCreateEl(object); // apply documentElement's style
|
|
5816
5363
|
|
|
5817
|
-
var onPointerOver = function onPointerOver(ev) {
|
|
5818
|
-
renderingService.hooks.pointerOver.call(ev);
|
|
5819
|
-
};
|
|
5820
5364
|
|
|
5821
|
-
|
|
5822
|
-
|
|
5365
|
+
var attributes = object.ownerDocument.documentElement.attributes;
|
|
5366
|
+
Object.keys(attributes).forEach(function (name) {
|
|
5367
|
+
$el.style[name] = attributes[name];
|
|
5368
|
+
});
|
|
5369
|
+
Object.keys(object.attributes).forEach(function (name) {
|
|
5370
|
+
_this.updateAttribute(name, object);
|
|
5371
|
+
});
|
|
5372
|
+
setTransform(object, $el);
|
|
5373
|
+
}
|
|
5823
5374
|
};
|
|
5824
5375
|
|
|
5825
|
-
var
|
|
5826
|
-
|
|
5827
|
-
};
|
|
5376
|
+
var handleUnmounted = function handleUnmounted(e) {
|
|
5377
|
+
var object = e.target;
|
|
5828
5378
|
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
};
|
|
5379
|
+
if (object.nodeName === gLite.Shape.HTML) {
|
|
5380
|
+
var existedId = _this.getId(object);
|
|
5832
5381
|
|
|
5833
|
-
|
|
5834
|
-
globalThis.document.addEventListener('pointermove', onPointerMove, true);
|
|
5835
|
-
$el.addEventListener('pointerdown', onPointerDown, true);
|
|
5836
|
-
$el.addEventListener('pointerleave', onPointerOut, true);
|
|
5837
|
-
$el.addEventListener('pointerover', onPointerOver, true);
|
|
5838
|
-
globalThis.addEventListener('pointerup', onPointerUp, true);
|
|
5839
|
-
};
|
|
5382
|
+
var $container = _this.context.contextService.getDomElement().parentNode;
|
|
5840
5383
|
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5384
|
+
if ($container) {
|
|
5385
|
+
var $existedElement = $container.querySelector('#' + existedId);
|
|
5386
|
+
|
|
5387
|
+
if ($existedElement) {
|
|
5388
|
+
$container.removeChild($existedElement);
|
|
5389
|
+
}
|
|
5390
|
+
}
|
|
5391
|
+
}
|
|
5846
5392
|
};
|
|
5847
5393
|
|
|
5848
|
-
var
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5394
|
+
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
5395
|
+
var object = e.target;
|
|
5396
|
+
|
|
5397
|
+
if (object.nodeName === gLite.Shape.HTML) {
|
|
5398
|
+
var attrName = e.attrName;
|
|
5399
|
+
|
|
5400
|
+
_this.updateAttribute(attrName, object);
|
|
5401
|
+
}
|
|
5854
5402
|
};
|
|
5855
5403
|
|
|
5856
|
-
var
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5404
|
+
var handleBoundsChanged = function handleBoundsChanged(e) {
|
|
5405
|
+
var object = e.target;
|
|
5406
|
+
|
|
5407
|
+
if (object.nodeName === gLite.Shape.HTML) {
|
|
5408
|
+
var $el = _this.getOrCreateEl(object);
|
|
5409
|
+
|
|
5410
|
+
setTransform(object, $el);
|
|
5411
|
+
}
|
|
5862
5412
|
};
|
|
5863
5413
|
|
|
5864
|
-
|
|
5865
|
-
$
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5414
|
+
renderingService.hooks.init.tapPromise(HTMLRenderingPlugin.tag, /*#__PURE__*/_asyncToGenerator$4( /*#__PURE__*/_regeneratorRuntime$4().mark(function _callee() {
|
|
5415
|
+
return _regeneratorRuntime$4().wrap(function _callee$(_context) {
|
|
5416
|
+
while (1) {
|
|
5417
|
+
switch (_context.prev = _context.next) {
|
|
5418
|
+
case 0:
|
|
5419
|
+
renderingContext.root.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
5420
|
+
renderingContext.root.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
5421
|
+
renderingContext.root.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
5422
|
+
renderingContext.root.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
5423
|
+
|
|
5424
|
+
case 4:
|
|
5425
|
+
case "end":
|
|
5426
|
+
return _context.stop();
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
}, _callee);
|
|
5430
|
+
})));
|
|
5431
|
+
renderingService.hooks.destroy.tap(HTMLRenderingPlugin.tag, function () {
|
|
5432
|
+
renderingContext.root.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
5433
|
+
renderingContext.root.removeEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
5434
|
+
renderingContext.root.removeEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
5435
|
+
renderingContext.root.removeEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
5436
|
+
});
|
|
5437
|
+
};
|
|
5438
|
+
|
|
5439
|
+
_proto.getId = function getId(object) {
|
|
5440
|
+
return object.id || HTML_PREFIX + object.entity;
|
|
5441
|
+
};
|
|
5442
|
+
|
|
5443
|
+
_proto.getOrCreateEl = function getOrCreateEl(object) {
|
|
5444
|
+
var doc = this.context.config.document;
|
|
5445
|
+
var existedId = this.getId(object);
|
|
5446
|
+
var $canvas = this.context.contextService.getDomElement();
|
|
5447
|
+
var $container = $canvas.parentNode;
|
|
5448
|
+
|
|
5449
|
+
if ($container) {
|
|
5450
|
+
var $existedElement = $container.querySelector('#' + existedId);
|
|
5451
|
+
|
|
5452
|
+
if (!$existedElement) {
|
|
5453
|
+
$existedElement = (doc || document).createElement('div');
|
|
5454
|
+
object.parsedStyle.$el = $existedElement;
|
|
5455
|
+
$existedElement.id = existedId;
|
|
5456
|
+
|
|
5457
|
+
if (object.name) {
|
|
5458
|
+
$existedElement.setAttribute('name', object.name);
|
|
5459
|
+
}
|
|
5460
|
+
|
|
5461
|
+
if (object.className) {
|
|
5462
|
+
$existedElement.className = object.className;
|
|
5463
|
+
}
|
|
5464
|
+
|
|
5465
|
+
$container.appendChild($existedElement); // use absolute position
|
|
5466
|
+
|
|
5467
|
+
$existedElement.style.position = 'absolute'; // @see https://github.com/antvis/G/issues/1150
|
|
5468
|
+
|
|
5469
|
+
$existedElement.style.left = ($canvas.offsetLeft || 0) + "px";
|
|
5470
|
+
$existedElement.style.top = ($canvas.offsetTop || 0) + "px";
|
|
5471
|
+
$existedElement.style['will-change'] = 'transform';
|
|
5472
|
+
var worldTransform = object.getWorldTransform();
|
|
5473
|
+
$existedElement.style.transform = "matrix(" + [worldTransform[0], worldTransform[1], worldTransform[4], worldTransform[5], worldTransform[12], worldTransform[13]].join(',') + ")";
|
|
5474
|
+
}
|
|
5475
|
+
|
|
5476
|
+
return $existedElement;
|
|
5477
|
+
}
|
|
5478
|
+
|
|
5479
|
+
return null;
|
|
5480
|
+
};
|
|
5481
|
+
|
|
5482
|
+
_proto.updateAttribute = function updateAttribute(name, object) {
|
|
5483
|
+
var $el = this.getOrCreateEl(object);
|
|
5484
|
+
|
|
5485
|
+
switch (name) {
|
|
5486
|
+
case 'innerHTML':
|
|
5487
|
+
var innerHTML = object.parsedStyle.innerHTML;
|
|
5488
|
+
|
|
5489
|
+
if (isString(innerHTML)) {
|
|
5490
|
+
$el.innerHTML = innerHTML;
|
|
5491
|
+
} else {
|
|
5492
|
+
$el.innerHTML = '';
|
|
5493
|
+
$el.appendChild(innerHTML);
|
|
5494
|
+
}
|
|
5870
5495
|
|
|
5871
|
-
|
|
5872
|
-
globalThis.document.removeEventListener('mousemove', onPointerMove, true);
|
|
5873
|
-
$el.removeEventListener('mousedown', onPointerDown, true);
|
|
5874
|
-
$el.removeEventListener('mouseout', onPointerOut, true);
|
|
5875
|
-
$el.removeEventListener('mouseover', onPointerOver, true);
|
|
5876
|
-
globalThis.removeEventListener('mouseup', onPointerUp, true);
|
|
5877
|
-
};
|
|
5496
|
+
break;
|
|
5878
5497
|
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
switch (_context.prev = _context.next) {
|
|
5884
|
-
case 0:
|
|
5885
|
-
$el = _this.contextService.getDomElement(); // @ts-ignore
|
|
5498
|
+
case 'transformOrigin':
|
|
5499
|
+
var transformOrigin = object.parsedStyle.transformOrigin;
|
|
5500
|
+
$el.style['transform-origin'] = transformOrigin[0].value + " " + transformOrigin[1].value;
|
|
5501
|
+
break;
|
|
5886
5502
|
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5503
|
+
case 'width':
|
|
5504
|
+
var width = object.computedStyleMap().get('width');
|
|
5505
|
+
$el.style.width = width.toString();
|
|
5506
|
+
break;
|
|
5890
5507
|
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5508
|
+
case 'height':
|
|
5509
|
+
var height = object.computedStyleMap().get('height');
|
|
5510
|
+
$el.style.height = height.toString();
|
|
5511
|
+
break;
|
|
5895
5512
|
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
}
|
|
5513
|
+
case 'zIndex':
|
|
5514
|
+
var zIndex = object.parsedStyle.zIndex;
|
|
5515
|
+
$el.style['z-index'] = "" + zIndex;
|
|
5516
|
+
break;
|
|
5901
5517
|
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5518
|
+
case 'visibility':
|
|
5519
|
+
var visibility = object.parsedStyle.visibility;
|
|
5520
|
+
$el.style.visibility = visibility;
|
|
5521
|
+
break;
|
|
5522
|
+
|
|
5523
|
+
case 'pointerEvents':
|
|
5524
|
+
var pointerEvents = object.parsedStyle.pointerEvents;
|
|
5525
|
+
$el.style.pointerEvents = pointerEvents;
|
|
5526
|
+
break;
|
|
5906
5527
|
|
|
5528
|
+
case 'opacity':
|
|
5529
|
+
var opacity = object.parsedStyle.opacity;
|
|
5530
|
+
$el.style.opacity = "" + opacity;
|
|
5531
|
+
break;
|
|
5907
5532
|
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
});
|
|
5533
|
+
case 'fill':
|
|
5534
|
+
var fill = object.parsedStyle.fill;
|
|
5535
|
+
var color = '';
|
|
5912
5536
|
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5537
|
+
if (fill instanceof gLite.CSSRGB) {
|
|
5538
|
+
if (fill.isNone) {
|
|
5539
|
+
color = 'transparent';
|
|
5540
|
+
} else {
|
|
5541
|
+
color = object.getAttribute('fill');
|
|
5916
5542
|
}
|
|
5917
|
-
}
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
renderingService.hooks.destroy.tap(DOMInteractionPlugin_1.tag, function () {
|
|
5921
|
-
var $el = _this.contextService.getDomElement(); // @ts-ignore
|
|
5543
|
+
} else if (Array.isArray(fill)) {
|
|
5544
|
+
color = object.getAttribute('fill');
|
|
5545
|
+
} else if (gLite.isPattern(fill)) ;
|
|
5922
5546
|
|
|
5547
|
+
$el.style.background = color;
|
|
5548
|
+
break;
|
|
5923
5549
|
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5550
|
+
case 'stroke':
|
|
5551
|
+
var stroke = object.parsedStyle.stroke;
|
|
5552
|
+
var borderColor = '';
|
|
5927
5553
|
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5554
|
+
if (stroke instanceof gLite.CSSRGB) {
|
|
5555
|
+
if (stroke.isNone) {
|
|
5556
|
+
borderColor = 'transparent';
|
|
5557
|
+
} else {
|
|
5558
|
+
borderColor = object.getAttribute('stroke');
|
|
5559
|
+
}
|
|
5560
|
+
} else if (Array.isArray(stroke)) {
|
|
5561
|
+
borderColor = object.getAttribute('stroke');
|
|
5562
|
+
} else if (gLite.isPattern(stroke)) ;
|
|
5932
5563
|
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
removeMouseEventListener($el);
|
|
5937
|
-
}
|
|
5564
|
+
$el.style['border-color'] = borderColor;
|
|
5565
|
+
$el.style['border-style'] = 'solid';
|
|
5566
|
+
break;
|
|
5938
5567
|
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5568
|
+
case 'lineWidth':
|
|
5569
|
+
var lineWidth = object.parsedStyle.lineWidth;
|
|
5570
|
+
$el.style['border-width'] = (lineWidth || 0) + "px";
|
|
5571
|
+
break;
|
|
5942
5572
|
|
|
5943
|
-
|
|
5944
|
-
|
|
5573
|
+
case 'lineDash':
|
|
5574
|
+
$el.style['border-style'] = 'dashed';
|
|
5575
|
+
break;
|
|
5576
|
+
|
|
5577
|
+
case 'filter':
|
|
5578
|
+
var filter = object.style.filter;
|
|
5579
|
+
$el.style.filter = filter;
|
|
5580
|
+
break;
|
|
5581
|
+
}
|
|
5945
5582
|
};
|
|
5946
5583
|
|
|
5947
|
-
return
|
|
5948
|
-
}()
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
}), __param(0, gLite.inject(gLite.ContextService)), __param(1, gLite.inject(gLite.RenderingContext))], DOMInteractionPlugin);
|
|
5952
|
-
var containerModule$4 = gLite.Module(function (register) {
|
|
5953
|
-
register(DOMInteractionPlugin);
|
|
5954
|
-
});
|
|
5584
|
+
return HTMLRenderingPlugin;
|
|
5585
|
+
}();
|
|
5586
|
+
|
|
5587
|
+
HTMLRenderingPlugin.tag = 'HTMLRendering';
|
|
5955
5588
|
|
|
5956
5589
|
var Plugin$4 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
5957
5590
|
_inheritsLoose$5(Plugin, _AbstractRendererPlug);
|
|
@@ -5964,18 +5597,18 @@
|
|
|
5964
5597
|
}
|
|
5965
5598
|
|
|
5966
5599
|
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
5967
|
-
_this.name = '
|
|
5600
|
+
_this.name = 'html-renderer';
|
|
5968
5601
|
return _this;
|
|
5969
5602
|
}
|
|
5970
5603
|
|
|
5971
5604
|
var _proto = Plugin.prototype;
|
|
5972
5605
|
|
|
5973
5606
|
_proto.init = function init() {
|
|
5974
|
-
this.
|
|
5607
|
+
this.addRenderingPlugin(new HTMLRenderingPlugin());
|
|
5975
5608
|
};
|
|
5976
5609
|
|
|
5977
5610
|
_proto.destroy = function destroy() {
|
|
5978
|
-
this.
|
|
5611
|
+
this.removeAllRenderingPlugins();
|
|
5979
5612
|
};
|
|
5980
5613
|
|
|
5981
5614
|
return Plugin;
|
|
@@ -6387,271 +6020,247 @@
|
|
|
6387
6020
|
return _setPrototypeOf$6(o, p);
|
|
6388
6021
|
}
|
|
6389
6022
|
|
|
6390
|
-
var
|
|
6391
|
-
|
|
6392
|
-
var HTMLRenderingPlugin_1;
|
|
6393
|
-
var HTML_PREFIX = 'g-html-';
|
|
6394
|
-
var HTMLRenderingPlugin = HTMLRenderingPlugin_1 = (_class$4 = /*#__PURE__*/function () {
|
|
6395
|
-
function HTMLRenderingPlugin(contextService, renderingContext, canvasConfig) {
|
|
6396
|
-
this.contextService = void 0;
|
|
6397
|
-
this.renderingContext = void 0;
|
|
6023
|
+
var ImagePool = /*#__PURE__*/function () {
|
|
6024
|
+
function ImagePool(canvasConfig) {
|
|
6398
6025
|
this.canvasConfig = void 0;
|
|
6399
|
-
this
|
|
6400
|
-
this.
|
|
6401
|
-
this.
|
|
6026
|
+
this.imageCache = {};
|
|
6027
|
+
this.gradientCache = {};
|
|
6028
|
+
this.patternCache = {};
|
|
6402
6029
|
this.canvasConfig = canvasConfig;
|
|
6403
6030
|
}
|
|
6404
6031
|
|
|
6405
|
-
var _proto =
|
|
6406
|
-
|
|
6407
|
-
_proto.apply = function apply(renderingService) {
|
|
6408
|
-
var _this = this;
|
|
6409
|
-
|
|
6410
|
-
var setTransform = function setTransform(object, $el) {
|
|
6411
|
-
var worldTransform = object.getWorldTransform();
|
|
6412
|
-
$el.style.transform = "matrix(" + [worldTransform[0], worldTransform[1], worldTransform[4], worldTransform[5], worldTransform[12], worldTransform[13]].join(',') + ")";
|
|
6413
|
-
};
|
|
6414
|
-
|
|
6415
|
-
var handleMounted = function handleMounted(e) {
|
|
6416
|
-
var object = e.target;
|
|
6417
|
-
|
|
6418
|
-
if (object.nodeName === gLite.Shape.HTML) {
|
|
6419
|
-
var $el = _this.getOrCreateEl(object); // apply documentElement's style
|
|
6420
|
-
|
|
6032
|
+
var _proto = ImagePool.prototype;
|
|
6421
6033
|
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6034
|
+
_proto.getImageSync = function getImageSync(src, callback) {
|
|
6035
|
+
if (!this.imageCache[src]) {
|
|
6036
|
+
this.getOrCreateImage(src).then(function () {
|
|
6037
|
+
if (callback) {
|
|
6038
|
+
callback();
|
|
6039
|
+
}
|
|
6040
|
+
});
|
|
6041
|
+
} else {
|
|
6042
|
+
if (callback) {
|
|
6043
|
+
callback();
|
|
6430
6044
|
}
|
|
6431
|
-
}
|
|
6432
|
-
|
|
6433
|
-
var handleUnmounted = function handleUnmounted(e) {
|
|
6434
|
-
var object = e.target;
|
|
6435
|
-
|
|
6436
|
-
if (object.nodeName === gLite.Shape.HTML) {
|
|
6437
|
-
var existedId = _this.getId(object);
|
|
6045
|
+
}
|
|
6438
6046
|
|
|
6439
|
-
|
|
6047
|
+
return this.imageCache[src];
|
|
6048
|
+
};
|
|
6440
6049
|
|
|
6441
|
-
|
|
6442
|
-
|
|
6050
|
+
_proto.getOrCreateImage = function getOrCreateImage(src) {
|
|
6051
|
+
var _this = this;
|
|
6443
6052
|
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
}
|
|
6448
|
-
}
|
|
6449
|
-
};
|
|
6053
|
+
if (this.imageCache[src]) {
|
|
6054
|
+
return Promise.resolve(this.imageCache[src]);
|
|
6055
|
+
} // @see https://github.com/antvis/g/issues/938
|
|
6450
6056
|
|
|
6451
|
-
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
6452
|
-
var object = e.target;
|
|
6453
6057
|
|
|
6454
|
-
|
|
6455
|
-
|
|
6058
|
+
var createImage = this.canvasConfig.createImage;
|
|
6059
|
+
return new Promise(function (resolve, reject) {
|
|
6060
|
+
var image;
|
|
6456
6061
|
|
|
6457
|
-
|
|
6062
|
+
if (createImage) {
|
|
6063
|
+
image = createImage(src);
|
|
6064
|
+
} else if (gLite.isBrowser) {
|
|
6065
|
+
image = new window.Image();
|
|
6458
6066
|
}
|
|
6459
|
-
};
|
|
6460
6067
|
|
|
6461
|
-
|
|
6462
|
-
|
|
6068
|
+
if (image) {
|
|
6069
|
+
image.onload = function () {
|
|
6070
|
+
resolve(image);
|
|
6071
|
+
};
|
|
6463
6072
|
|
|
6464
|
-
|
|
6465
|
-
|
|
6073
|
+
image.onerror = function (ev) {
|
|
6074
|
+
reject(ev);
|
|
6075
|
+
};
|
|
6466
6076
|
|
|
6467
|
-
|
|
6077
|
+
image.crossOrigin = 'Anonymous';
|
|
6078
|
+
image.src = src;
|
|
6079
|
+
_this.imageCache[src] = image;
|
|
6468
6080
|
}
|
|
6469
|
-
};
|
|
6470
|
-
|
|
6471
|
-
renderingService.hooks.init.tapPromise(HTMLRenderingPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$5( /*#__PURE__*/_regeneratorRuntime$5().mark(function _callee() {
|
|
6472
|
-
return _regeneratorRuntime$5().wrap(function _callee$(_context) {
|
|
6473
|
-
while (1) {
|
|
6474
|
-
switch (_context.prev = _context.next) {
|
|
6475
|
-
case 0:
|
|
6476
|
-
_this.renderingContext.root.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
6081
|
+
});
|
|
6082
|
+
};
|
|
6477
6083
|
|
|
6478
|
-
|
|
6084
|
+
_proto.getOrCreatePatternSync = function getOrCreatePatternSync(pattern, context, callback) {
|
|
6085
|
+
var patternKey = this.generatePatternKey(pattern);
|
|
6479
6086
|
|
|
6480
|
-
|
|
6087
|
+
if (patternKey && this.patternCache[patternKey]) {
|
|
6088
|
+
return this.patternCache[patternKey];
|
|
6089
|
+
}
|
|
6481
6090
|
|
|
6482
|
-
|
|
6091
|
+
var image = pattern.image,
|
|
6092
|
+
repetition = pattern.repetition;
|
|
6093
|
+
var src; // Image URL
|
|
6483
6094
|
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
}, _callee);
|
|
6490
|
-
})));
|
|
6491
|
-
renderingService.hooks.destroy.tap(HTMLRenderingPlugin_1.tag, function () {
|
|
6492
|
-
_this.renderingContext.root.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
6095
|
+
if (isString(image)) {
|
|
6096
|
+
src = this.getImageSync(image, callback);
|
|
6097
|
+
} else {
|
|
6098
|
+
src = image;
|
|
6099
|
+
} // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createPattern
|
|
6493
6100
|
|
|
6494
|
-
_this.renderingContext.root.removeEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
6495
6101
|
|
|
6496
|
-
|
|
6102
|
+
var canvasPattern = src && context.createPattern(src, repetition);
|
|
6497
6103
|
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6104
|
+
if (patternKey && canvasPattern) {
|
|
6105
|
+
this.patternCache[patternKey] = canvasPattern;
|
|
6106
|
+
}
|
|
6501
6107
|
|
|
6502
|
-
|
|
6503
|
-
return object.id || HTML_PREFIX + object.entity;
|
|
6108
|
+
return canvasPattern;
|
|
6504
6109
|
};
|
|
6505
6110
|
|
|
6506
|
-
_proto.
|
|
6507
|
-
var
|
|
6508
|
-
var
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6111
|
+
_proto.getOrCreateGradient = function getOrCreateGradient(params, context) {
|
|
6112
|
+
var key = this.generateGradientKey(params);
|
|
6113
|
+
var type = params.type,
|
|
6114
|
+
steps = params.steps,
|
|
6115
|
+
width = params.width,
|
|
6116
|
+
height = params.height,
|
|
6117
|
+
angle = params.angle,
|
|
6118
|
+
cx = params.cx,
|
|
6119
|
+
cy = params.cy,
|
|
6120
|
+
size = params.size;
|
|
6514
6121
|
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
$existedElement.id = existedId;
|
|
6122
|
+
if (this.gradientCache[key]) {
|
|
6123
|
+
return this.gradientCache[key];
|
|
6124
|
+
}
|
|
6519
6125
|
|
|
6520
|
-
|
|
6521
|
-
$existedElement.setAttribute('name', object.name);
|
|
6522
|
-
}
|
|
6126
|
+
var gradient = null;
|
|
6523
6127
|
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6128
|
+
if (type === gLite.GradientType.LinearGradient) {
|
|
6129
|
+
var _computeLinearGradien = gLite.computeLinearGradient(width, height, angle),
|
|
6130
|
+
x1 = _computeLinearGradien.x1,
|
|
6131
|
+
y1 = _computeLinearGradien.y1,
|
|
6132
|
+
x2 = _computeLinearGradien.x2,
|
|
6133
|
+
y2 = _computeLinearGradien.y2; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createLinearGradient
|
|
6527
6134
|
|
|
6528
|
-
$container.appendChild($existedElement); // use absolute position
|
|
6529
6135
|
|
|
6530
|
-
|
|
6136
|
+
gradient = context.createLinearGradient(x1, y1, x2, y2);
|
|
6137
|
+
} else if (type === gLite.GradientType.RadialGradient) {
|
|
6138
|
+
var _computeRadialGradien = gLite.computeRadialGradient(width, height, cx, cy, size),
|
|
6139
|
+
x = _computeRadialGradien.x,
|
|
6140
|
+
y = _computeRadialGradien.y,
|
|
6141
|
+
r = _computeRadialGradien.r; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createRadialGradient
|
|
6531
6142
|
|
|
6532
|
-
$existedElement.style.left = ($canvas.offsetLeft || 0) + "px";
|
|
6533
|
-
$existedElement.style.top = ($canvas.offsetTop || 0) + "px";
|
|
6534
|
-
$existedElement.style['will-change'] = 'transform';
|
|
6535
|
-
var worldTransform = object.getWorldTransform();
|
|
6536
|
-
$existedElement.style.transform = "matrix(" + [worldTransform[0], worldTransform[1], worldTransform[4], worldTransform[5], worldTransform[12], worldTransform[13]].join(',') + ")";
|
|
6537
|
-
}
|
|
6538
6143
|
|
|
6539
|
-
|
|
6144
|
+
gradient = context.createRadialGradient(x, y, 0, x, y, r);
|
|
6540
6145
|
}
|
|
6541
6146
|
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
var $el = this.getOrCreateEl(object);
|
|
6147
|
+
if (gradient) {
|
|
6148
|
+
steps.forEach(function (_ref) {
|
|
6149
|
+
var offset = _ref.offset,
|
|
6150
|
+
color = _ref.color;
|
|
6547
6151
|
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
var innerHTML = object.parsedStyle.innerHTML;
|
|
6152
|
+
if (offset.unit === gLite.UnitType.kPercentage) {
|
|
6153
|
+
var _gradient;
|
|
6551
6154
|
|
|
6552
|
-
|
|
6553
|
-
$el.innerHTML = innerHTML;
|
|
6554
|
-
} else {
|
|
6555
|
-
$el.innerHTML = '';
|
|
6556
|
-
$el.appendChild(innerHTML);
|
|
6155
|
+
(_gradient = gradient) === null || _gradient === void 0 ? void 0 : _gradient.addColorStop(offset.value / 100, color.toString());
|
|
6557
6156
|
}
|
|
6157
|
+
});
|
|
6158
|
+
this.gradientCache[key] = gradient;
|
|
6159
|
+
}
|
|
6558
6160
|
|
|
6559
|
-
|
|
6161
|
+
return this.gradientCache[key];
|
|
6162
|
+
};
|
|
6560
6163
|
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6164
|
+
_proto.generateGradientKey = function generateGradientKey(params) {
|
|
6165
|
+
var type = params.type,
|
|
6166
|
+
width = params.width,
|
|
6167
|
+
height = params.height,
|
|
6168
|
+
steps = params.steps,
|
|
6169
|
+
angle = params.angle,
|
|
6170
|
+
cx = params.cx,
|
|
6171
|
+
cy = params.cy,
|
|
6172
|
+
size = params.size;
|
|
6173
|
+
return "gradient-" + type + "-" + ((angle === null || angle === void 0 ? void 0 : angle.toString()) || 0) + "-" + ((cx === null || cx === void 0 ? void 0 : cx.toString()) || 0) + "-" + ((cy === null || cy === void 0 ? void 0 : cy.toString()) || 0) + "-" + ((size === null || size === void 0 ? void 0 : size.toString()) || 0) + "-" + width + "-" + height + "-" + steps.map(function (_ref2) {
|
|
6174
|
+
var offset = _ref2.offset,
|
|
6175
|
+
color = _ref2.color;
|
|
6176
|
+
return "" + offset + color;
|
|
6177
|
+
}).join('-');
|
|
6178
|
+
};
|
|
6565
6179
|
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
break;
|
|
6180
|
+
_proto.generatePatternKey = function generatePatternKey(pattern) {
|
|
6181
|
+
var image = pattern.image,
|
|
6182
|
+
repetition = pattern.repetition; // only generate cache for Image
|
|
6570
6183
|
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6184
|
+
if (isString(image)) {
|
|
6185
|
+
return "pattern-" + image + "-" + repetition;
|
|
6186
|
+
}
|
|
6187
|
+
};
|
|
6575
6188
|
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
$el.style['z-index'] = "" + zIndex;
|
|
6579
|
-
break;
|
|
6189
|
+
return ImagePool;
|
|
6190
|
+
}();
|
|
6580
6191
|
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
$el.style.visibility = visibility;
|
|
6584
|
-
break;
|
|
6192
|
+
var LoadImagePlugin = /*#__PURE__*/function () {
|
|
6193
|
+
function LoadImagePlugin() {}
|
|
6585
6194
|
|
|
6586
|
-
|
|
6587
|
-
var pointerEvents = object.parsedStyle.pointerEvents;
|
|
6588
|
-
$el.style.pointerEvents = pointerEvents;
|
|
6589
|
-
break;
|
|
6195
|
+
var _proto = LoadImagePlugin.prototype;
|
|
6590
6196
|
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6197
|
+
_proto.apply = function apply(context) {
|
|
6198
|
+
// @ts-ignore
|
|
6199
|
+
var renderingService = context.renderingService,
|
|
6200
|
+
renderingContext = context.renderingContext,
|
|
6201
|
+
imagePool = context.imagePool;
|
|
6595
6202
|
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6203
|
+
var handleMounted = function handleMounted(e) {
|
|
6204
|
+
var object = e.target;
|
|
6205
|
+
var nodeName = object.nodeName,
|
|
6206
|
+
attributes = object.attributes;
|
|
6599
6207
|
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
color = 'transparent';
|
|
6603
|
-
} else {
|
|
6604
|
-
color = object.getAttribute('fill');
|
|
6605
|
-
}
|
|
6606
|
-
} else if (Array.isArray(fill)) {
|
|
6607
|
-
color = object.getAttribute('fill');
|
|
6608
|
-
} else if (gLite.isPattern(fill)) ;
|
|
6208
|
+
if (nodeName === gLite.Shape.IMAGE) {
|
|
6209
|
+
var img = attributes.img;
|
|
6609
6210
|
|
|
6610
|
-
|
|
6611
|
-
|
|
6211
|
+
if (isString(img)) {
|
|
6212
|
+
imagePool.getImageSync(img, function () {
|
|
6213
|
+
// set dirty rectangle flag
|
|
6214
|
+
object.renderable.dirty = true;
|
|
6215
|
+
renderingService.dirtify();
|
|
6216
|
+
});
|
|
6217
|
+
}
|
|
6218
|
+
}
|
|
6219
|
+
};
|
|
6612
6220
|
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6221
|
+
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
6222
|
+
var object = e.target;
|
|
6223
|
+
var attrName = e.attrName,
|
|
6224
|
+
newValue = e.newValue;
|
|
6616
6225
|
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6226
|
+
if (object.nodeName === gLite.Shape.IMAGE) {
|
|
6227
|
+
if (attrName === 'img') {
|
|
6228
|
+
if (isString(newValue)) {
|
|
6229
|
+
imagePool.getOrCreateImage(newValue).then(function () {
|
|
6230
|
+
// set dirty rectangle flag
|
|
6231
|
+
object.renderable.dirty = true;
|
|
6232
|
+
renderingService.dirtify();
|
|
6233
|
+
});
|
|
6622
6234
|
}
|
|
6623
|
-
}
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
$el.style['border-color'] = borderColor;
|
|
6628
|
-
$el.style['border-style'] = 'solid';
|
|
6629
|
-
break;
|
|
6630
|
-
|
|
6631
|
-
case 'lineWidth':
|
|
6632
|
-
var lineWidth = object.parsedStyle.lineWidth;
|
|
6633
|
-
$el.style['border-width'] = (lineWidth || 0) + "px";
|
|
6634
|
-
break;
|
|
6235
|
+
}
|
|
6236
|
+
}
|
|
6237
|
+
};
|
|
6635
6238
|
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6239
|
+
renderingService.hooks.init.tapPromise(LoadImagePlugin.tag, /*#__PURE__*/_asyncToGenerator$5( /*#__PURE__*/_regeneratorRuntime$5().mark(function _callee() {
|
|
6240
|
+
return _regeneratorRuntime$5().wrap(function _callee$(_context) {
|
|
6241
|
+
while (1) {
|
|
6242
|
+
switch (_context.prev = _context.next) {
|
|
6243
|
+
case 0:
|
|
6244
|
+
renderingContext.root.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
6245
|
+
renderingContext.root.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
6639
6246
|
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6247
|
+
case 2:
|
|
6248
|
+
case "end":
|
|
6249
|
+
return _context.stop();
|
|
6250
|
+
}
|
|
6251
|
+
}
|
|
6252
|
+
}, _callee);
|
|
6253
|
+
})));
|
|
6254
|
+
renderingService.hooks.destroy.tap(LoadImagePlugin.tag, function () {
|
|
6255
|
+
renderingContext.root.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
6256
|
+
renderingContext.root.removeEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
6257
|
+
});
|
|
6645
6258
|
};
|
|
6646
6259
|
|
|
6647
|
-
return
|
|
6648
|
-
}()
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
}), __param(0, gLite.inject(gLite.ContextService)), __param(1, gLite.inject(gLite.RenderingContext)), __param(2, gLite.inject(gLite.CanvasConfig))], HTMLRenderingPlugin);
|
|
6652
|
-
var containerModule$5 = gLite.Module(function (register) {
|
|
6653
|
-
register(HTMLRenderingPlugin);
|
|
6654
|
-
});
|
|
6260
|
+
return LoadImagePlugin;
|
|
6261
|
+
}();
|
|
6262
|
+
|
|
6263
|
+
LoadImagePlugin.tag = 'LoadImage';
|
|
6655
6264
|
|
|
6656
6265
|
var Plugin$5 = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
6657
6266
|
_inheritsLoose$6(Plugin, _AbstractRendererPlug);
|
|
@@ -6664,18 +6273,20 @@
|
|
|
6664
6273
|
}
|
|
6665
6274
|
|
|
6666
6275
|
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
6667
|
-
_this.name = '
|
|
6276
|
+
_this.name = 'image-loader';
|
|
6668
6277
|
return _this;
|
|
6669
6278
|
}
|
|
6670
6279
|
|
|
6671
6280
|
var _proto = Plugin.prototype;
|
|
6672
6281
|
|
|
6673
6282
|
_proto.init = function init() {
|
|
6674
|
-
|
|
6283
|
+
// @ts-ignore
|
|
6284
|
+
this.context.imagePool = new ImagePool(this.context.config);
|
|
6285
|
+
this.addRenderingPlugin(new LoadImagePlugin());
|
|
6675
6286
|
};
|
|
6676
6287
|
|
|
6677
6288
|
_proto.destroy = function destroy() {
|
|
6678
|
-
this.
|
|
6289
|
+
this.removeAllRenderingPlugins();
|
|
6679
6290
|
};
|
|
6680
6291
|
|
|
6681
6292
|
return Plugin;
|
|
@@ -6683,19 +6294,20 @@
|
|
|
6683
6294
|
|
|
6684
6295
|
var index_esm$5 = /*#__PURE__*/Object.freeze({
|
|
6685
6296
|
__proto__: null,
|
|
6297
|
+
ImagePool: ImagePool,
|
|
6686
6298
|
Plugin: Plugin$5
|
|
6687
6299
|
});
|
|
6688
6300
|
|
|
6689
6301
|
var Canvas2DContextService = /*#__PURE__*/function () {
|
|
6690
|
-
function Canvas2DContextService(
|
|
6691
|
-
this.canvasConfig = void 0;
|
|
6692
|
-
this.renderingContext = void 0;
|
|
6302
|
+
function Canvas2DContextService(context) {
|
|
6693
6303
|
this.$container = void 0;
|
|
6694
6304
|
this.$canvas = void 0;
|
|
6695
6305
|
this.dpr = void 0;
|
|
6696
6306
|
this.context = void 0;
|
|
6697
|
-
this.canvasConfig =
|
|
6698
|
-
this.renderingContext =
|
|
6307
|
+
this.canvasConfig = void 0;
|
|
6308
|
+
this.renderingContext = void 0;
|
|
6309
|
+
this.renderingContext = context.renderingContext;
|
|
6310
|
+
this.canvasConfig = context.config;
|
|
6699
6311
|
}
|
|
6700
6312
|
|
|
6701
6313
|
var _proto = Canvas2DContextService.prototype;
|
|
@@ -6841,16 +6453,6 @@
|
|
|
6841
6453
|
return Canvas2DContextService;
|
|
6842
6454
|
}();
|
|
6843
6455
|
|
|
6844
|
-
Canvas2DContextService = __decorate([gLite.singleton({
|
|
6845
|
-
token: gLite.ContextService
|
|
6846
|
-
}), __param(0, gLite.inject(gLite.CanvasConfig)), __param(1, gLite.inject(gLite.RenderingContext))], Canvas2DContextService);
|
|
6847
|
-
|
|
6848
|
-
var containerModule$6 = gLite.Module(function (register) {
|
|
6849
|
-
/**
|
|
6850
|
-
* implements ContextService
|
|
6851
|
-
*/
|
|
6852
|
-
register(Canvas2DContextService);
|
|
6853
|
-
});
|
|
6854
6456
|
var ContextRegisterPlugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
6855
6457
|
_inheritsLoose(ContextRegisterPlugin, _AbstractRendererPlug);
|
|
6856
6458
|
|
|
@@ -6869,11 +6471,11 @@
|
|
|
6869
6471
|
var _proto = ContextRegisterPlugin.prototype;
|
|
6870
6472
|
|
|
6871
6473
|
_proto.init = function init() {
|
|
6872
|
-
this.
|
|
6474
|
+
this.context.ContextService = Canvas2DContextService;
|
|
6873
6475
|
};
|
|
6874
6476
|
|
|
6875
6477
|
_proto.destroy = function destroy() {
|
|
6876
|
-
this.
|
|
6478
|
+
delete this.context.ContextService;
|
|
6877
6479
|
};
|
|
6878
6480
|
|
|
6879
6481
|
return ContextRegisterPlugin;
|
|
@@ -6889,20 +6491,20 @@
|
|
|
6889
6491
|
|
|
6890
6492
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
6891
6493
|
|
|
6892
|
-
_this.registerPlugin(new Plugin$
|
|
6494
|
+
_this.registerPlugin(new Plugin$5());
|
|
6893
6495
|
|
|
6894
6496
|
_this.registerPlugin(new Plugin()); // enable rendering with Canvas2D API
|
|
6895
6497
|
|
|
6896
6498
|
|
|
6897
|
-
_this.registerPlugin(new Plugin$
|
|
6499
|
+
_this.registerPlugin(new Plugin$2());
|
|
6898
6500
|
|
|
6899
|
-
_this.registerPlugin(new Plugin$
|
|
6501
|
+
_this.registerPlugin(new Plugin$3()); // enable picking with Canvas2D API
|
|
6900
6502
|
|
|
6901
6503
|
|
|
6902
6504
|
_this.registerPlugin(new Plugin$1()); // render HTML component
|
|
6903
6505
|
|
|
6904
6506
|
|
|
6905
|
-
_this.registerPlugin(new Plugin$
|
|
6507
|
+
_this.registerPlugin(new Plugin$4());
|
|
6906
6508
|
|
|
6907
6509
|
return _this;
|
|
6908
6510
|
}
|
|
@@ -6912,10 +6514,10 @@
|
|
|
6912
6514
|
|
|
6913
6515
|
exports.CanvasPathGenerator = index_esm;
|
|
6914
6516
|
exports.CanvasPicker = index_esm$1;
|
|
6915
|
-
exports.CanvasRenderer = index_esm$
|
|
6916
|
-
exports.DomInteraction = index_esm$
|
|
6917
|
-
exports.HTMLRenderer = index_esm$
|
|
6918
|
-
exports.ImageLoader = index_esm$
|
|
6517
|
+
exports.CanvasRenderer = index_esm$2;
|
|
6518
|
+
exports.DomInteraction = index_esm$3;
|
|
6519
|
+
exports.HTMLRenderer = index_esm$4;
|
|
6520
|
+
exports.ImageLoader = index_esm$5;
|
|
6919
6521
|
exports.Renderer = Renderer;
|
|
6920
6522
|
|
|
6921
6523
|
Object.defineProperty(exports, '__esModule', { value: true });
|