@antv/g-svg 1.1.8 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1 -2
- package/dist/index.js +1 -2
- package/dist/index.umd.js +1500 -1252
- package/dist/index.umd.min.js +4 -4
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
|
@@ -393,11 +393,10 @@
|
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
function _setPrototypeOf(o, p) {
|
|
396
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
396
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
397
397
|
o.__proto__ = p;
|
|
398
398
|
return o;
|
|
399
399
|
};
|
|
400
|
-
|
|
401
400
|
return _setPrototypeOf(o, p);
|
|
402
401
|
}
|
|
403
402
|
|
|
@@ -1001,6 +1000,39 @@
|
|
|
1001
1000
|
Plugin: Plugin
|
|
1002
1001
|
});
|
|
1003
1002
|
|
|
1003
|
+
function clonePath(path) {
|
|
1004
|
+
return path.map((x) => (Array.isArray(x) ? [...x] : x));
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Rounds the values of a `PathArray` instance to
|
|
1009
|
+
* a specified amount of decimals and returns it.
|
|
1010
|
+
*/
|
|
1011
|
+
function roundPath(path, round) {
|
|
1012
|
+
if (round === 'off')
|
|
1013
|
+
return clonePath(path);
|
|
1014
|
+
// to round values to the power
|
|
1015
|
+
// the `round` value must be integer
|
|
1016
|
+
const pow = typeof round === 'number' && round >= 1 ? Math.pow(10, round) : 1;
|
|
1017
|
+
return path.map((pi) => {
|
|
1018
|
+
const values = pi
|
|
1019
|
+
.slice(1)
|
|
1020
|
+
.map(Number)
|
|
1021
|
+
.map((n) => (round ? Math.round(n * pow) / pow : Math.round(n)));
|
|
1022
|
+
return [pi[0], ...values];
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Returns a valid `d` attribute string value created
|
|
1028
|
+
* by rounding values and concatenating the `pathArray` segments.
|
|
1029
|
+
*/
|
|
1030
|
+
function path2String(path, round = 'off') {
|
|
1031
|
+
return roundPath(path, round)
|
|
1032
|
+
.map((x) => x[0] + x.slice(1).join(' '))
|
|
1033
|
+
.join('');
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1004
1036
|
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
|
|
1005
1037
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1006
1038
|
if (ar || !(i in from)) {
|
|
@@ -1270,8 +1302,11 @@
|
|
|
1270
1302
|
y1 = parsedStyle.y1,
|
|
1271
1303
|
x2 = parsedStyle.x2,
|
|
1272
1304
|
y2 = parsedStyle.y2,
|
|
1273
|
-
defX = parsedStyle.defX,
|
|
1274
|
-
|
|
1305
|
+
_parsedStyle$defX = parsedStyle.defX,
|
|
1306
|
+
defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
|
|
1307
|
+
_parsedStyle$defY = parsedStyle.defY,
|
|
1308
|
+
defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY; // @see https://github.com/antvis/g/issues/1038
|
|
1309
|
+
|
|
1275
1310
|
$el.setAttribute('x1', "" + (x1.value - defX));
|
|
1276
1311
|
$el.setAttribute('y1', "" + (y1.value - defY));
|
|
1277
1312
|
$el.setAttribute('x2', "" + (x2.value - defX));
|
|
@@ -1279,56 +1314,16 @@
|
|
|
1279
1314
|
}
|
|
1280
1315
|
|
|
1281
1316
|
function updatePathElementAttribute($el, parsedStyle) {
|
|
1282
|
-
var path = parsedStyle.path
|
|
1283
|
-
|
|
1284
|
-
x = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
|
|
1285
|
-
_parsedStyle$defY = parsedStyle.defY,
|
|
1286
|
-
y = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY;
|
|
1287
|
-
$el.setAttribute('d', formatPath(path.absolutePath, x, y));
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
function formatPath(value, x, y) {
|
|
1291
|
-
var newValue = value.map(function (params) {
|
|
1292
|
-
var command = params[0];
|
|
1293
|
-
|
|
1294
|
-
switch (command) {
|
|
1295
|
-
case 'M':
|
|
1296
|
-
return "M " + (params[1] - x) + "," + (params[2] - y);
|
|
1297
|
-
|
|
1298
|
-
case 'L':
|
|
1299
|
-
return "L " + (params[1] - x) + "," + (params[2] - y);
|
|
1300
|
-
|
|
1301
|
-
case 'Q':
|
|
1302
|
-
return "Q " + (params[1] - x) + " " + (params[2] - y) + "," + (params[3] - x) + " " + (params[4] - y);
|
|
1303
|
-
|
|
1304
|
-
case 'C':
|
|
1305
|
-
return "C " + (params[1] - x) + " " + (params[2] - y) + "," + (params[3] - x) + " " + (params[4] - y) + "," + (params[5] - x) + " " + (params[6] - y);
|
|
1306
|
-
|
|
1307
|
-
case 'A':
|
|
1308
|
-
return "A " + params[1] + " " + params[2] + " " + params[3] + " " + params[4] + " " + params[5] + " " + (params[6] - x) + " " + (params[7] - y);
|
|
1309
|
-
|
|
1310
|
-
case 'Z':
|
|
1311
|
-
return 'Z';
|
|
1312
|
-
}
|
|
1313
|
-
}).join(' ');
|
|
1314
|
-
|
|
1315
|
-
if (~newValue.indexOf('NaN')) {
|
|
1316
|
-
return '';
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
return newValue;
|
|
1317
|
+
var path = parsedStyle.path;
|
|
1318
|
+
$el.setAttribute('d', path2String(path.absolutePath, 3));
|
|
1320
1319
|
}
|
|
1321
1320
|
|
|
1322
1321
|
function updatePolylineElementAttribute($el, parsedStyle) {
|
|
1323
|
-
var points = parsedStyle.points
|
|
1324
|
-
_parsedStyle$defX = parsedStyle.defX,
|
|
1325
|
-
x = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
|
|
1326
|
-
_parsedStyle$defY = parsedStyle.defY,
|
|
1327
|
-
y = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY;
|
|
1322
|
+
var points = parsedStyle.points;
|
|
1328
1323
|
|
|
1329
1324
|
if (points && points.points && points.points.length >= 2) {
|
|
1330
1325
|
$el.setAttribute('points', points.points.map(function (point) {
|
|
1331
|
-
return point[0]
|
|
1326
|
+
return point[0] + "," + point[1];
|
|
1332
1327
|
}).join(' '));
|
|
1333
1328
|
}
|
|
1334
1329
|
}
|
|
@@ -1336,7 +1331,12 @@
|
|
|
1336
1331
|
function updateRectElementAttribute($el, parsedStyle) {
|
|
1337
1332
|
var radius = parsedStyle.radius,
|
|
1338
1333
|
width = parsedStyle.width,
|
|
1339
|
-
height = parsedStyle.height;
|
|
1334
|
+
height = parsedStyle.height; // CSSKeyword: auto
|
|
1335
|
+
|
|
1336
|
+
if (!isFinite(width.value) || !isFinite(height.value)) {
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
1340
|
var hasRadius = radius && radius.some(function (r) {
|
|
1341
1341
|
return r.value !== 0;
|
|
1342
1342
|
});
|
|
@@ -1346,14 +1346,18 @@
|
|
|
1346
1346
|
d = "M 0,0 l " + width.value + ",0 l 0," + height.value + " l" + -width.value + " 0 z";
|
|
1347
1347
|
} else {
|
|
1348
1348
|
var _radius$map = radius.map(function (r) {
|
|
1349
|
-
return g.clamp(r.value, 0, Math.min(width.value / 2, height.value / 2));
|
|
1349
|
+
return g.clamp(r.value, 0, Math.min(Math.abs(width.value) / 2, Math.abs(height.value) / 2));
|
|
1350
1350
|
}),
|
|
1351
1351
|
tlr = _radius$map[0],
|
|
1352
1352
|
trr = _radius$map[1],
|
|
1353
1353
|
brr = _radius$map[2],
|
|
1354
1354
|
blr = _radius$map[3];
|
|
1355
1355
|
|
|
1356
|
-
|
|
1356
|
+
var signX = width.value > 0 ? 1 : -1;
|
|
1357
|
+
var signY = height.value > 0 ? 1 : -1; // sweep-flag @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Paths#arcs
|
|
1358
|
+
|
|
1359
|
+
var sweepFlag = signX + signY !== 0 ? 1 : 0;
|
|
1360
|
+
d = [["M " + signX * tlr + ",0"], ["l " + (width.value - signX * (tlr + trr)) + ",0"], ["a " + trr + "," + trr + ",0,0," + sweepFlag + "," + signX * trr + "," + signY * trr], ["l 0," + (height.value - signY * (trr + brr))], ["a " + brr + "," + brr + ",0,0," + sweepFlag + "," + -signX * brr + "," + signY * brr], ["l " + (signX * (brr + blr) - width.value) + ",0"], ["a " + blr + "," + blr + ",0,0," + sweepFlag + "," + -signX * blr + "," + -signY * blr], ["l 0," + (signY * (blr + tlr) - height.value)], ["a " + tlr + "," + tlr + ",0,0," + sweepFlag + "," + signX * tlr + "," + -signY * tlr], ['z']].join(' ');
|
|
1357
1361
|
}
|
|
1358
1362
|
|
|
1359
1363
|
$el.setAttribute('d', d);
|
|
@@ -1533,1444 +1537,1669 @@
|
|
|
1533
1537
|
DefaultCreateElementContribution = __decorate([g.singleton({
|
|
1534
1538
|
token: CreateElementContribution
|
|
1535
1539
|
})], DefaultCreateElementContribution);
|
|
1540
|
+
var FILTER_PREFIX = 'g-filter-';
|
|
1541
|
+
/**
|
|
1542
|
+
* use SVG filters, eg. blur, brightness, contrast...
|
|
1543
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/filter
|
|
1544
|
+
*/
|
|
1536
1545
|
|
|
1537
|
-
function
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1543
|
-
var exports = {},
|
|
1544
|
-
Op = Object.prototype,
|
|
1545
|
-
hasOwn = Op.hasOwnProperty,
|
|
1546
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
1547
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
1548
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
1549
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
1550
|
-
|
|
1551
|
-
function define(obj, key, value) {
|
|
1552
|
-
return Object.defineProperty(obj, key, {
|
|
1553
|
-
value: value,
|
|
1554
|
-
enumerable: !0,
|
|
1555
|
-
configurable: !0,
|
|
1556
|
-
writable: !0
|
|
1557
|
-
}), obj[key];
|
|
1558
|
-
}
|
|
1546
|
+
function createOrUpdateFilter(document, $def, object, $el, filters) {
|
|
1547
|
+
// eg. filter="url(#f1) url(#f2)"
|
|
1548
|
+
var filterName = FILTER_PREFIX + object.entity;
|
|
1549
|
+
var $existedFilters = $def.querySelectorAll("[name=" + filterName + "]");
|
|
1559
1550
|
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
return obj[key] = value;
|
|
1565
|
-
};
|
|
1551
|
+
if ($existedFilters.length) {
|
|
1552
|
+
$existedFilters.forEach(function ($filter) {
|
|
1553
|
+
$def.removeChild($filter);
|
|
1554
|
+
});
|
|
1566
1555
|
}
|
|
1567
1556
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
var
|
|
1574
|
-
|
|
1575
|
-
|
|
1557
|
+
if (filters.length === 0) {
|
|
1558
|
+
// 'none'
|
|
1559
|
+
$el === null || $el === void 0 ? void 0 : $el.removeAttribute('filter');
|
|
1560
|
+
} else {
|
|
1561
|
+
var filterIds = filters.map(function (_ref, i) {
|
|
1562
|
+
var name = _ref.name,
|
|
1563
|
+
params = _ref.params;
|
|
1564
|
+
var $filter = createSVGElement('filter', document); // @see https://github.com/antvis/g/issues/1025
|
|
1576
1565
|
|
|
1577
|
-
|
|
1578
|
-
if ("throw" === method) throw arg;
|
|
1579
|
-
return doneResult();
|
|
1580
|
-
}
|
|
1566
|
+
$filter.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
1581
1567
|
|
|
1582
|
-
|
|
1583
|
-
|
|
1568
|
+
if (name === 'blur') {
|
|
1569
|
+
createBlur(document, $filter, params);
|
|
1570
|
+
} else if (name === 'brightness') {
|
|
1571
|
+
createBrightness(document, $filter, params);
|
|
1572
|
+
} else if (name === 'drop-shadow') {
|
|
1573
|
+
createDropShadow(document, $filter, params);
|
|
1574
|
+
} else if (name === 'contrast') {
|
|
1575
|
+
createContrast(document, $filter, params);
|
|
1576
|
+
} else if (name === 'grayscale') {
|
|
1577
|
+
createGrayscale(document, $filter, params);
|
|
1578
|
+
} else if (name === 'sepia') {
|
|
1579
|
+
createSepia(document, $filter, params);
|
|
1580
|
+
} else if (name === 'saturate') {
|
|
1581
|
+
createSaturate(document, $filter, params);
|
|
1582
|
+
} else if (name === 'hue-rotate') {
|
|
1583
|
+
createHueRotate(document, $filter, params);
|
|
1584
|
+
} else if (name === 'invert') {
|
|
1585
|
+
createInvert(document, $filter, params);
|
|
1586
|
+
}
|
|
1584
1587
|
|
|
1585
|
-
|
|
1586
|
-
|
|
1588
|
+
$filter.id = filterName + "-" + i;
|
|
1589
|
+
$filter.setAttribute('name', filterName);
|
|
1590
|
+
$def.appendChild($filter);
|
|
1591
|
+
return $filter.id;
|
|
1592
|
+
});
|
|
1593
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', filterIds.map(function (filterId) {
|
|
1594
|
+
return "url(#" + filterId + ")";
|
|
1595
|
+
}).join(' '));
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1587
1598
|
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1599
|
+
function convertToAbsoluteValue(param) {
|
|
1600
|
+
return param.unit === g.UnitType.kPercentage ? param.value / 100 : param.value;
|
|
1601
|
+
}
|
|
1602
|
+
/**
|
|
1603
|
+
* @see https://drafts.fxtf.org/filter-effects/#blurEquivalent
|
|
1604
|
+
*/
|
|
1593
1605
|
|
|
1594
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
1595
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
1596
|
-
context.dispatchException(context.arg);
|
|
1597
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
1598
|
-
state = "executing";
|
|
1599
|
-
var record = tryCatch(innerFn, self, context);
|
|
1600
1606
|
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
}
|
|
1607
|
+
function createBlur(document, $filter, params) {
|
|
1608
|
+
var $feGaussianBlur = createSVGElement('feGaussianBlur', document);
|
|
1609
|
+
$feGaussianBlur.setAttribute('in', 'SourceGraphic');
|
|
1610
|
+
$feGaussianBlur.setAttribute('stdDeviation', "" + params[0].value);
|
|
1611
|
+
$filter.appendChild($feGaussianBlur);
|
|
1612
|
+
}
|
|
1608
1613
|
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
+
function createFeComponentTransfer(document, $filter, _ref2) {
|
|
1615
|
+
var type = _ref2.type,
|
|
1616
|
+
slope = _ref2.slope,
|
|
1617
|
+
intercept = _ref2.intercept,
|
|
1618
|
+
tableValues = _ref2.tableValues;
|
|
1619
|
+
var $feComponentTransfer = createSVGElement('feComponentTransfer', document);
|
|
1620
|
+
[createSVGElement('feFuncR', document), createSVGElement('feFuncG', document), createSVGElement('feFuncB', document)].forEach(function ($feFunc) {
|
|
1621
|
+
$feFunc.setAttribute('type', type);
|
|
1614
1622
|
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
};
|
|
1621
|
-
} catch (err) {
|
|
1622
|
-
return {
|
|
1623
|
-
type: "throw",
|
|
1624
|
-
arg: err
|
|
1625
|
-
};
|
|
1623
|
+
if (type === 'table') {
|
|
1624
|
+
$feFunc.setAttribute('tableValues', "" + tableValues);
|
|
1625
|
+
} else {
|
|
1626
|
+
$feFunc.setAttribute('slope', "" + slope);
|
|
1627
|
+
$feFunc.setAttribute('intercept', "" + intercept);
|
|
1626
1628
|
}
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
exports.wrap = wrap;
|
|
1630
|
-
var ContinueSentinel = {};
|
|
1631
1629
|
|
|
1632
|
-
|
|
1630
|
+
$feComponentTransfer.appendChild($feFunc);
|
|
1631
|
+
});
|
|
1632
|
+
$filter.appendChild($feComponentTransfer);
|
|
1633
|
+
}
|
|
1633
1634
|
|
|
1634
|
-
|
|
1635
|
+
function createContrast(document, $filter, params) {
|
|
1636
|
+
var slope = convertToAbsoluteValue(params[0]);
|
|
1637
|
+
createFeComponentTransfer(document, $filter, {
|
|
1638
|
+
type: 'linear',
|
|
1639
|
+
slope: slope,
|
|
1640
|
+
intercept: -(0.5 * slope) + 0.5
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1635
1643
|
|
|
1636
|
-
|
|
1644
|
+
function createInvert(document, $filter, params) {
|
|
1645
|
+
var amount = convertToAbsoluteValue(params[0]);
|
|
1646
|
+
createFeComponentTransfer(document, $filter, {
|
|
1647
|
+
type: 'table',
|
|
1648
|
+
tableValues: amount + " " + (1 - amount)
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1637
1651
|
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1652
|
+
function createBrightness(document, $filter, params) {
|
|
1653
|
+
var slope = convertToAbsoluteValue(params[0]);
|
|
1654
|
+
createFeComponentTransfer(document, $filter, {
|
|
1655
|
+
type: 'linear',
|
|
1656
|
+
slope: slope,
|
|
1657
|
+
intercept: 0
|
|
1641
1658
|
});
|
|
1642
|
-
|
|
1643
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1644
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
1645
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1659
|
+
}
|
|
1646
1660
|
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1661
|
+
function createSaturate(document, $filter, params) {
|
|
1662
|
+
var amount = convertToAbsoluteValue(params[0]);
|
|
1663
|
+
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
1664
|
+
$feColorMatrix.setAttribute('type', 'saturate');
|
|
1665
|
+
$feColorMatrix.setAttribute('values', "" + amount);
|
|
1666
|
+
$filter.appendChild($feColorMatrix);
|
|
1667
|
+
}
|
|
1654
1668
|
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1669
|
+
function createHueRotate(document, $filter, params) {
|
|
1670
|
+
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
1671
|
+
$feColorMatrix.setAttribute('type', 'hueRotate');
|
|
1672
|
+
$feColorMatrix.setAttribute('values', "" + params[0].to(g.UnitType.kDegrees).value);
|
|
1673
|
+
$filter.appendChild($feColorMatrix);
|
|
1674
|
+
}
|
|
1658
1675
|
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
invoke("next", value, resolve, reject);
|
|
1664
|
-
}, function (err) {
|
|
1665
|
-
invoke("throw", err, resolve, reject);
|
|
1666
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
1667
|
-
result.value = unwrapped, resolve(result);
|
|
1668
|
-
}, function (error) {
|
|
1669
|
-
return invoke("throw", error, resolve, reject);
|
|
1670
|
-
});
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
reject(record.arg);
|
|
1674
|
-
}
|
|
1676
|
+
function createDropShadow(document, $filter, params) {
|
|
1677
|
+
var shadowOffsetX = params[0].value;
|
|
1678
|
+
var shadowOffsetY = params[1].value;
|
|
1679
|
+
var shadowBlur = params[2].value; // @ts-ignore
|
|
1675
1680
|
|
|
1676
|
-
|
|
1681
|
+
var shadowColor = params[3].formatted;
|
|
1682
|
+
var $feGaussianBlur = createSVGElement('feGaussianBlur', document);
|
|
1683
|
+
$feGaussianBlur.setAttribute('in', 'SourceAlpha');
|
|
1684
|
+
$feGaussianBlur.setAttribute('stdDeviation', "" + shadowBlur);
|
|
1685
|
+
$filter.appendChild($feGaussianBlur);
|
|
1686
|
+
var $feOffset = createSVGElement('feOffset', document);
|
|
1687
|
+
$feOffset.setAttribute('dx', "" + shadowOffsetX);
|
|
1688
|
+
$feOffset.setAttribute('dy', "" + shadowOffsetY);
|
|
1689
|
+
$feOffset.setAttribute('result', 'offsetblur');
|
|
1690
|
+
$filter.appendChild($feOffset);
|
|
1691
|
+
var $feFlood = createSVGElement('feFlood', document);
|
|
1692
|
+
$feFlood.setAttribute('flood-color', shadowColor);
|
|
1693
|
+
$filter.appendChild($feFlood);
|
|
1694
|
+
var $feComposite = createSVGElement('feComposite', document);
|
|
1695
|
+
$feComposite.setAttribute('in2', 'offsetblur');
|
|
1696
|
+
$feComposite.setAttribute('operator', 'in');
|
|
1697
|
+
$filter.appendChild($feComposite);
|
|
1698
|
+
var $feMerge = createSVGElement('feMerge', document);
|
|
1699
|
+
$filter.appendChild($feMerge);
|
|
1700
|
+
var $feMergeNode1 = createSVGElement('feMergeNode', document);
|
|
1701
|
+
var $feMergeNode2 = createSVGElement('feMergeNode', document);
|
|
1702
|
+
$feMergeNode2.setAttribute('in', 'SourceGraphic');
|
|
1703
|
+
$feMerge.appendChild($feMergeNode1);
|
|
1704
|
+
$feMerge.appendChild($feMergeNode2);
|
|
1705
|
+
}
|
|
1677
1706
|
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1707
|
+
function createFeColorMatrix(document, $filter, matrix) {
|
|
1708
|
+
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
1709
|
+
$feColorMatrix.setAttribute('type', 'matrix');
|
|
1710
|
+
$feColorMatrix.setAttribute('values', matrix.join(' '));
|
|
1711
|
+
$filter.appendChild($feColorMatrix);
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* @see https://drafts.fxtf.org/filter-effects/#grayscaleEquivalent
|
|
1715
|
+
*/
|
|
1684
1716
|
|
|
1685
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1686
|
-
};
|
|
1687
|
-
}
|
|
1688
1717
|
|
|
1689
|
-
|
|
1690
|
-
|
|
1718
|
+
function createGrayscale(document, $filter, params) {
|
|
1719
|
+
var amount = convertToAbsoluteValue(params[0]);
|
|
1720
|
+
createFeColorMatrix(document, $filter, [0.2126 + 0.7874 * (1 - amount), 0.7152 - 0.7152 * (1 - amount), 0.0722 - 0.0722 * (1 - amount), 0, 0, 0.2126 - 0.2126 * (1 - amount), 0.7152 + 0.2848 * (1 - amount), 0.0722 - 0.0722 * (1 - amount), 0, 0, 0.2126 - 0.2126 * (1 - amount), 0.7152 - 0.7152 * (1 - amount), 0.0722 + 0.9278 * (1 - amount), 0, 0, 0, 0, 0, 1, 0]);
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* @see https://drafts.fxtf.org/filter-effects/#sepiaEquivalent
|
|
1724
|
+
*/
|
|
1691
1725
|
|
|
1692
|
-
if (undefined === method) {
|
|
1693
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
1694
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
1695
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
1696
|
-
}
|
|
1697
1726
|
|
|
1698
|
-
|
|
1699
|
-
|
|
1727
|
+
function createSepia(document, $filter, params) {
|
|
1728
|
+
var amount = convertToAbsoluteValue(params[0]);
|
|
1729
|
+
createFeColorMatrix(document, $filter, [0.393 + 0.607 * (1 - amount), 0.769 - 0.769 * (1 - amount), 0.189 - 0.189 * (1 - amount), 0, 0, 0.349 - 0.349 * (1 - amount), 0.686 + 0.314 * (1 - amount), 0.168 - 0.168 * (1 - amount), 0, 0, 0.272 - 0.272 * (1 - amount), 0.534 - 0.534 * (1 - amount), 0.131 + 0.869 * (1 - amount), 0, 0, 0, 0, 0, 1, 0]);
|
|
1730
|
+
}
|
|
1700
1731
|
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
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);
|
|
1705
|
-
}
|
|
1732
|
+
var PATTERN_PREFIX = 'g-pattern-';
|
|
1733
|
+
var cacheKey2IDMap = {};
|
|
1734
|
+
var counter = 0;
|
|
1706
1735
|
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
1736
|
+
function createOrUpdateGradientAndPattern(document, $def, object, $el, parsedColor, name, createImage) {
|
|
1737
|
+
// eg. clipPath don't have fill/stroke
|
|
1738
|
+
if (!parsedColor) {
|
|
1739
|
+
return '';
|
|
1712
1740
|
}
|
|
1713
1741
|
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1742
|
+
if (parsedColor instanceof g.CSSRGB) {
|
|
1743
|
+
// keep using currentColor @see https://github.com/d3/d3-axis/issues/49
|
|
1744
|
+
if (object.style[name] === 'currentColor') {
|
|
1745
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, 'currentColor');
|
|
1746
|
+
} else {
|
|
1747
|
+
// constant value, eg. '#fff'
|
|
1748
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, parsedColor.isNone ? 'none' : parsedColor.toString());
|
|
1749
|
+
}
|
|
1750
|
+
} else if (g.isPattern(parsedColor)) {
|
|
1751
|
+
var patternId = createOrUpdatePattern(document, $def, object, parsedColor, createImage); // use style instead of attribute when applying <pattern>
|
|
1752
|
+
// @see https://stackoverflow.com/a/7723115
|
|
1718
1753
|
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1754
|
+
$el.style[name] = "url(#" + patternId + ")";
|
|
1755
|
+
return patternId;
|
|
1756
|
+
} else {
|
|
1757
|
+
if (parsedColor.length === 1) {
|
|
1758
|
+
var gradientId = createOrUpdateGradient(document, object, $def, $el, parsedColor[0]);
|
|
1759
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, "url(#" + gradientId + ")");
|
|
1760
|
+
return gradientId;
|
|
1761
|
+
} else {
|
|
1762
|
+
// @see https://stackoverflow.com/questions/20671502/can-i-blend-gradients-in-svg
|
|
1763
|
+
var filterId = createOrUpdateMultiGradient(document, object, $def, $el, parsedColor);
|
|
1764
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', "url(#" + filterId + ")");
|
|
1765
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute('fill', 'black');
|
|
1766
|
+
return filterId;
|
|
1767
|
+
}
|
|
1723
1768
|
}
|
|
1724
1769
|
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
1728
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
1729
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
1770
|
+
return '';
|
|
1771
|
+
}
|
|
1730
1772
|
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
next = function next() {
|
|
1734
|
-
for (; ++i < iterable.length;) {
|
|
1735
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1736
|
-
}
|
|
1773
|
+
function generateCacheKey(src) {
|
|
1774
|
+
var cacheKey = '';
|
|
1737
1775
|
|
|
1738
|
-
|
|
1739
|
-
|
|
1776
|
+
if (src instanceof g.CSSGradientValue) {
|
|
1777
|
+
var type = src.type,
|
|
1778
|
+
value = src.value;
|
|
1740
1779
|
|
|
1741
|
-
|
|
1742
|
-
|
|
1780
|
+
if (type === g.GradientType.LinearGradient || type === g.GradientType.RadialGradient) {
|
|
1781
|
+
// @ts-ignore
|
|
1782
|
+
var _type = value.type,
|
|
1783
|
+
width = value.width,
|
|
1784
|
+
height = value.height,
|
|
1785
|
+
steps = value.steps,
|
|
1786
|
+
angle = value.angle,
|
|
1787
|
+
cx = value.cx,
|
|
1788
|
+
cy = value.cy;
|
|
1789
|
+
cacheKey = "" + _type + width + height + (angle || 0) + (cx || 0) + (cy || 0) + steps.map(function (step) {
|
|
1790
|
+
return step.join('');
|
|
1791
|
+
}).join('');
|
|
1792
|
+
}
|
|
1793
|
+
} else if (g.isPattern(src)) {
|
|
1794
|
+
if (g.isString(src.image)) {
|
|
1795
|
+
cacheKey = "pattern-" + src.image + "-" + src.repetition;
|
|
1796
|
+
} else {
|
|
1797
|
+
cacheKey = "pattern-" + counter;
|
|
1743
1798
|
}
|
|
1744
|
-
|
|
1745
|
-
return {
|
|
1746
|
-
next: doneResult
|
|
1747
|
-
};
|
|
1748
1799
|
}
|
|
1749
1800
|
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
};
|
|
1801
|
+
if (cacheKey) {
|
|
1802
|
+
if (!cacheKey2IDMap[cacheKey]) {
|
|
1803
|
+
cacheKey2IDMap[cacheKey] = PATTERN_PREFIX + ("" + counter++);
|
|
1804
|
+
}
|
|
1755
1805
|
}
|
|
1756
1806
|
|
|
1757
|
-
return
|
|
1758
|
-
|
|
1759
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
1760
|
-
}, exports.mark = function (genFun) {
|
|
1761
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
1762
|
-
}, exports.awrap = function (arg) {
|
|
1763
|
-
return {
|
|
1764
|
-
__await: arg
|
|
1765
|
-
};
|
|
1766
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
1767
|
-
return this;
|
|
1768
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
1769
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
1770
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
1771
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
1772
|
-
return result.done ? result.value : iter.next();
|
|
1773
|
-
});
|
|
1774
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
1775
|
-
return this;
|
|
1776
|
-
}), define(Gp, "toString", function () {
|
|
1777
|
-
return "[object Generator]";
|
|
1778
|
-
}), exports.keys = function (object) {
|
|
1779
|
-
var keys = [];
|
|
1807
|
+
return cacheKey2IDMap[cacheKey];
|
|
1808
|
+
}
|
|
1780
1809
|
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1810
|
+
function createOrUpdatePattern(document, $def, object, pattern, createImage) {
|
|
1811
|
+
var patternId = generateCacheKey(pattern);
|
|
1812
|
+
var $existed = $def.querySelector("#" + patternId);
|
|
1784
1813
|
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1814
|
+
if (!$existed) {
|
|
1815
|
+
var image = pattern.image,
|
|
1816
|
+
repetition = pattern.repetition;
|
|
1817
|
+
var imageURL = '';
|
|
1818
|
+
|
|
1819
|
+
if (g.isString(image)) {
|
|
1820
|
+
imageURL = image;
|
|
1821
|
+
} else {
|
|
1822
|
+
if (g.isBrowser) {
|
|
1823
|
+
if (image instanceof HTMLImageElement) {
|
|
1824
|
+
imageURL = image.src;
|
|
1825
|
+
} else if (image instanceof HTMLCanvasElement) {
|
|
1826
|
+
imageURL = image.toDataURL();
|
|
1827
|
+
} else ;
|
|
1789
1828
|
}
|
|
1829
|
+
}
|
|
1790
1830
|
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1831
|
+
if (imageURL) {
|
|
1832
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/pattern
|
|
1833
|
+
var $pattern = createSVGElement('pattern', document);
|
|
1834
|
+
$pattern.setAttribute('patternUnits', 'userSpaceOnUse');
|
|
1835
|
+
var $image = createSVGElement('image', document);
|
|
1836
|
+
$pattern.appendChild($image);
|
|
1837
|
+
$pattern.id = patternId;
|
|
1838
|
+
$def.appendChild($pattern); // use href instead of xlink:href
|
|
1839
|
+
// @see https://stackoverflow.com/a/13379007
|
|
1840
|
+
|
|
1841
|
+
$image.setAttribute('href', imageURL);
|
|
1842
|
+
var img;
|
|
1843
|
+
|
|
1844
|
+
if (createImage) {
|
|
1845
|
+
img = createImage(imageURL);
|
|
1846
|
+
} else if (g.isBrowser) {
|
|
1847
|
+
img = new window.Image();
|
|
1798
1848
|
}
|
|
1799
|
-
},
|
|
1800
|
-
stop: function stop() {
|
|
1801
|
-
this.done = !0;
|
|
1802
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
1803
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
1804
|
-
return this.rval;
|
|
1805
|
-
},
|
|
1806
|
-
dispatchException: function dispatchException(exception) {
|
|
1807
|
-
if (this.done) throw exception;
|
|
1808
|
-
var context = this;
|
|
1809
1849
|
|
|
1810
|
-
|
|
1811
|
-
|
|
1850
|
+
if (!imageURL.match(/^data:/i)) {
|
|
1851
|
+
img.crossOrigin = 'Anonymous';
|
|
1852
|
+
$image.setAttribute('crossorigin', 'anonymous');
|
|
1812
1853
|
}
|
|
1813
1854
|
|
|
1814
|
-
|
|
1815
|
-
var entry = this.tryEntries[i],
|
|
1816
|
-
record = entry.completion;
|
|
1817
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
1855
|
+
img.src = imageURL;
|
|
1818
1856
|
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1857
|
+
var onload = function onload() {
|
|
1858
|
+
$pattern.setAttribute('x', '0');
|
|
1859
|
+
$pattern.setAttribute('y', '0');
|
|
1822
1860
|
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
} else if (hasCatch) {
|
|
1827
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1828
|
-
} else {
|
|
1829
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
1830
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
},
|
|
1835
|
-
abrupt: function abrupt(type, arg) {
|
|
1836
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1837
|
-
var entry = this.tryEntries[i];
|
|
1861
|
+
var _object$getGeometryBo = object.getGeometryBounds(),
|
|
1862
|
+
halfExtents = _object$getGeometryBo.halfExtents; // There is no equivalent to CSS no-repeat for SVG patterns
|
|
1863
|
+
// @see https://stackoverflow.com/a/33481956
|
|
1838
1864
|
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1865
|
+
|
|
1866
|
+
var patternWidth = img.width;
|
|
1867
|
+
var patternHeight = img.height;
|
|
1868
|
+
|
|
1869
|
+
if (repetition === 'repeat-x') {
|
|
1870
|
+
patternHeight = halfExtents[1] * 2;
|
|
1871
|
+
} else if (repetition === 'repeat-y') {
|
|
1872
|
+
patternWidth = halfExtents[0] * 2;
|
|
1873
|
+
} else if (repetition === 'no-repeat') {
|
|
1874
|
+
patternWidth = halfExtents[0] * 2;
|
|
1875
|
+
patternHeight = halfExtents[1] * 2;
|
|
1842
1876
|
}
|
|
1843
|
-
}
|
|
1844
1877
|
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
},
|
|
1853
|
-
finish: function finish(finallyLoc) {
|
|
1854
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1855
|
-
var entry = this.tryEntries[i];
|
|
1856
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
1857
|
-
}
|
|
1858
|
-
},
|
|
1859
|
-
catch: function _catch(tryLoc) {
|
|
1860
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1861
|
-
var entry = this.tryEntries[i];
|
|
1878
|
+
$pattern.setAttribute('width', "" + patternWidth);
|
|
1879
|
+
$pattern.setAttribute('height', "" + patternHeight);
|
|
1880
|
+
$image.setAttribute('x', '0');
|
|
1881
|
+
$image.setAttribute('y', '0');
|
|
1882
|
+
$image.setAttribute('width', "" + img.width);
|
|
1883
|
+
$image.setAttribute('height', "" + img.height);
|
|
1884
|
+
};
|
|
1862
1885
|
|
|
1863
|
-
|
|
1864
|
-
|
|
1886
|
+
if (img.complete) {
|
|
1887
|
+
onload();
|
|
1888
|
+
} else {
|
|
1889
|
+
img.onload = onload; // Fix onload() bug in IE9
|
|
1865
1890
|
|
|
1866
|
-
|
|
1867
|
-
var thrown = record.arg;
|
|
1868
|
-
resetTryEntry(entry);
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
return thrown;
|
|
1872
|
-
}
|
|
1891
|
+
img.src = img.src;
|
|
1873
1892
|
}
|
|
1874
|
-
|
|
1875
|
-
throw new Error("illegal catch attempt");
|
|
1876
|
-
},
|
|
1877
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
1878
|
-
return this.delegate = {
|
|
1879
|
-
iterator: values(iterable),
|
|
1880
|
-
resultName: resultName,
|
|
1881
|
-
nextLoc: nextLoc
|
|
1882
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
1883
1893
|
}
|
|
1884
|
-
}, exports;
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1888
|
-
try {
|
|
1889
|
-
var info = gen[key](arg);
|
|
1890
|
-
var value = info.value;
|
|
1891
|
-
} catch (error) {
|
|
1892
|
-
reject(error);
|
|
1893
|
-
return;
|
|
1894
1894
|
}
|
|
1895
1895
|
|
|
1896
|
-
|
|
1897
|
-
resolve(value);
|
|
1898
|
-
} else {
|
|
1899
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1900
|
-
}
|
|
1896
|
+
return patternId;
|
|
1901
1897
|
}
|
|
1902
1898
|
|
|
1903
|
-
function
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
args = arguments;
|
|
1907
|
-
return new Promise(function (resolve, reject) {
|
|
1908
|
-
var gen = fn.apply(self, args);
|
|
1899
|
+
function createOrUpdateGradient(document, object, $def, $el, parsedColor) {
|
|
1900
|
+
var gradientId = generateCacheKey(parsedColor);
|
|
1901
|
+
var $existed = $def.querySelector("#" + gradientId);
|
|
1909
1902
|
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1903
|
+
if (!$existed) {
|
|
1904
|
+
// <linearGradient> <radialGradient>
|
|
1905
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/linearGradient
|
|
1906
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/radialGradient
|
|
1907
|
+
$existed = createSVGElement(parsedColor.type === g.GradientType.LinearGradient ? 'linearGradient' : 'radialGradient', document); // @see https://github.com/antvis/g/issues/1025
|
|
1913
1908
|
|
|
1914
|
-
|
|
1915
|
-
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1916
|
-
}
|
|
1909
|
+
$existed.setAttribute('gradientUnits', 'userSpaceOnUse'); // add stops
|
|
1917
1910
|
|
|
1918
|
-
|
|
1911
|
+
var innerHTML = '';
|
|
1912
|
+
parsedColor.value.steps.forEach(function (_ref) {
|
|
1913
|
+
var offset = _ref[0],
|
|
1914
|
+
color = _ref[1];
|
|
1915
|
+
innerHTML += "<stop offset=\"" + offset + "\" stop-color=\"" + color + "\"></stop>";
|
|
1919
1916
|
});
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
* @module glMatrix
|
|
1925
|
-
*/
|
|
1926
|
-
// Configuration Constants
|
|
1927
|
-
|
|
1917
|
+
$existed.innerHTML = innerHTML;
|
|
1918
|
+
$existed.id = gradientId;
|
|
1919
|
+
$def.appendChild($existed);
|
|
1920
|
+
}
|
|
1928
1921
|
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
var y = 0,
|
|
1933
|
-
i = arguments.length;
|
|
1922
|
+
var bounds = object.getGeometryBounds();
|
|
1923
|
+
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
1924
|
+
var height = bounds && bounds.halfExtents[1] * 2 || 0;
|
|
1934
1925
|
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
}
|
|
1926
|
+
if (parsedColor.type === g.GradientType.LinearGradient) {
|
|
1927
|
+
var angle = parsedColor.value.angle;
|
|
1938
1928
|
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
*/
|
|
1929
|
+
var _computeLinearGradien = g.computeLinearGradient(width, height, angle),
|
|
1930
|
+
x1 = _computeLinearGradien.x1,
|
|
1931
|
+
y1 = _computeLinearGradien.y1,
|
|
1932
|
+
x2 = _computeLinearGradien.x2,
|
|
1933
|
+
y2 = _computeLinearGradien.y2;
|
|
1945
1934
|
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1935
|
+
$existed.setAttribute('x1', "" + x1);
|
|
1936
|
+
$existed.setAttribute('y1', "" + y1);
|
|
1937
|
+
$existed.setAttribute('x2', "" + x2);
|
|
1938
|
+
$existed.setAttribute('y2', "" + y2); // $existed.setAttribute('gradientTransform', `rotate(${angle})`);
|
|
1939
|
+
} else {
|
|
1940
|
+
var _parsedColor$value = parsedColor.value,
|
|
1941
|
+
cx = _parsedColor$value.cx,
|
|
1942
|
+
cy = _parsedColor$value.cy;
|
|
1951
1943
|
|
|
1952
|
-
|
|
1953
|
-
|
|
1944
|
+
var _computeRadialGradien = g.computeRadialGradient(width, height, cx, cy),
|
|
1945
|
+
x = _computeRadialGradien.x,
|
|
1946
|
+
y = _computeRadialGradien.y,
|
|
1947
|
+
r = _computeRadialGradien.r;
|
|
1954
1948
|
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
out[3] = 0;
|
|
1959
|
-
out[5] = 0;
|
|
1960
|
-
out[6] = 0;
|
|
1961
|
-
out[7] = 0;
|
|
1949
|
+
$existed.setAttribute('cx', "" + x);
|
|
1950
|
+
$existed.setAttribute('cy', "" + y);
|
|
1951
|
+
$existed.setAttribute('r', "" + r);
|
|
1962
1952
|
}
|
|
1963
1953
|
|
|
1964
|
-
|
|
1965
|
-
out[4] = 1;
|
|
1966
|
-
out[8] = 1;
|
|
1967
|
-
return out;
|
|
1954
|
+
return gradientId;
|
|
1968
1955
|
}
|
|
1969
|
-
/**
|
|
1970
|
-
* Returns the translation vector component of a transformation
|
|
1971
|
-
* matrix. If a matrix is built with fromRotationTranslation,
|
|
1972
|
-
* the returned vector will be the same as the translation vector
|
|
1973
|
-
* originally supplied.
|
|
1974
|
-
* @param {vec3} out Vector to receive translation component
|
|
1975
|
-
* @param {ReadonlyMat4} mat Matrix to be decomposed (input)
|
|
1976
|
-
* @return {vec3} out
|
|
1977
|
-
*/
|
|
1978
1956
|
|
|
1957
|
+
function createOrUpdateMultiGradient(document, object, $def, $el, gradients) {
|
|
1958
|
+
var filterId = FILTER_PREFIX + object.entity + '-gradient';
|
|
1959
|
+
var $existed = $def.querySelector("#" + filterId);
|
|
1979
1960
|
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1961
|
+
if (!$existed) {
|
|
1962
|
+
$existed = createSVGElement('filter', document);
|
|
1963
|
+
$existed.setAttribute('filterUnits', 'userSpaceOnUse'); // @see https://github.com/antvis/g/issues/1025
|
|
1964
|
+
|
|
1965
|
+
$existed.setAttribute('x', '0%');
|
|
1966
|
+
$existed.setAttribute('y', '0%');
|
|
1967
|
+
$existed.setAttribute('width', '100%');
|
|
1968
|
+
$existed.setAttribute('height', '100%');
|
|
1969
|
+
$existed.id = filterId;
|
|
1970
|
+
$def.appendChild($existed);
|
|
1971
|
+
}
|
|
1972
|
+
/**
|
|
1973
|
+
* <rect id="wave-rect" x="0" y="0" width="100%" height="100%" fill="url(#wave)"></rect>
|
|
1974
|
+
* <filter id="blend-it" x="0%" y="0%" width="100%" height="100%">
|
|
1975
|
+
<feImage xlink:href="#wave-rect" result="myWave" x="100" y="100"/>
|
|
1976
|
+
<feImage xlink:href="#ry-rect" result="myRY" x="100" y="100"/>
|
|
1977
|
+
<feBlend in="myWave" in2="myRY" mode="multiply" result="blendedGrad"/>
|
|
1978
|
+
<feComposite in="blendedGrad" in2="SourceGraphic" operator="in"/>
|
|
1979
|
+
</filter>
|
|
1980
|
+
*/
|
|
1996
1981
|
|
|
1997
1982
|
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
1983
|
+
var blended = 0;
|
|
1984
|
+
gradients.forEach(function (gradient, i) {
|
|
1985
|
+
var gradientId = createOrUpdateGradient(document, object, $def, $el, gradient);
|
|
1986
|
+
var rectId = gradientId + '_rect';
|
|
1987
|
+
var $rect = createSVGElement('rect', document);
|
|
1988
|
+
$rect.setAttribute('x', '0');
|
|
1989
|
+
$rect.setAttribute('y', '0');
|
|
1990
|
+
$rect.setAttribute('width', '100%');
|
|
1991
|
+
$rect.setAttribute('height', '100%');
|
|
1992
|
+
$rect.setAttribute('fill', "url(#" + gradientId + ")");
|
|
1993
|
+
$rect.id = rectId;
|
|
1994
|
+
$def.appendChild($rect);
|
|
1995
|
+
var $feImage = createSVGElement('feImage', document);
|
|
1996
|
+
$feImage.setAttribute('href', "#" + rectId);
|
|
1997
|
+
$feImage.setAttribute('result', filterId + "-" + i);
|
|
1998
|
+
$existed.appendChild($feImage);
|
|
1999
|
+
|
|
2000
|
+
if (i > 0) {
|
|
2001
|
+
var $feBlend = createSVGElement('feBlend', document);
|
|
2002
|
+
$feBlend.setAttribute('in', i === 1 ? filterId + "-" + (i - 1) : filterId + "-blended-" + (blended - 1));
|
|
2003
|
+
$feBlend.setAttribute('in2', filterId + "-" + i);
|
|
2004
|
+
$feBlend.setAttribute('result', filterId + "-blended-" + blended++); // @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/blend-mode
|
|
2005
|
+
|
|
2006
|
+
$feBlend.setAttribute('mode', 'multiply');
|
|
2007
|
+
$existed.appendChild($feBlend);
|
|
2008
|
+
}
|
|
2009
|
+
});
|
|
2010
|
+
var $feComposite = createSVGElement('feComposite', document);
|
|
2011
|
+
$feComposite.setAttribute('in', filterId + "-blended-" + blended);
|
|
2012
|
+
$feComposite.setAttribute('in2', 'SourceGraphic');
|
|
2013
|
+
$feComposite.setAttribute('operator', 'in');
|
|
2014
|
+
$existed.appendChild($feComposite);
|
|
2015
|
+
return filterId;
|
|
2012
2016
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
*
|
|
2017
|
-
*
|
|
2018
|
-
* @param {quat} out Quaternion to receive the rotation component
|
|
2019
|
-
* @param {ReadonlyMat4} mat Matrix to be decomposed (input)
|
|
2020
|
-
* @return {quat} out
|
|
2017
|
+
|
|
2018
|
+
var FILTER_DROPSHADOW_PREFIX = 'g-filter-dropshadow-';
|
|
2019
|
+
/**
|
|
2020
|
+
* use SVG filters
|
|
2021
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/filter
|
|
2021
2022
|
*/
|
|
2022
2023
|
|
|
2024
|
+
function createOrUpdateShadow(document, $def, object, $el, name) {
|
|
2025
|
+
var _object$parsedStyle$s;
|
|
2023
2026
|
|
|
2024
|
-
|
|
2025
|
-
var
|
|
2026
|
-
getScaling(scaling, mat);
|
|
2027
|
-
var is1 = 1 / scaling[0];
|
|
2028
|
-
var is2 = 1 / scaling[1];
|
|
2029
|
-
var is3 = 1 / scaling[2];
|
|
2030
|
-
var sm11 = mat[0] * is1;
|
|
2031
|
-
var sm12 = mat[1] * is2;
|
|
2032
|
-
var sm13 = mat[2] * is3;
|
|
2033
|
-
var sm21 = mat[4] * is1;
|
|
2034
|
-
var sm22 = mat[5] * is2;
|
|
2035
|
-
var sm23 = mat[6] * is3;
|
|
2036
|
-
var sm31 = mat[8] * is1;
|
|
2037
|
-
var sm32 = mat[9] * is2;
|
|
2038
|
-
var sm33 = mat[10] * is3;
|
|
2039
|
-
var trace = sm11 + sm22 + sm33;
|
|
2040
|
-
var S = 0;
|
|
2027
|
+
var shadowId = FILTER_DROPSHADOW_PREFIX + object.entity;
|
|
2028
|
+
var $existedFilter = $def.querySelector("#" + shadowId);
|
|
2041
2029
|
|
|
2042
|
-
if (
|
|
2043
|
-
|
|
2044
|
-
out[3] = 0.25 * S;
|
|
2045
|
-
out[0] = (sm23 - sm32) / S;
|
|
2046
|
-
out[1] = (sm31 - sm13) / S;
|
|
2047
|
-
out[2] = (sm12 - sm21) / S;
|
|
2048
|
-
} else if (sm11 > sm22 && sm11 > sm33) {
|
|
2049
|
-
S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;
|
|
2050
|
-
out[3] = (sm23 - sm32) / S;
|
|
2051
|
-
out[0] = 0.25 * S;
|
|
2052
|
-
out[1] = (sm12 + sm21) / S;
|
|
2053
|
-
out[2] = (sm31 + sm13) / S;
|
|
2054
|
-
} else if (sm22 > sm33) {
|
|
2055
|
-
S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;
|
|
2056
|
-
out[3] = (sm31 - sm13) / S;
|
|
2057
|
-
out[0] = (sm12 + sm21) / S;
|
|
2058
|
-
out[1] = 0.25 * S;
|
|
2059
|
-
out[2] = (sm23 + sm32) / S;
|
|
2060
|
-
} else {
|
|
2061
|
-
S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;
|
|
2062
|
-
out[3] = (sm12 - sm21) / S;
|
|
2063
|
-
out[0] = (sm31 + sm13) / S;
|
|
2064
|
-
out[1] = (sm23 + sm32) / S;
|
|
2065
|
-
out[2] = 0.25 * S;
|
|
2066
|
-
}
|
|
2030
|
+
if (!$existedFilter) {
|
|
2031
|
+
$existedFilter = createSVGElement('filter', document);
|
|
2067
2032
|
|
|
2068
|
-
|
|
2069
|
-
}
|
|
2070
|
-
/**
|
|
2071
|
-
* 3 Dimensional Vector
|
|
2072
|
-
* @module vec3
|
|
2073
|
-
*/
|
|
2033
|
+
var _$feDropShadow = createSVGElement('feDropShadow', document);
|
|
2074
2034
|
|
|
2075
|
-
|
|
2076
|
-
* Creates a new, empty vec3
|
|
2077
|
-
*
|
|
2078
|
-
* @returns {vec3} a new 3D vector
|
|
2079
|
-
*/
|
|
2035
|
+
_$feDropShadow.setAttribute('dx', '0');
|
|
2080
2036
|
|
|
2037
|
+
_$feDropShadow.setAttribute('dy', '0');
|
|
2081
2038
|
|
|
2082
|
-
|
|
2083
|
-
|
|
2039
|
+
$existedFilter.appendChild(_$feDropShadow);
|
|
2040
|
+
$existedFilter.id = shadowId; // @see https://github.com/antvis/g/issues/1025
|
|
2084
2041
|
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
out[1] = 0;
|
|
2088
|
-
out[2] = 0;
|
|
2042
|
+
$existedFilter.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
2043
|
+
$def.appendChild($existedFilter);
|
|
2089
2044
|
}
|
|
2090
2045
|
|
|
2091
|
-
|
|
2092
|
-
}
|
|
2093
|
-
/**
|
|
2094
|
-
* Calculates the length of a vec3
|
|
2095
|
-
*
|
|
2096
|
-
* @param {ReadonlyVec3} a vector to calculate length of
|
|
2097
|
-
* @returns {Number} length of a
|
|
2098
|
-
*/
|
|
2046
|
+
var $feDropShadow = $existedFilter.children[0];
|
|
2099
2047
|
|
|
2048
|
+
if (name === 'shadowColor') {
|
|
2049
|
+
var parsedColor = object.parsedStyle[name];
|
|
2050
|
+
$feDropShadow.setAttribute('flood-color', parsedColor.toString());
|
|
2051
|
+
} else if (name === 'shadowBlur') {
|
|
2052
|
+
var shadowBlur = object.parsedStyle[name]; // half the blur radius
|
|
2053
|
+
// @see https://drafts.csswg.org/css-backgrounds/#shadow-blur
|
|
2054
|
+
// @see https://css-tricks.com/breaking-css-box-shadow-vs-drop-shadow/
|
|
2100
2055
|
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
*
|
|
2110
|
-
* @param {Number} x X component
|
|
2111
|
-
* @param {Number} y Y component
|
|
2112
|
-
* @param {Number} z Z component
|
|
2113
|
-
* @returns {vec3} a new 3D vector
|
|
2114
|
-
*/
|
|
2056
|
+
$feDropShadow.setAttribute('stdDeviation', "" + ((shadowBlur === null || shadowBlur === void 0 ? void 0 : shadowBlur.value) || 0) / 4);
|
|
2057
|
+
} else if (name === 'shadowOffsetX') {
|
|
2058
|
+
var shadowOffsetX = object.parsedStyle[name];
|
|
2059
|
+
$feDropShadow.setAttribute('dx', "" + ((shadowOffsetX === null || shadowOffsetX === void 0 ? void 0 : shadowOffsetX.value) || 0) / 2);
|
|
2060
|
+
} else if (name === 'shadowOffsetY') {
|
|
2061
|
+
var shadowOffsetY = object.parsedStyle[name];
|
|
2062
|
+
$feDropShadow.setAttribute('dy', "" + ((shadowOffsetY === null || shadowOffsetY === void 0 ? void 0 : shadowOffsetY.value) || 0) / 2);
|
|
2063
|
+
} // only apply shadow when blur > 0
|
|
2115
2064
|
|
|
2116
2065
|
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2066
|
+
if (!g.isNil(object.parsedStyle.shadowColor) && ((_object$parsedStyle$s = object.parsedStyle.shadowBlur) === null || _object$parsedStyle$s === void 0 ? void 0 : _object$parsedStyle$s.value) > 0) {
|
|
2067
|
+
// use filter <feDropShadow>
|
|
2068
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow
|
|
2069
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', "url(#" + shadowId + ")");
|
|
2070
|
+
} else {
|
|
2071
|
+
$el === null || $el === void 0 ? void 0 : $el.removeAttribute('filter');
|
|
2072
|
+
}
|
|
2123
2073
|
}
|
|
2124
|
-
/**
|
|
2125
|
-
* Normalize a vec3
|
|
2126
|
-
*
|
|
2127
|
-
* @param {vec3} out the receiving vector
|
|
2128
|
-
* @param {ReadonlyVec3} a vector to normalize
|
|
2129
|
-
* @returns {vec3} out
|
|
2130
|
-
*/
|
|
2131
|
-
|
|
2132
2074
|
|
|
2133
|
-
|
|
2134
|
-
var x = a[0];
|
|
2135
|
-
var y = a[1];
|
|
2136
|
-
var z = a[2];
|
|
2137
|
-
var len = x * x + y * y + z * z;
|
|
2075
|
+
var urlRegexp = /url\(#(.*)\)/;
|
|
2138
2076
|
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2077
|
+
var DefElementManager = /*#__PURE__*/function () {
|
|
2078
|
+
function DefElementManager() {
|
|
2079
|
+
this.canvasConfig = void 0;
|
|
2080
|
+
this.contextService = void 0;
|
|
2081
|
+
this.$def = void 0;
|
|
2082
|
+
this.gradientCache = {};
|
|
2142
2083
|
}
|
|
2143
2084
|
|
|
2144
|
-
|
|
2145
|
-
out[1] = a[1] * len;
|
|
2146
|
-
out[2] = a[2] * len;
|
|
2147
|
-
return out;
|
|
2148
|
-
}
|
|
2149
|
-
/**
|
|
2150
|
-
* Calculates the dot product of two vec3's
|
|
2151
|
-
*
|
|
2152
|
-
* @param {ReadonlyVec3} a the first operand
|
|
2153
|
-
* @param {ReadonlyVec3} b the second operand
|
|
2154
|
-
* @returns {Number} dot product of a and b
|
|
2155
|
-
*/
|
|
2085
|
+
var _proto = DefElementManager.prototype;
|
|
2156
2086
|
|
|
2087
|
+
_proto.getDefElement = function getDefElement() {
|
|
2088
|
+
return this.$def;
|
|
2089
|
+
};
|
|
2157
2090
|
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
* @param {vec3} out the receiving vector
|
|
2165
|
-
* @param {ReadonlyVec3} a the first operand
|
|
2166
|
-
* @param {ReadonlyVec3} b the second operand
|
|
2167
|
-
* @returns {vec3} out
|
|
2168
|
-
*/
|
|
2091
|
+
_proto.init = function init() {
|
|
2092
|
+
var document = this.canvasConfig.document;
|
|
2093
|
+
var $svg = this.contextService.getContext();
|
|
2094
|
+
this.$def = createSVGElement('defs', document);
|
|
2095
|
+
$svg.appendChild(this.$def);
|
|
2096
|
+
};
|
|
2169
2097
|
|
|
2098
|
+
_proto.clear = function clear(entity) {
|
|
2099
|
+
var _this = this;
|
|
2170
2100
|
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
var bx = b[0],
|
|
2176
|
-
by = b[1],
|
|
2177
|
-
bz = b[2];
|
|
2178
|
-
out[0] = ay * bz - az * by;
|
|
2179
|
-
out[1] = az * bx - ax * bz;
|
|
2180
|
-
out[2] = ax * by - ay * bx;
|
|
2181
|
-
return out;
|
|
2182
|
-
}
|
|
2183
|
-
/**
|
|
2184
|
-
* Alias for {@link vec3.length}
|
|
2185
|
-
* @function
|
|
2186
|
-
*/
|
|
2101
|
+
Object.keys(this.gradientCache).forEach(function (id) {
|
|
2102
|
+
_this.clearUnusedDefElement(_this.gradientCache, id, entity);
|
|
2103
|
+
});
|
|
2104
|
+
};
|
|
2187
2105
|
|
|
2106
|
+
_proto.clearUnusedDefElement = function clearUnusedDefElement(cache, id, entity) {
|
|
2107
|
+
if (cache[id].size === 1 && cache[id].has(entity)) {
|
|
2108
|
+
var targetElement = this.$def.querySelector("#" + id);
|
|
2188
2109
|
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
* @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
|
|
2195
|
-
* @param {Number} offset Number of elements to skip at the beginning of the array
|
|
2196
|
-
* @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
|
|
2197
|
-
* @param {Function} fn Function to call for each vector in the array
|
|
2198
|
-
* @param {Object} [arg] additional argument to pass to fn
|
|
2199
|
-
* @returns {Array} a
|
|
2200
|
-
* @function
|
|
2201
|
-
*/
|
|
2110
|
+
if (targetElement) {
|
|
2111
|
+
this.$def.removeChild(targetElement);
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
};
|
|
2202
2115
|
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2116
|
+
_proto.createOrUpdateGradientAndPattern = function createOrUpdateGradientAndPattern$1(object, $el, parsedColor, name) {
|
|
2117
|
+
var _this$canvasConfig = this.canvasConfig,
|
|
2118
|
+
doc = _this$canvasConfig.document,
|
|
2119
|
+
createImage = _this$canvasConfig.createImage;
|
|
2207
2120
|
|
|
2208
|
-
if (
|
|
2209
|
-
|
|
2210
|
-
}
|
|
2121
|
+
if ($el) {
|
|
2122
|
+
var _$el$getAttribute; // `url(#${gradientId})`
|
|
2211
2123
|
|
|
2212
|
-
if (!offset) {
|
|
2213
|
-
offset = 0;
|
|
2214
|
-
}
|
|
2215
2124
|
|
|
2216
|
-
|
|
2217
|
-
l = Math.min(count * stride + offset, a.length);
|
|
2218
|
-
} else {
|
|
2219
|
-
l = a.length;
|
|
2220
|
-
}
|
|
2125
|
+
var matches = (_$el$getAttribute = $el.getAttribute(name)) === null || _$el$getAttribute === void 0 ? void 0 : _$el$getAttribute.match(urlRegexp);
|
|
2221
2126
|
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2127
|
+
if (matches && matches.length > 1) {
|
|
2128
|
+
this.clearUnusedDefElement(this.gradientCache, matches[1], object.entity);
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
var newDefElementId = createOrUpdateGradientAndPattern(doc || document, this.$def, object, $el, parsedColor, name, createImage);
|
|
2132
|
+
|
|
2133
|
+
if (!this.gradientCache[newDefElementId]) {
|
|
2134
|
+
this.gradientCache[newDefElementId] = new Set();
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
this.gradientCache[newDefElementId].add(object.entity);
|
|
2230
2138
|
}
|
|
2139
|
+
};
|
|
2231
2140
|
|
|
2232
|
-
|
|
2141
|
+
_proto.createOrUpdateShadow = function createOrUpdateShadow$1(object, $el, name) {
|
|
2142
|
+
var doc = this.canvasConfig.document;
|
|
2143
|
+
createOrUpdateShadow(doc || document, this.$def, object, $el, name);
|
|
2233
2144
|
};
|
|
2234
|
-
}();
|
|
2235
|
-
/**
|
|
2236
|
-
* 4 Dimensional Vector
|
|
2237
|
-
* @module vec4
|
|
2238
|
-
*/
|
|
2239
2145
|
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
*/
|
|
2146
|
+
_proto.createOrUpdateFilter = function createOrUpdateFilter$1(object, $el, filters) {
|
|
2147
|
+
var doc = this.canvasConfig.document;
|
|
2148
|
+
createOrUpdateFilter(doc || document, this.$def, object, $el, filters);
|
|
2149
|
+
};
|
|
2245
2150
|
|
|
2151
|
+
return DefElementManager;
|
|
2152
|
+
}();
|
|
2246
2153
|
|
|
2247
|
-
|
|
2248
|
-
var out = new ARRAY_TYPE(4);
|
|
2154
|
+
__decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], DefElementManager.prototype, "canvasConfig", void 0);
|
|
2249
2155
|
|
|
2250
|
-
|
|
2251
|
-
out[0] = 0;
|
|
2252
|
-
out[1] = 0;
|
|
2253
|
-
out[2] = 0;
|
|
2254
|
-
out[3] = 0;
|
|
2255
|
-
}
|
|
2156
|
+
__decorate([g.inject(g.ContextService), __metadata("design:type", Object)], DefElementManager.prototype, "contextService", void 0);
|
|
2256
2157
|
|
|
2257
|
-
|
|
2258
|
-
}
|
|
2259
|
-
/**
|
|
2260
|
-
* Normalize a vec4
|
|
2261
|
-
*
|
|
2262
|
-
* @param {vec4} out the receiving vector
|
|
2263
|
-
* @param {ReadonlyVec4} a vector to normalize
|
|
2264
|
-
* @returns {vec4} out
|
|
2265
|
-
*/
|
|
2158
|
+
DefElementManager = __decorate([g.singleton()], DefElementManager);
|
|
2266
2159
|
|
|
2160
|
+
function _regeneratorRuntime$2() {
|
|
2161
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
2162
|
+
_regeneratorRuntime$2 = function _regeneratorRuntime() {
|
|
2163
|
+
return exports;
|
|
2164
|
+
};
|
|
2267
2165
|
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2166
|
+
var exports = {},
|
|
2167
|
+
Op = Object.prototype,
|
|
2168
|
+
hasOwn = Op.hasOwnProperty,
|
|
2169
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
2170
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
2171
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
2172
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
2274
2173
|
|
|
2275
|
-
|
|
2276
|
-
|
|
2174
|
+
function define(obj, key, value) {
|
|
2175
|
+
return Object.defineProperty(obj, key, {
|
|
2176
|
+
value: value,
|
|
2177
|
+
enumerable: !0,
|
|
2178
|
+
configurable: !0,
|
|
2179
|
+
writable: !0
|
|
2180
|
+
}), obj[key];
|
|
2277
2181
|
}
|
|
2278
2182
|
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
* Perform some operation over an array of vec4s.
|
|
2287
|
-
*
|
|
2288
|
-
* @param {Array} a the array of vectors to iterate over
|
|
2289
|
-
* @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed
|
|
2290
|
-
* @param {Number} offset Number of elements to skip at the beginning of the array
|
|
2291
|
-
* @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array
|
|
2292
|
-
* @param {Function} fn Function to call for each vector in the array
|
|
2293
|
-
* @param {Object} [arg] additional argument to pass to fn
|
|
2294
|
-
* @returns {Array} a
|
|
2295
|
-
* @function
|
|
2296
|
-
*/
|
|
2297
|
-
|
|
2183
|
+
try {
|
|
2184
|
+
define({}, "");
|
|
2185
|
+
} catch (err) {
|
|
2186
|
+
define = function define(obj, key, value) {
|
|
2187
|
+
return obj[key] = value;
|
|
2188
|
+
};
|
|
2189
|
+
}
|
|
2298
2190
|
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2191
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
2192
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
2193
|
+
generator = Object.create(protoGenerator.prototype),
|
|
2194
|
+
context = new Context(tryLocsList || []);
|
|
2195
|
+
return generator._invoke = function (innerFn, self, context) {
|
|
2196
|
+
var state = "suspendedStart";
|
|
2197
|
+
return function (method, arg) {
|
|
2198
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
2303
2199
|
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2200
|
+
if ("completed" === state) {
|
|
2201
|
+
if ("throw" === method) throw arg;
|
|
2202
|
+
return doneResult();
|
|
2203
|
+
}
|
|
2307
2204
|
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
}
|
|
2205
|
+
for (context.method = method, context.arg = arg;;) {
|
|
2206
|
+
var delegate = context.delegate;
|
|
2311
2207
|
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
} else {
|
|
2315
|
-
l = a.length;
|
|
2316
|
-
}
|
|
2208
|
+
if (delegate) {
|
|
2209
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
2317
2210
|
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2211
|
+
if (delegateResult) {
|
|
2212
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
2213
|
+
return delegateResult;
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2217
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
2218
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
2219
|
+
context.dispatchException(context.arg);
|
|
2220
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
2221
|
+
state = "executing";
|
|
2222
|
+
var record = tryCatch(innerFn, self, context);
|
|
2223
|
+
|
|
2224
|
+
if ("normal" === record.type) {
|
|
2225
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
2226
|
+
return {
|
|
2227
|
+
value: record.arg,
|
|
2228
|
+
done: context.done
|
|
2229
|
+
};
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
2233
|
+
}
|
|
2234
|
+
};
|
|
2235
|
+
}(innerFn, self, context), generator;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
function tryCatch(fn, obj, arg) {
|
|
2239
|
+
try {
|
|
2240
|
+
return {
|
|
2241
|
+
type: "normal",
|
|
2242
|
+
arg: fn.call(obj, arg)
|
|
2243
|
+
};
|
|
2244
|
+
} catch (err) {
|
|
2245
|
+
return {
|
|
2246
|
+
type: "throw",
|
|
2247
|
+
arg: err
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
exports.wrap = wrap;
|
|
2253
|
+
var ContinueSentinel = {};
|
|
2254
|
+
|
|
2255
|
+
function Generator() {}
|
|
2256
|
+
|
|
2257
|
+
function GeneratorFunction() {}
|
|
2258
|
+
|
|
2259
|
+
function GeneratorFunctionPrototype() {}
|
|
2260
|
+
|
|
2261
|
+
var IteratorPrototype = {};
|
|
2262
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
2263
|
+
return this;
|
|
2264
|
+
});
|
|
2265
|
+
var getProto = Object.getPrototypeOf,
|
|
2266
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
2267
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
2268
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
2269
|
+
|
|
2270
|
+
function defineIteratorMethods(prototype) {
|
|
2271
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
2272
|
+
define(prototype, method, function (arg) {
|
|
2273
|
+
return this._invoke(method, arg);
|
|
2274
|
+
});
|
|
2275
|
+
});
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
2279
|
+
function invoke(method, arg, resolve, reject) {
|
|
2280
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
2281
|
+
|
|
2282
|
+
if ("throw" !== record.type) {
|
|
2283
|
+
var result = record.arg,
|
|
2284
|
+
value = result.value;
|
|
2285
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
2286
|
+
invoke("next", value, resolve, reject);
|
|
2287
|
+
}, function (err) {
|
|
2288
|
+
invoke("throw", err, resolve, reject);
|
|
2289
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
2290
|
+
result.value = unwrapped, resolve(result);
|
|
2291
|
+
}, function (error) {
|
|
2292
|
+
return invoke("throw", error, resolve, reject);
|
|
2293
|
+
});
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
reject(record.arg);
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
var previousPromise;
|
|
2300
|
+
|
|
2301
|
+
this._invoke = function (method, arg) {
|
|
2302
|
+
function callInvokeWithMethodAndArg() {
|
|
2303
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
2304
|
+
invoke(method, arg, resolve, reject);
|
|
2305
|
+
});
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
2309
|
+
};
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
2313
|
+
var method = delegate.iterator[context.method];
|
|
2314
|
+
|
|
2315
|
+
if (undefined === method) {
|
|
2316
|
+
if (context.delegate = null, "throw" === context.method) {
|
|
2317
|
+
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
2318
|
+
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
return ContinueSentinel;
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
2325
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
2326
|
+
var info = record.arg;
|
|
2327
|
+
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);
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
function pushTryEntry(locs) {
|
|
2331
|
+
var entry = {
|
|
2332
|
+
tryLoc: locs[0]
|
|
2333
|
+
};
|
|
2334
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
function resetTryEntry(entry) {
|
|
2338
|
+
var record = entry.completion || {};
|
|
2339
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
function Context(tryLocsList) {
|
|
2343
|
+
this.tryEntries = [{
|
|
2344
|
+
tryLoc: "root"
|
|
2345
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
function values(iterable) {
|
|
2349
|
+
if (iterable) {
|
|
2350
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
2351
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
2352
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
2353
|
+
|
|
2354
|
+
if (!isNaN(iterable.length)) {
|
|
2355
|
+
var i = -1,
|
|
2356
|
+
next = function next() {
|
|
2357
|
+
for (; ++i < iterable.length;) {
|
|
2358
|
+
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
return next.value = undefined, next.done = !0, next;
|
|
2362
|
+
};
|
|
2363
|
+
|
|
2364
|
+
return next.next = next;
|
|
2365
|
+
}
|
|
2328
2366
|
}
|
|
2329
2367
|
|
|
2330
|
-
return
|
|
2368
|
+
return {
|
|
2369
|
+
next: doneResult
|
|
2370
|
+
};
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
function doneResult() {
|
|
2374
|
+
return {
|
|
2375
|
+
value: undefined,
|
|
2376
|
+
done: !0
|
|
2377
|
+
};
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
2381
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
2382
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
2383
|
+
}, exports.mark = function (genFun) {
|
|
2384
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
2385
|
+
}, exports.awrap = function (arg) {
|
|
2386
|
+
return {
|
|
2387
|
+
__await: arg
|
|
2388
|
+
};
|
|
2389
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
2390
|
+
return this;
|
|
2391
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
2392
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
2393
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
2394
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
2395
|
+
return result.done ? result.value : iter.next();
|
|
2396
|
+
});
|
|
2397
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
2398
|
+
return this;
|
|
2399
|
+
}), define(Gp, "toString", function () {
|
|
2400
|
+
return "[object Generator]";
|
|
2401
|
+
}), exports.keys = function (object) {
|
|
2402
|
+
var keys = [];
|
|
2403
|
+
|
|
2404
|
+
for (var key in object) {
|
|
2405
|
+
keys.push(key);
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
return keys.reverse(), function next() {
|
|
2409
|
+
for (; keys.length;) {
|
|
2410
|
+
var key = keys.pop();
|
|
2411
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
return next.done = !0, next;
|
|
2415
|
+
};
|
|
2416
|
+
}, exports.values = values, Context.prototype = {
|
|
2417
|
+
constructor: Context,
|
|
2418
|
+
reset: function reset(skipTempReset) {
|
|
2419
|
+
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) {
|
|
2420
|
+
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
2421
|
+
}
|
|
2422
|
+
},
|
|
2423
|
+
stop: function stop() {
|
|
2424
|
+
this.done = !0;
|
|
2425
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
2426
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
2427
|
+
return this.rval;
|
|
2428
|
+
},
|
|
2429
|
+
dispatchException: function dispatchException(exception) {
|
|
2430
|
+
if (this.done) throw exception;
|
|
2431
|
+
var context = this;
|
|
2432
|
+
|
|
2433
|
+
function handle(loc, caught) {
|
|
2434
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2438
|
+
var entry = this.tryEntries[i],
|
|
2439
|
+
record = entry.completion;
|
|
2440
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
2441
|
+
|
|
2442
|
+
if (entry.tryLoc <= this.prev) {
|
|
2443
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
2444
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
2445
|
+
|
|
2446
|
+
if (hasCatch && hasFinally) {
|
|
2447
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
2448
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
2449
|
+
} else if (hasCatch) {
|
|
2450
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
2451
|
+
} else {
|
|
2452
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
2453
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
},
|
|
2458
|
+
abrupt: function abrupt(type, arg) {
|
|
2459
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2460
|
+
var entry = this.tryEntries[i];
|
|
2461
|
+
|
|
2462
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
2463
|
+
var finallyEntry = entry;
|
|
2464
|
+
break;
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
2469
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
2470
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
2471
|
+
},
|
|
2472
|
+
complete: function complete(record, afterLoc) {
|
|
2473
|
+
if ("throw" === record.type) throw record.arg;
|
|
2474
|
+
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;
|
|
2475
|
+
},
|
|
2476
|
+
finish: function finish(finallyLoc) {
|
|
2477
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2478
|
+
var entry = this.tryEntries[i];
|
|
2479
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
2480
|
+
}
|
|
2481
|
+
},
|
|
2482
|
+
catch: function _catch(tryLoc) {
|
|
2483
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2484
|
+
var entry = this.tryEntries[i];
|
|
2485
|
+
|
|
2486
|
+
if (entry.tryLoc === tryLoc) {
|
|
2487
|
+
var record = entry.completion;
|
|
2488
|
+
|
|
2489
|
+
if ("throw" === record.type) {
|
|
2490
|
+
var thrown = record.arg;
|
|
2491
|
+
resetTryEntry(entry);
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
return thrown;
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
throw new Error("illegal catch attempt");
|
|
2499
|
+
},
|
|
2500
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
2501
|
+
return this.delegate = {
|
|
2502
|
+
iterator: values(iterable),
|
|
2503
|
+
resultName: resultName,
|
|
2504
|
+
nextLoc: nextLoc
|
|
2505
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
2506
|
+
}
|
|
2507
|
+
}, exports;
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2511
|
+
try {
|
|
2512
|
+
var info = gen[key](arg);
|
|
2513
|
+
var value = info.value;
|
|
2514
|
+
} catch (error) {
|
|
2515
|
+
reject(error);
|
|
2516
|
+
return;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
if (info.done) {
|
|
2520
|
+
resolve(value);
|
|
2521
|
+
} else {
|
|
2522
|
+
Promise.resolve(value).then(_next, _throw);
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
function _asyncToGenerator$2(fn) {
|
|
2527
|
+
return function () {
|
|
2528
|
+
var self = this,
|
|
2529
|
+
args = arguments;
|
|
2530
|
+
return new Promise(function (resolve, reject) {
|
|
2531
|
+
var gen = fn.apply(self, args);
|
|
2532
|
+
|
|
2533
|
+
function _next(value) {
|
|
2534
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
function _throw(err) {
|
|
2538
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
_next(undefined);
|
|
2542
|
+
});
|
|
2331
2543
|
};
|
|
2332
|
-
}
|
|
2544
|
+
}
|
|
2333
2545
|
/**
|
|
2334
|
-
*
|
|
2335
|
-
* @module
|
|
2546
|
+
* Common utilities
|
|
2547
|
+
* @module glMatrix
|
|
2548
|
+
*/
|
|
2549
|
+
// Configuration Constants
|
|
2550
|
+
|
|
2551
|
+
|
|
2552
|
+
var EPSILON = 0.000001;
|
|
2553
|
+
var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
|
|
2554
|
+
if (!Math.hypot) Math.hypot = function () {
|
|
2555
|
+
var y = 0,
|
|
2556
|
+
i = arguments.length;
|
|
2557
|
+
|
|
2558
|
+
while (i--) {
|
|
2559
|
+
y += arguments[i] * arguments[i];
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
return Math.sqrt(y);
|
|
2563
|
+
};
|
|
2564
|
+
/**
|
|
2565
|
+
* 3x3 Matrix
|
|
2566
|
+
* @module mat3
|
|
2336
2567
|
*/
|
|
2337
2568
|
|
|
2338
2569
|
/**
|
|
2339
|
-
* Creates a new identity
|
|
2570
|
+
* Creates a new identity mat3
|
|
2340
2571
|
*
|
|
2341
|
-
* @returns {
|
|
2572
|
+
* @returns {mat3} a new 3x3 matrix
|
|
2342
2573
|
*/
|
|
2343
2574
|
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
var out = new ARRAY_TYPE(4);
|
|
2575
|
+
function create() {
|
|
2576
|
+
var out = new ARRAY_TYPE(9);
|
|
2347
2577
|
|
|
2348
2578
|
if (ARRAY_TYPE != Float32Array) {
|
|
2349
|
-
out[0] = 0;
|
|
2350
2579
|
out[1] = 0;
|
|
2351
2580
|
out[2] = 0;
|
|
2581
|
+
out[3] = 0;
|
|
2582
|
+
out[5] = 0;
|
|
2583
|
+
out[6] = 0;
|
|
2584
|
+
out[7] = 0;
|
|
2352
2585
|
}
|
|
2353
2586
|
|
|
2354
|
-
out[
|
|
2587
|
+
out[0] = 1;
|
|
2588
|
+
out[4] = 1;
|
|
2589
|
+
out[8] = 1;
|
|
2355
2590
|
return out;
|
|
2356
2591
|
}
|
|
2357
2592
|
/**
|
|
2358
|
-
*
|
|
2359
|
-
*
|
|
2360
|
-
*
|
|
2361
|
-
*
|
|
2362
|
-
* @param
|
|
2363
|
-
* @param
|
|
2364
|
-
* @
|
|
2365
|
-
|
|
2593
|
+
* Returns the translation vector component of a transformation
|
|
2594
|
+
* matrix. If a matrix is built with fromRotationTranslation,
|
|
2595
|
+
* the returned vector will be the same as the translation vector
|
|
2596
|
+
* originally supplied.
|
|
2597
|
+
* @param {vec3} out Vector to receive translation component
|
|
2598
|
+
* @param {ReadonlyMat4} mat Matrix to be decomposed (input)
|
|
2599
|
+
* @return {vec3} out
|
|
2600
|
+
*/
|
|
2366
2601
|
|
|
2367
2602
|
|
|
2368
|
-
function
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
out[
|
|
2372
|
-
out[1] = s * axis[1];
|
|
2373
|
-
out[2] = s * axis[2];
|
|
2374
|
-
out[3] = Math.cos(rad);
|
|
2603
|
+
function getTranslation(out, mat) {
|
|
2604
|
+
out[0] = mat[12];
|
|
2605
|
+
out[1] = mat[13];
|
|
2606
|
+
out[2] = mat[14];
|
|
2375
2607
|
return out;
|
|
2376
2608
|
}
|
|
2377
2609
|
/**
|
|
2378
|
-
*
|
|
2379
|
-
*
|
|
2380
|
-
*
|
|
2381
|
-
*
|
|
2382
|
-
*
|
|
2383
|
-
* @param
|
|
2384
|
-
* @
|
|
2610
|
+
* Returns the scaling factor component of a transformation
|
|
2611
|
+
* matrix. If a matrix is built with fromRotationTranslationScale
|
|
2612
|
+
* with a normalized Quaternion paramter, the returned vector will be
|
|
2613
|
+
* the same as the scaling vector
|
|
2614
|
+
* originally supplied.
|
|
2615
|
+
* @param {vec3} out Vector to receive scaling factor component
|
|
2616
|
+
* @param {ReadonlyMat4} mat Matrix to be decomposed (input)
|
|
2617
|
+
* @return {vec3} out
|
|
2385
2618
|
*/
|
|
2386
2619
|
|
|
2387
2620
|
|
|
2388
|
-
function
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
var
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
var
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2621
|
+
function getScaling(out, mat) {
|
|
2622
|
+
var m11 = mat[0];
|
|
2623
|
+
var m12 = mat[1];
|
|
2624
|
+
var m13 = mat[2];
|
|
2625
|
+
var m21 = mat[4];
|
|
2626
|
+
var m22 = mat[5];
|
|
2627
|
+
var m23 = mat[6];
|
|
2628
|
+
var m31 = mat[8];
|
|
2629
|
+
var m32 = mat[9];
|
|
2630
|
+
var m33 = mat[10];
|
|
2631
|
+
out[0] = Math.hypot(m11, m12, m13);
|
|
2632
|
+
out[1] = Math.hypot(m21, m22, m23);
|
|
2633
|
+
out[2] = Math.hypot(m31, m32, m33);
|
|
2634
|
+
return out;
|
|
2635
|
+
}
|
|
2636
|
+
/**
|
|
2637
|
+
* Returns a quaternion representing the rotational component
|
|
2638
|
+
* of a transformation matrix. If a matrix is built with
|
|
2639
|
+
* fromRotationTranslation, the returned quaternion will be the
|
|
2640
|
+
* same as the quaternion originally supplied.
|
|
2641
|
+
* @param {quat} out Quaternion to receive the rotation component
|
|
2642
|
+
* @param {ReadonlyMat4} mat Matrix to be decomposed (input)
|
|
2643
|
+
* @return {quat} out
|
|
2644
|
+
*/
|
|
2402
2645
|
|
|
2403
|
-
if (cosom < 0.0) {
|
|
2404
|
-
cosom = -cosom;
|
|
2405
|
-
bx = -bx;
|
|
2406
|
-
by = -by;
|
|
2407
|
-
bz = -bz;
|
|
2408
|
-
bw = -bw;
|
|
2409
|
-
} // calculate coefficients
|
|
2410
2646
|
|
|
2647
|
+
function getRotation(out, mat) {
|
|
2648
|
+
var scaling = new ARRAY_TYPE(3);
|
|
2649
|
+
getScaling(scaling, mat);
|
|
2650
|
+
var is1 = 1 / scaling[0];
|
|
2651
|
+
var is2 = 1 / scaling[1];
|
|
2652
|
+
var is3 = 1 / scaling[2];
|
|
2653
|
+
var sm11 = mat[0] * is1;
|
|
2654
|
+
var sm12 = mat[1] * is2;
|
|
2655
|
+
var sm13 = mat[2] * is3;
|
|
2656
|
+
var sm21 = mat[4] * is1;
|
|
2657
|
+
var sm22 = mat[5] * is2;
|
|
2658
|
+
var sm23 = mat[6] * is3;
|
|
2659
|
+
var sm31 = mat[8] * is1;
|
|
2660
|
+
var sm32 = mat[9] * is2;
|
|
2661
|
+
var sm33 = mat[10] * is3;
|
|
2662
|
+
var trace = sm11 + sm22 + sm33;
|
|
2663
|
+
var S = 0;
|
|
2411
2664
|
|
|
2412
|
-
if (
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2665
|
+
if (trace > 0) {
|
|
2666
|
+
S = Math.sqrt(trace + 1.0) * 2;
|
|
2667
|
+
out[3] = 0.25 * S;
|
|
2668
|
+
out[0] = (sm23 - sm32) / S;
|
|
2669
|
+
out[1] = (sm31 - sm13) / S;
|
|
2670
|
+
out[2] = (sm12 - sm21) / S;
|
|
2671
|
+
} else if (sm11 > sm22 && sm11 > sm33) {
|
|
2672
|
+
S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;
|
|
2673
|
+
out[3] = (sm23 - sm32) / S;
|
|
2674
|
+
out[0] = 0.25 * S;
|
|
2675
|
+
out[1] = (sm12 + sm21) / S;
|
|
2676
|
+
out[2] = (sm31 + sm13) / S;
|
|
2677
|
+
} else if (sm22 > sm33) {
|
|
2678
|
+
S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;
|
|
2679
|
+
out[3] = (sm31 - sm13) / S;
|
|
2680
|
+
out[0] = (sm12 + sm21) / S;
|
|
2681
|
+
out[1] = 0.25 * S;
|
|
2682
|
+
out[2] = (sm23 + sm32) / S;
|
|
2418
2683
|
} else {
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2684
|
+
S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;
|
|
2685
|
+
out[3] = (sm12 - sm21) / S;
|
|
2686
|
+
out[0] = (sm31 + sm13) / S;
|
|
2687
|
+
out[1] = (sm23 + sm32) / S;
|
|
2688
|
+
out[2] = 0.25 * S;
|
|
2689
|
+
}
|
|
2425
2690
|
|
|
2426
|
-
out[0] = scale0 * ax + scale1 * bx;
|
|
2427
|
-
out[1] = scale0 * ay + scale1 * by;
|
|
2428
|
-
out[2] = scale0 * az + scale1 * bz;
|
|
2429
|
-
out[3] = scale0 * aw + scale1 * bw;
|
|
2430
2691
|
return out;
|
|
2431
2692
|
}
|
|
2432
2693
|
/**
|
|
2433
|
-
*
|
|
2434
|
-
*
|
|
2435
|
-
* NOTE: The resultant quaternion is not normalized, so you should be sure
|
|
2436
|
-
* to renormalize the quaternion yourself where necessary.
|
|
2437
|
-
*
|
|
2438
|
-
* @param {quat} out the receiving quaternion
|
|
2439
|
-
* @param {ReadonlyMat3} m rotation matrix
|
|
2440
|
-
* @returns {quat} out
|
|
2441
|
-
* @function
|
|
2694
|
+
* 3 Dimensional Vector
|
|
2695
|
+
* @module vec3
|
|
2442
2696
|
*/
|
|
2443
2697
|
|
|
2698
|
+
/**
|
|
2699
|
+
* Creates a new, empty vec3
|
|
2700
|
+
*
|
|
2701
|
+
* @returns {vec3} a new 3D vector
|
|
2702
|
+
*/
|
|
2444
2703
|
|
|
2445
|
-
function fromMat3(out, m) {
|
|
2446
|
-
// Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
|
|
2447
|
-
// article "Quaternion Calculus and Fast Animation".
|
|
2448
|
-
var fTrace = m[0] + m[4] + m[8];
|
|
2449
|
-
var fRoot;
|
|
2450
|
-
|
|
2451
|
-
if (fTrace > 0.0) {
|
|
2452
|
-
// |w| > 1/2, may as well choose w > 1/2
|
|
2453
|
-
fRoot = Math.sqrt(fTrace + 1.0); // 2w
|
|
2454
|
-
|
|
2455
|
-
out[3] = 0.5 * fRoot;
|
|
2456
|
-
fRoot = 0.5 / fRoot; // 1/(4w)
|
|
2457
2704
|
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
if (m[8] > m[i * 3 + i]) i = 2;
|
|
2466
|
-
var j = (i + 1) % 3;
|
|
2467
|
-
var k = (i + 2) % 3;
|
|
2468
|
-
fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);
|
|
2469
|
-
out[i] = 0.5 * fRoot;
|
|
2470
|
-
fRoot = 0.5 / fRoot;
|
|
2471
|
-
out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;
|
|
2472
|
-
out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;
|
|
2473
|
-
out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;
|
|
2705
|
+
function create$1() {
|
|
2706
|
+
var out = new ARRAY_TYPE(3);
|
|
2707
|
+
|
|
2708
|
+
if (ARRAY_TYPE != Float32Array) {
|
|
2709
|
+
out[0] = 0;
|
|
2710
|
+
out[1] = 0;
|
|
2711
|
+
out[2] = 0;
|
|
2474
2712
|
}
|
|
2475
2713
|
|
|
2476
2714
|
return out;
|
|
2477
2715
|
}
|
|
2478
2716
|
/**
|
|
2479
|
-
*
|
|
2717
|
+
* Calculates the length of a vec3
|
|
2480
2718
|
*
|
|
2481
|
-
* @param {
|
|
2482
|
-
* @
|
|
2483
|
-
* @returns {quat} out
|
|
2484
|
-
* @function
|
|
2719
|
+
* @param {ReadonlyVec3} a vector to calculate length of
|
|
2720
|
+
* @returns {Number} length of a
|
|
2485
2721
|
*/
|
|
2486
2722
|
|
|
2487
2723
|
|
|
2488
|
-
|
|
2724
|
+
function length(a) {
|
|
2725
|
+
var x = a[0];
|
|
2726
|
+
var y = a[1];
|
|
2727
|
+
var z = a[2];
|
|
2728
|
+
return Math.hypot(x, y, z);
|
|
2729
|
+
}
|
|
2489
2730
|
/**
|
|
2490
|
-
*
|
|
2491
|
-
* vector to another.
|
|
2492
|
-
*
|
|
2493
|
-
* Both vectors are assumed to be unit length.
|
|
2731
|
+
* Creates a new vec3 initialized with the given values
|
|
2494
2732
|
*
|
|
2495
|
-
* @param {
|
|
2496
|
-
* @param {
|
|
2497
|
-
* @param {
|
|
2498
|
-
* @returns {
|
|
2733
|
+
* @param {Number} x X component
|
|
2734
|
+
* @param {Number} y Y component
|
|
2735
|
+
* @param {Number} z Z component
|
|
2736
|
+
* @returns {vec3} a new 3D vector
|
|
2499
2737
|
*/
|
|
2500
2738
|
|
|
2501
|
-
var rotationTo = function () {
|
|
2502
|
-
var tmpvec3 = create$1();
|
|
2503
|
-
var xUnitVec3 = fromValues(1, 0, 0);
|
|
2504
|
-
var yUnitVec3 = fromValues(0, 1, 0);
|
|
2505
|
-
return function (out, a, b) {
|
|
2506
|
-
var dot$1 = dot(a, b);
|
|
2507
2739
|
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
out[0] = 0;
|
|
2516
|
-
out[1] = 0;
|
|
2517
|
-
out[2] = 0;
|
|
2518
|
-
out[3] = 1;
|
|
2519
|
-
return out;
|
|
2520
|
-
} else {
|
|
2521
|
-
cross(tmpvec3, a, b);
|
|
2522
|
-
out[0] = tmpvec3[0];
|
|
2523
|
-
out[1] = tmpvec3[1];
|
|
2524
|
-
out[2] = tmpvec3[2];
|
|
2525
|
-
out[3] = 1 + dot$1;
|
|
2526
|
-
return normalize$2(out, out);
|
|
2527
|
-
}
|
|
2528
|
-
};
|
|
2529
|
-
}();
|
|
2740
|
+
function fromValues(x, y, z) {
|
|
2741
|
+
var out = new ARRAY_TYPE(3);
|
|
2742
|
+
out[0] = x;
|
|
2743
|
+
out[1] = y;
|
|
2744
|
+
out[2] = z;
|
|
2745
|
+
return out;
|
|
2746
|
+
}
|
|
2530
2747
|
/**
|
|
2531
|
-
*
|
|
2748
|
+
* Normalize a vec3
|
|
2532
2749
|
*
|
|
2533
|
-
* @param {
|
|
2534
|
-
* @param {
|
|
2535
|
-
* @
|
|
2536
|
-
* @param {ReadonlyQuat} c the third operand
|
|
2537
|
-
* @param {ReadonlyQuat} d the fourth operand
|
|
2538
|
-
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
2539
|
-
* @returns {quat} out
|
|
2750
|
+
* @param {vec3} out the receiving vector
|
|
2751
|
+
* @param {ReadonlyVec3} a vector to normalize
|
|
2752
|
+
* @returns {vec3} out
|
|
2540
2753
|
*/
|
|
2541
2754
|
|
|
2542
2755
|
|
|
2543
|
-
|
|
2544
|
-
var
|
|
2545
|
-
var
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2756
|
+
function normalize(out, a) {
|
|
2757
|
+
var x = a[0];
|
|
2758
|
+
var y = a[1];
|
|
2759
|
+
var z = a[2];
|
|
2760
|
+
var len = x * x + y * y + z * z;
|
|
2761
|
+
|
|
2762
|
+
if (len > 0) {
|
|
2763
|
+
//TODO: evaluate use of glm_invsqrt here?
|
|
2764
|
+
len = 1 / Math.sqrt(len);
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
out[0] = a[0] * len;
|
|
2768
|
+
out[1] = a[1] * len;
|
|
2769
|
+
out[2] = a[2] * len;
|
|
2770
|
+
return out;
|
|
2771
|
+
}
|
|
2553
2772
|
/**
|
|
2554
|
-
*
|
|
2555
|
-
* axes. Each axis is a vec3 and is expected to be unit length and
|
|
2556
|
-
* perpendicular to all other specified axes.
|
|
2773
|
+
* Calculates the dot product of two vec3's
|
|
2557
2774
|
*
|
|
2558
|
-
* @param {ReadonlyVec3}
|
|
2559
|
-
* @param {ReadonlyVec3}
|
|
2560
|
-
* @
|
|
2561
|
-
* @returns {quat} out
|
|
2775
|
+
* @param {ReadonlyVec3} a the first operand
|
|
2776
|
+
* @param {ReadonlyVec3} b the second operand
|
|
2777
|
+
* @returns {Number} dot product of a and b
|
|
2562
2778
|
*/
|
|
2563
2779
|
|
|
2564
2780
|
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
matr[5] = -view[1];
|
|
2576
|
-
matr[8] = -view[2];
|
|
2577
|
-
return normalize$2(out, fromMat3(out, matr));
|
|
2578
|
-
};
|
|
2579
|
-
}();
|
|
2580
|
-
|
|
2581
|
-
var FILTER_PREFIX = 'g-filter-';
|
|
2582
|
-
/**
|
|
2583
|
-
* use SVG filters, eg. blur, brightness, contrast...
|
|
2584
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/filter
|
|
2781
|
+
function dot(a, b) {
|
|
2782
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* Computes the cross product of two vec3's
|
|
2786
|
+
*
|
|
2787
|
+
* @param {vec3} out the receiving vector
|
|
2788
|
+
* @param {ReadonlyVec3} a the first operand
|
|
2789
|
+
* @param {ReadonlyVec3} b the second operand
|
|
2790
|
+
* @returns {vec3} out
|
|
2585
2791
|
*/
|
|
2586
2792
|
|
|
2587
|
-
function createOrUpdateFilter(document, $def, object, $el, filters) {
|
|
2588
|
-
// eg. filter="url(#f1) url(#f2)"
|
|
2589
|
-
var filterName = FILTER_PREFIX + object.entity;
|
|
2590
|
-
var $existedFilters = $def.querySelectorAll("[name=" + filterName + "]");
|
|
2591
|
-
|
|
2592
|
-
if ($existedFilters.length) {
|
|
2593
|
-
$existedFilters.forEach(function ($filter) {
|
|
2594
|
-
$def.removeChild($filter);
|
|
2595
|
-
});
|
|
2596
|
-
}
|
|
2597
|
-
|
|
2598
|
-
if (filters.length === 0) {
|
|
2599
|
-
// 'none'
|
|
2600
|
-
$el === null || $el === void 0 ? void 0 : $el.removeAttribute('filter');
|
|
2601
|
-
} else {
|
|
2602
|
-
var filterIds = filters.map(function (_ref, i) {
|
|
2603
|
-
var name = _ref.name,
|
|
2604
|
-
params = _ref.params;
|
|
2605
|
-
var $filter = createSVGElement('filter', document); // @see https://github.com/antvis/g/issues/1025
|
|
2606
|
-
|
|
2607
|
-
$filter.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
2608
|
-
|
|
2609
|
-
if (name === 'blur') {
|
|
2610
|
-
createBlur(document, $filter, params);
|
|
2611
|
-
} else if (name === 'brightness') {
|
|
2612
|
-
createBrightness(document, $filter, params);
|
|
2613
|
-
} else if (name === 'drop-shadow') {
|
|
2614
|
-
createDropShadow(document, $filter, params);
|
|
2615
|
-
} else if (name === 'contrast') {
|
|
2616
|
-
createContrast(document, $filter, params);
|
|
2617
|
-
} else if (name === 'grayscale') {
|
|
2618
|
-
createGrayscale(document, $filter, params);
|
|
2619
|
-
} else if (name === 'sepia') {
|
|
2620
|
-
createSepia(document, $filter, params);
|
|
2621
|
-
} else if (name === 'saturate') {
|
|
2622
|
-
createSaturate(document, $filter, params);
|
|
2623
|
-
} else if (name === 'hue-rotate') {
|
|
2624
|
-
createHueRotate(document, $filter, params);
|
|
2625
|
-
} else if (name === 'invert') {
|
|
2626
|
-
createInvert(document, $filter, params);
|
|
2627
|
-
}
|
|
2628
|
-
|
|
2629
|
-
$filter.id = filterName + "-" + i;
|
|
2630
|
-
$filter.setAttribute('name', filterName);
|
|
2631
|
-
$def.appendChild($filter);
|
|
2632
|
-
return $filter.id;
|
|
2633
|
-
});
|
|
2634
|
-
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', filterIds.map(function (filterId) {
|
|
2635
|
-
return "url(#" + filterId + ")";
|
|
2636
|
-
}).join(' '));
|
|
2637
|
-
}
|
|
2638
|
-
}
|
|
2639
2793
|
|
|
2640
|
-
function
|
|
2641
|
-
|
|
2794
|
+
function cross(out, a, b) {
|
|
2795
|
+
var ax = a[0],
|
|
2796
|
+
ay = a[1],
|
|
2797
|
+
az = a[2];
|
|
2798
|
+
var bx = b[0],
|
|
2799
|
+
by = b[1],
|
|
2800
|
+
bz = b[2];
|
|
2801
|
+
out[0] = ay * bz - az * by;
|
|
2802
|
+
out[1] = az * bx - ax * bz;
|
|
2803
|
+
out[2] = ax * by - ay * bx;
|
|
2804
|
+
return out;
|
|
2642
2805
|
}
|
|
2643
|
-
/**
|
|
2644
|
-
* @
|
|
2806
|
+
/**
|
|
2807
|
+
* Alias for {@link vec3.length}
|
|
2808
|
+
* @function
|
|
2645
2809
|
*/
|
|
2646
2810
|
|
|
2647
2811
|
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2812
|
+
var len = length;
|
|
2813
|
+
/**
|
|
2814
|
+
* Perform some operation over an array of vec3s.
|
|
2815
|
+
*
|
|
2816
|
+
* @param {Array} a the array of vectors to iterate over
|
|
2817
|
+
* @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
|
|
2818
|
+
* @param {Number} offset Number of elements to skip at the beginning of the array
|
|
2819
|
+
* @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
|
|
2820
|
+
* @param {Function} fn Function to call for each vector in the array
|
|
2821
|
+
* @param {Object} [arg] additional argument to pass to fn
|
|
2822
|
+
* @returns {Array} a
|
|
2823
|
+
* @function
|
|
2824
|
+
*/
|
|
2654
2825
|
|
|
2655
|
-
function
|
|
2656
|
-
var
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
tableValues = _ref2.tableValues;
|
|
2660
|
-
var $feComponentTransfer = createSVGElement('feComponentTransfer', document);
|
|
2661
|
-
[createSVGElement('feFuncR', document), createSVGElement('feFuncG', document), createSVGElement('feFuncB', document)].forEach(function ($feFunc) {
|
|
2662
|
-
$feFunc.setAttribute('type', type);
|
|
2826
|
+
var forEach = function () {
|
|
2827
|
+
var vec = create$1();
|
|
2828
|
+
return function (a, stride, offset, count, fn, arg) {
|
|
2829
|
+
var i, l;
|
|
2663
2830
|
|
|
2664
|
-
if (
|
|
2665
|
-
|
|
2666
|
-
} else {
|
|
2667
|
-
$feFunc.setAttribute('slope', "" + slope);
|
|
2668
|
-
$feFunc.setAttribute('intercept', "" + intercept);
|
|
2831
|
+
if (!stride) {
|
|
2832
|
+
stride = 3;
|
|
2669
2833
|
}
|
|
2670
2834
|
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
}
|
|
2835
|
+
if (!offset) {
|
|
2836
|
+
offset = 0;
|
|
2837
|
+
}
|
|
2675
2838
|
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
intercept: -(0.5 * slope) + 0.5
|
|
2682
|
-
});
|
|
2683
|
-
}
|
|
2839
|
+
if (count) {
|
|
2840
|
+
l = Math.min(count * stride + offset, a.length);
|
|
2841
|
+
} else {
|
|
2842
|
+
l = a.length;
|
|
2843
|
+
}
|
|
2684
2844
|
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2845
|
+
for (i = offset; i < l; i += stride) {
|
|
2846
|
+
vec[0] = a[i];
|
|
2847
|
+
vec[1] = a[i + 1];
|
|
2848
|
+
vec[2] = a[i + 2];
|
|
2849
|
+
fn(vec, vec, arg);
|
|
2850
|
+
a[i] = vec[0];
|
|
2851
|
+
a[i + 1] = vec[1];
|
|
2852
|
+
a[i + 2] = vec[2];
|
|
2853
|
+
}
|
|
2692
2854
|
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
}
|
|
2855
|
+
return a;
|
|
2856
|
+
};
|
|
2857
|
+
}();
|
|
2858
|
+
/**
|
|
2859
|
+
* 4 Dimensional Vector
|
|
2860
|
+
* @module vec4
|
|
2861
|
+
*/
|
|
2701
2862
|
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
$filter.appendChild($feColorMatrix);
|
|
2708
|
-
}
|
|
2863
|
+
/**
|
|
2864
|
+
* Creates a new, empty vec4
|
|
2865
|
+
*
|
|
2866
|
+
* @returns {vec4} a new 4D vector
|
|
2867
|
+
*/
|
|
2709
2868
|
|
|
2710
|
-
function createHueRotate(document, $filter, params) {
|
|
2711
|
-
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
2712
|
-
$feColorMatrix.setAttribute('type', 'hueRotate');
|
|
2713
|
-
$feColorMatrix.setAttribute('values', "" + params[0].to(g.UnitType.kDegrees).value);
|
|
2714
|
-
$filter.appendChild($feColorMatrix);
|
|
2715
|
-
}
|
|
2716
2869
|
|
|
2717
|
-
function
|
|
2718
|
-
var
|
|
2719
|
-
var shadowOffsetY = params[1].value;
|
|
2720
|
-
var shadowBlur = params[2].value; // @ts-ignore
|
|
2870
|
+
function create$2() {
|
|
2871
|
+
var out = new ARRAY_TYPE(4);
|
|
2721
2872
|
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
$feOffset.setAttribute('dx', "" + shadowOffsetX);
|
|
2729
|
-
$feOffset.setAttribute('dy', "" + shadowOffsetY);
|
|
2730
|
-
$feOffset.setAttribute('result', 'offsetblur');
|
|
2731
|
-
$filter.appendChild($feOffset);
|
|
2732
|
-
var $feFlood = createSVGElement('feFlood', document);
|
|
2733
|
-
$feFlood.setAttribute('flood-color', shadowColor);
|
|
2734
|
-
$filter.appendChild($feFlood);
|
|
2735
|
-
var $feComposite = createSVGElement('feComposite', document);
|
|
2736
|
-
$feComposite.setAttribute('in2', 'offsetblur');
|
|
2737
|
-
$feComposite.setAttribute('operator', 'in');
|
|
2738
|
-
$filter.appendChild($feComposite);
|
|
2739
|
-
var $feMerge = createSVGElement('feMerge', document);
|
|
2740
|
-
$filter.appendChild($feMerge);
|
|
2741
|
-
var $feMergeNode1 = createSVGElement('feMergeNode', document);
|
|
2742
|
-
var $feMergeNode2 = createSVGElement('feMergeNode', document);
|
|
2743
|
-
$feMergeNode2.setAttribute('in', 'SourceGraphic');
|
|
2744
|
-
$feMerge.appendChild($feMergeNode1);
|
|
2745
|
-
$feMerge.appendChild($feMergeNode2);
|
|
2746
|
-
}
|
|
2873
|
+
if (ARRAY_TYPE != Float32Array) {
|
|
2874
|
+
out[0] = 0;
|
|
2875
|
+
out[1] = 0;
|
|
2876
|
+
out[2] = 0;
|
|
2877
|
+
out[3] = 0;
|
|
2878
|
+
}
|
|
2747
2879
|
|
|
2748
|
-
|
|
2749
|
-
var $feColorMatrix = createSVGElement('feColorMatrix', document);
|
|
2750
|
-
$feColorMatrix.setAttribute('type', 'matrix');
|
|
2751
|
-
$feColorMatrix.setAttribute('values', matrix.join(' '));
|
|
2752
|
-
$filter.appendChild($feColorMatrix);
|
|
2880
|
+
return out;
|
|
2753
2881
|
}
|
|
2754
|
-
/**
|
|
2755
|
-
*
|
|
2882
|
+
/**
|
|
2883
|
+
* Normalize a vec4
|
|
2884
|
+
*
|
|
2885
|
+
* @param {vec4} out the receiving vector
|
|
2886
|
+
* @param {ReadonlyVec4} a vector to normalize
|
|
2887
|
+
* @returns {vec4} out
|
|
2756
2888
|
*/
|
|
2757
2889
|
|
|
2758
2890
|
|
|
2759
|
-
function
|
|
2760
|
-
var
|
|
2761
|
-
|
|
2891
|
+
function normalize$1(out, a) {
|
|
2892
|
+
var x = a[0];
|
|
2893
|
+
var y = a[1];
|
|
2894
|
+
var z = a[2];
|
|
2895
|
+
var w = a[3];
|
|
2896
|
+
var len = x * x + y * y + z * z + w * w;
|
|
2897
|
+
|
|
2898
|
+
if (len > 0) {
|
|
2899
|
+
len = 1 / Math.sqrt(len);
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2902
|
+
out[0] = x * len;
|
|
2903
|
+
out[1] = y * len;
|
|
2904
|
+
out[2] = z * len;
|
|
2905
|
+
out[3] = w * len;
|
|
2906
|
+
return out;
|
|
2762
2907
|
}
|
|
2763
|
-
/**
|
|
2764
|
-
*
|
|
2908
|
+
/**
|
|
2909
|
+
* Perform some operation over an array of vec4s.
|
|
2910
|
+
*
|
|
2911
|
+
* @param {Array} a the array of vectors to iterate over
|
|
2912
|
+
* @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed
|
|
2913
|
+
* @param {Number} offset Number of elements to skip at the beginning of the array
|
|
2914
|
+
* @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array
|
|
2915
|
+
* @param {Function} fn Function to call for each vector in the array
|
|
2916
|
+
* @param {Object} [arg] additional argument to pass to fn
|
|
2917
|
+
* @returns {Array} a
|
|
2918
|
+
* @function
|
|
2765
2919
|
*/
|
|
2766
2920
|
|
|
2767
2921
|
|
|
2768
|
-
function
|
|
2769
|
-
var
|
|
2770
|
-
|
|
2771
|
-
|
|
2922
|
+
var forEach$1 = function () {
|
|
2923
|
+
var vec = create$2();
|
|
2924
|
+
return function (a, stride, offset, count, fn, arg) {
|
|
2925
|
+
var i, l;
|
|
2772
2926
|
|
|
2773
|
-
|
|
2774
|
-
|
|
2927
|
+
if (!stride) {
|
|
2928
|
+
stride = 4;
|
|
2929
|
+
}
|
|
2775
2930
|
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
return;
|
|
2780
|
-
}
|
|
2931
|
+
if (!offset) {
|
|
2932
|
+
offset = 0;
|
|
2933
|
+
}
|
|
2781
2934
|
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
if (object.style[name] === 'currentColor') {
|
|
2785
|
-
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, 'currentColor');
|
|
2935
|
+
if (count) {
|
|
2936
|
+
l = Math.min(count * stride + offset, a.length);
|
|
2786
2937
|
} else {
|
|
2787
|
-
|
|
2788
|
-
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, parsedColor.isNone ? 'none' : parsedColor.toString());
|
|
2938
|
+
l = a.length;
|
|
2789
2939
|
}
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2940
|
+
|
|
2941
|
+
for (i = offset; i < l; i += stride) {
|
|
2942
|
+
vec[0] = a[i];
|
|
2943
|
+
vec[1] = a[i + 1];
|
|
2944
|
+
vec[2] = a[i + 2];
|
|
2945
|
+
vec[3] = a[i + 3];
|
|
2946
|
+
fn(vec, vec, arg);
|
|
2947
|
+
a[i] = vec[0];
|
|
2948
|
+
a[i + 1] = vec[1];
|
|
2949
|
+
a[i + 2] = vec[2];
|
|
2950
|
+
a[i + 3] = vec[3];
|
|
2795
2951
|
}
|
|
2796
|
-
}
|
|
2797
|
-
}
|
|
2798
2952
|
|
|
2799
|
-
|
|
2800
|
-
|
|
2953
|
+
return a;
|
|
2954
|
+
};
|
|
2955
|
+
}();
|
|
2956
|
+
/**
|
|
2957
|
+
* Quaternion
|
|
2958
|
+
* @module quat
|
|
2959
|
+
*/
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* Creates a new identity quat
|
|
2963
|
+
*
|
|
2964
|
+
* @returns {quat} a new quaternion
|
|
2965
|
+
*/
|
|
2801
2966
|
|
|
2802
|
-
if (params instanceof g.CSSGradientValue) {
|
|
2803
|
-
var type = params.type;
|
|
2804
2967
|
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
cacheKey = src;
|
|
2808
|
-
} else if (type === g.GradientPatternType.LinearGradient || type === g.GradientPatternType.RadialGradient) {
|
|
2809
|
-
// @ts-ignore
|
|
2810
|
-
var _params$value = params.value,
|
|
2811
|
-
x0 = _params$value.x0,
|
|
2812
|
-
y0 = _params$value.y0,
|
|
2813
|
-
x1 = _params$value.x1,
|
|
2814
|
-
y1 = _params$value.y1,
|
|
2815
|
-
r1 = _params$value.r1,
|
|
2816
|
-
steps = _params$value.steps;
|
|
2817
|
-
cacheKey = "" + type + x0 + y0 + x1 + y1 + (r1 || 0) + steps.map(function (step) {
|
|
2818
|
-
return step.join('');
|
|
2819
|
-
}).join('');
|
|
2820
|
-
}
|
|
2968
|
+
function create$3() {
|
|
2969
|
+
var out = new ARRAY_TYPE(4);
|
|
2821
2970
|
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
}
|
|
2971
|
+
if (ARRAY_TYPE != Float32Array) {
|
|
2972
|
+
out[0] = 0;
|
|
2973
|
+
out[1] = 0;
|
|
2974
|
+
out[2] = 0;
|
|
2827
2975
|
}
|
|
2828
2976
|
|
|
2829
|
-
|
|
2830
|
-
|
|
2977
|
+
out[3] = 1;
|
|
2978
|
+
return out;
|
|
2979
|
+
}
|
|
2980
|
+
/**
|
|
2981
|
+
* Sets a quat from the given angle and rotation axis,
|
|
2982
|
+
* then returns it.
|
|
2983
|
+
*
|
|
2984
|
+
* @param {quat} out the receiving quaternion
|
|
2985
|
+
* @param {ReadonlyVec3} axis the axis around which to rotate
|
|
2986
|
+
* @param {Number} rad the angle in radians
|
|
2987
|
+
* @returns {quat} out
|
|
2988
|
+
**/
|
|
2989
|
+
|
|
2990
|
+
|
|
2991
|
+
function setAxisAngle(out, axis, rad) {
|
|
2992
|
+
rad = rad * 0.5;
|
|
2993
|
+
var s = Math.sin(rad);
|
|
2994
|
+
out[0] = s * axis[0];
|
|
2995
|
+
out[1] = s * axis[1];
|
|
2996
|
+
out[2] = s * axis[2];
|
|
2997
|
+
out[3] = Math.cos(rad);
|
|
2998
|
+
return out;
|
|
2999
|
+
}
|
|
3000
|
+
/**
|
|
3001
|
+
* Performs a spherical linear interpolation between two quat
|
|
3002
|
+
*
|
|
3003
|
+
* @param {quat} out the receiving quaternion
|
|
3004
|
+
* @param {ReadonlyQuat} a the first operand
|
|
3005
|
+
* @param {ReadonlyQuat} b the second operand
|
|
3006
|
+
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
3007
|
+
* @returns {quat} out
|
|
3008
|
+
*/
|
|
3009
|
+
|
|
2831
3010
|
|
|
2832
|
-
function
|
|
2833
|
-
|
|
2834
|
-
|
|
3011
|
+
function slerp(out, a, b, t) {
|
|
3012
|
+
// benchmarks:
|
|
3013
|
+
// http://jsperf.com/quaternion-slerp-implementations
|
|
3014
|
+
var ax = a[0],
|
|
3015
|
+
ay = a[1],
|
|
3016
|
+
az = a[2],
|
|
3017
|
+
aw = a[3];
|
|
3018
|
+
var bx = b[0],
|
|
3019
|
+
by = b[1],
|
|
3020
|
+
bz = b[2],
|
|
3021
|
+
bw = b[3];
|
|
3022
|
+
var omega, cosom, sinom, scale0, scale1; // calc cosine
|
|
2835
3023
|
|
|
2836
|
-
if
|
|
2837
|
-
var src = parsedColor.value.src; // @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/pattern
|
|
2838
|
-
|
|
2839
|
-
var $pattern = createSVGElement('pattern', document);
|
|
2840
|
-
$pattern.setAttribute('patternUnits', 'userSpaceOnUse');
|
|
2841
|
-
var $image = createSVGElement('image', document);
|
|
2842
|
-
$pattern.appendChild($image);
|
|
2843
|
-
$pattern.id = patternId;
|
|
2844
|
-
$def.appendChild($pattern);
|
|
2845
|
-
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, "url(#" + patternId + ")");
|
|
2846
|
-
$image.setAttribute('href', src);
|
|
2847
|
-
var img = new window.Image();
|
|
2848
|
-
|
|
2849
|
-
if (!src.match(/^data:/i)) {
|
|
2850
|
-
img.crossOrigin = 'Anonymous';
|
|
2851
|
-
}
|
|
3024
|
+
cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)
|
|
2852
3025
|
|
|
2853
|
-
|
|
3026
|
+
if (cosom < 0.0) {
|
|
3027
|
+
cosom = -cosom;
|
|
3028
|
+
bx = -bx;
|
|
3029
|
+
by = -by;
|
|
3030
|
+
bz = -bz;
|
|
3031
|
+
bw = -bw;
|
|
3032
|
+
} // calculate coefficients
|
|
2854
3033
|
|
|
2855
|
-
var onload = function onload() {
|
|
2856
|
-
$pattern.setAttribute('width', "" + img.width);
|
|
2857
|
-
$pattern.setAttribute('height', "" + img.height);
|
|
2858
|
-
};
|
|
2859
3034
|
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
3035
|
+
if (1.0 - cosom > EPSILON) {
|
|
3036
|
+
// standard case (slerp)
|
|
3037
|
+
omega = Math.acos(cosom);
|
|
3038
|
+
sinom = Math.sin(omega);
|
|
3039
|
+
scale0 = Math.sin((1.0 - t) * omega) / sinom;
|
|
3040
|
+
scale1 = Math.sin(t * omega) / sinom;
|
|
3041
|
+
} else {
|
|
3042
|
+
// "from" and "to" quaternions are very close
|
|
3043
|
+
// ... so we can do a linear interpolation
|
|
3044
|
+
scale0 = 1.0 - t;
|
|
3045
|
+
scale1 = t;
|
|
3046
|
+
} // calculate final values
|
|
2864
3047
|
|
|
2865
|
-
img.src = img.src;
|
|
2866
|
-
}
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
3048
|
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
3049
|
+
out[0] = scale0 * ax + scale1 * bx;
|
|
3050
|
+
out[1] = scale0 * ay + scale1 * by;
|
|
3051
|
+
out[2] = scale0 * az + scale1 * bz;
|
|
3052
|
+
out[3] = scale0 * aw + scale1 * bw;
|
|
3053
|
+
return out;
|
|
3054
|
+
}
|
|
3055
|
+
/**
|
|
3056
|
+
* Creates a quaternion from the given 3x3 rotation matrix.
|
|
3057
|
+
*
|
|
3058
|
+
* NOTE: The resultant quaternion is not normalized, so you should be sure
|
|
3059
|
+
* to renormalize the quaternion yourself where necessary.
|
|
3060
|
+
*
|
|
3061
|
+
* @param {quat} out the receiving quaternion
|
|
3062
|
+
* @param {ReadonlyMat3} m rotation matrix
|
|
3063
|
+
* @returns {quat} out
|
|
3064
|
+
* @function
|
|
3065
|
+
*/
|
|
2873
3066
|
|
|
2874
|
-
if (!$existed) {
|
|
2875
|
-
// <linearGradient> <radialGradient>
|
|
2876
|
-
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/linearGradient
|
|
2877
|
-
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/radialGradient
|
|
2878
|
-
$existed = createSVGElement(parsedColor.type === g.GradientPatternType.LinearGradient ? 'linearGradient' : 'radialGradient', document); // @see https://github.com/antvis/g/issues/1025
|
|
2879
3067
|
|
|
2880
|
-
|
|
3068
|
+
function fromMat3(out, m) {
|
|
3069
|
+
// Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
|
|
3070
|
+
// article "Quaternion Calculus and Fast Animation".
|
|
3071
|
+
var fTrace = m[0] + m[4] + m[8];
|
|
3072
|
+
var fRoot;
|
|
2881
3073
|
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
color = _ref[1];
|
|
2886
|
-
innerHTML += "<stop offset=\"" + offset + "\" stop-color=\"" + color + "\"></stop>";
|
|
2887
|
-
});
|
|
2888
|
-
$existed.innerHTML = innerHTML;
|
|
2889
|
-
$existed.id = gradientId;
|
|
2890
|
-
$def.appendChild($existed);
|
|
2891
|
-
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, "url(#" + gradientId + ")");
|
|
2892
|
-
}
|
|
3074
|
+
if (fTrace > 0.0) {
|
|
3075
|
+
// |w| > 1/2, may as well choose w > 1/2
|
|
3076
|
+
fRoot = Math.sqrt(fTrace + 1.0); // 2w
|
|
2893
3077
|
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
var height = bounds && bounds.halfExtents[1] * 2 || 0;
|
|
3078
|
+
out[3] = 0.5 * fRoot;
|
|
3079
|
+
fRoot = 0.5 / fRoot; // 1/(4w)
|
|
2897
3080
|
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
y0 = _parsedColor$value.y0,
|
|
2902
|
-
x1 = _parsedColor$value.x1,
|
|
2903
|
-
y1 = _parsedColor$value.y1;
|
|
2904
|
-
$existed.setAttribute('x1', "" + x0 * width);
|
|
2905
|
-
$existed.setAttribute('y1', "" + y0 * height);
|
|
2906
|
-
$existed.setAttribute('x2', "" + x1 * width);
|
|
2907
|
-
$existed.setAttribute('y2', "" + y1 * height);
|
|
3081
|
+
out[0] = (m[5] - m[7]) * fRoot;
|
|
3082
|
+
out[1] = (m[6] - m[2]) * fRoot;
|
|
3083
|
+
out[2] = (m[1] - m[3]) * fRoot;
|
|
2908
3084
|
} else {
|
|
2909
|
-
|
|
2910
|
-
var
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
3085
|
+
// |w| <= 1/2
|
|
3086
|
+
var i = 0;
|
|
3087
|
+
if (m[4] > m[0]) i = 1;
|
|
3088
|
+
if (m[8] > m[i * 3 + i]) i = 2;
|
|
3089
|
+
var j = (i + 1) % 3;
|
|
3090
|
+
var k = (i + 2) % 3;
|
|
3091
|
+
fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);
|
|
3092
|
+
out[i] = 0.5 * fRoot;
|
|
3093
|
+
fRoot = 0.5 / fRoot;
|
|
3094
|
+
out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;
|
|
3095
|
+
out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;
|
|
3096
|
+
out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;
|
|
2917
3097
|
}
|
|
2918
|
-
}
|
|
2919
3098
|
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
*
|
|
3099
|
+
return out;
|
|
3100
|
+
}
|
|
3101
|
+
/**
|
|
3102
|
+
* Normalize a quat
|
|
3103
|
+
*
|
|
3104
|
+
* @param {quat} out the receiving quaternion
|
|
3105
|
+
* @param {ReadonlyQuat} a quaternion to normalize
|
|
3106
|
+
* @returns {quat} out
|
|
3107
|
+
* @function
|
|
2924
3108
|
*/
|
|
2925
3109
|
|
|
2926
|
-
function createOrUpdateShadow(document, $def, object, $el, name) {
|
|
2927
|
-
var shadowId = FILTER_DROPSHADOW_PREFIX + object.entity;
|
|
2928
|
-
var $existedFilter = $def.querySelector("#" + shadowId);
|
|
2929
|
-
|
|
2930
|
-
if (!$existedFilter) {
|
|
2931
|
-
$existedFilter = createSVGElement('filter', document);
|
|
2932
|
-
|
|
2933
|
-
var _$feDropShadow = createSVGElement('feDropShadow', document);
|
|
2934
|
-
|
|
2935
|
-
_$feDropShadow.setAttribute('dx', '0');
|
|
2936
|
-
|
|
2937
|
-
_$feDropShadow.setAttribute('dy', '0');
|
|
2938
3110
|
|
|
2939
|
-
|
|
2940
|
-
|
|
3111
|
+
var normalize$2 = normalize$1;
|
|
3112
|
+
/**
|
|
3113
|
+
* Sets a quaternion to represent the shortest rotation from one
|
|
3114
|
+
* vector to another.
|
|
3115
|
+
*
|
|
3116
|
+
* Both vectors are assumed to be unit length.
|
|
3117
|
+
*
|
|
3118
|
+
* @param {quat} out the receiving quaternion.
|
|
3119
|
+
* @param {ReadonlyVec3} a the initial vector
|
|
3120
|
+
* @param {ReadonlyVec3} b the destination vector
|
|
3121
|
+
* @returns {quat} out
|
|
3122
|
+
*/
|
|
2941
3123
|
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
3124
|
+
var rotationTo = function () {
|
|
3125
|
+
var tmpvec3 = create$1();
|
|
3126
|
+
var xUnitVec3 = fromValues(1, 0, 0);
|
|
3127
|
+
var yUnitVec3 = fromValues(0, 1, 0);
|
|
3128
|
+
return function (out, a, b) {
|
|
3129
|
+
var dot$1 = dot(a, b);
|
|
2945
3130
|
|
|
2946
|
-
|
|
3131
|
+
if (dot$1 < -0.999999) {
|
|
3132
|
+
cross(tmpvec3, xUnitVec3, a);
|
|
3133
|
+
if (len(tmpvec3) < 0.000001) cross(tmpvec3, yUnitVec3, a);
|
|
3134
|
+
normalize(tmpvec3, tmpvec3);
|
|
3135
|
+
setAxisAngle(out, tmpvec3, Math.PI);
|
|
3136
|
+
return out;
|
|
3137
|
+
} else if (dot$1 > 0.999999) {
|
|
3138
|
+
out[0] = 0;
|
|
3139
|
+
out[1] = 0;
|
|
3140
|
+
out[2] = 0;
|
|
3141
|
+
out[3] = 1;
|
|
3142
|
+
return out;
|
|
3143
|
+
} else {
|
|
3144
|
+
cross(tmpvec3, a, b);
|
|
3145
|
+
out[0] = tmpvec3[0];
|
|
3146
|
+
out[1] = tmpvec3[1];
|
|
3147
|
+
out[2] = tmpvec3[2];
|
|
3148
|
+
out[3] = 1 + dot$1;
|
|
3149
|
+
return normalize$2(out, out);
|
|
3150
|
+
}
|
|
3151
|
+
};
|
|
3152
|
+
}();
|
|
3153
|
+
/**
|
|
3154
|
+
* Performs a spherical linear interpolation with two control points
|
|
3155
|
+
*
|
|
3156
|
+
* @param {quat} out the receiving quaternion
|
|
3157
|
+
* @param {ReadonlyQuat} a the first operand
|
|
3158
|
+
* @param {ReadonlyQuat} b the second operand
|
|
3159
|
+
* @param {ReadonlyQuat} c the third operand
|
|
3160
|
+
* @param {ReadonlyQuat} d the fourth operand
|
|
3161
|
+
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
3162
|
+
* @returns {quat} out
|
|
3163
|
+
*/
|
|
2947
3164
|
|
|
2948
|
-
if (name === 'shadowColor') {
|
|
2949
|
-
var parsedColor = object.parsedStyle[name];
|
|
2950
|
-
$feDropShadow.setAttribute('flood-color', parsedColor.toString());
|
|
2951
|
-
} else if (name === 'shadowBlur') {
|
|
2952
|
-
var shadowBlur = object.parsedStyle[name]; // half the blur radius
|
|
2953
|
-
// @see https://drafts.csswg.org/css-backgrounds/#shadow-blur
|
|
2954
|
-
// @see https://css-tricks.com/breaking-css-box-shadow-vs-drop-shadow/
|
|
2955
3165
|
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
3166
|
+
var sqlerp = function () {
|
|
3167
|
+
var temp1 = create$3();
|
|
3168
|
+
var temp2 = create$3();
|
|
3169
|
+
return function (out, a, b, c, d, t) {
|
|
3170
|
+
slerp(temp1, a, d, t);
|
|
3171
|
+
slerp(temp2, b, c, t);
|
|
3172
|
+
slerp(out, temp1, temp2, 2 * t * (1 - t));
|
|
3173
|
+
return out;
|
|
3174
|
+
};
|
|
3175
|
+
}();
|
|
3176
|
+
/**
|
|
3177
|
+
* Sets the specified quaternion with values corresponding to the given
|
|
3178
|
+
* axes. Each axis is a vec3 and is expected to be unit length and
|
|
3179
|
+
* perpendicular to all other specified axes.
|
|
3180
|
+
*
|
|
3181
|
+
* @param {ReadonlyVec3} view the vector representing the viewing direction
|
|
3182
|
+
* @param {ReadonlyVec3} right the vector representing the local "right" direction
|
|
3183
|
+
* @param {ReadonlyVec3} up the vector representing the local "up" direction
|
|
3184
|
+
* @returns {quat} out
|
|
3185
|
+
*/
|
|
2964
3186
|
|
|
2965
3187
|
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
3188
|
+
var setAxes = function () {
|
|
3189
|
+
var matr = create();
|
|
3190
|
+
return function (out, view, right, up) {
|
|
3191
|
+
matr[0] = right[0];
|
|
3192
|
+
matr[3] = right[1];
|
|
3193
|
+
matr[6] = right[2];
|
|
3194
|
+
matr[1] = up[0];
|
|
3195
|
+
matr[4] = up[1];
|
|
3196
|
+
matr[7] = up[2];
|
|
3197
|
+
matr[2] = -view[0];
|
|
3198
|
+
matr[5] = -view[1];
|
|
3199
|
+
matr[8] = -view[2];
|
|
3200
|
+
return normalize$2(out, fromMat3(out, matr));
|
|
3201
|
+
};
|
|
3202
|
+
}();
|
|
2974
3203
|
|
|
2975
3204
|
var _class$1;
|
|
2976
3205
|
|
|
@@ -3061,7 +3290,7 @@
|
|
|
3061
3290
|
this.contextService = void 0;
|
|
3062
3291
|
this.renderingContext = void 0;
|
|
3063
3292
|
this.createElementContribution = void 0;
|
|
3064
|
-
this
|
|
3293
|
+
this.defElementManager = void 0;
|
|
3065
3294
|
this.$camera = void 0;
|
|
3066
3295
|
this.renderQueue = [];
|
|
3067
3296
|
this.pendingReorderQueue = new Set();
|
|
@@ -3083,6 +3312,8 @@
|
|
|
3083
3312
|
var handleUnmounted = function handleUnmounted(e) {
|
|
3084
3313
|
var object = e.target;
|
|
3085
3314
|
|
|
3315
|
+
_this.defElementManager.clear(object.entity);
|
|
3316
|
+
|
|
3086
3317
|
_this.removeSVGDom(object);
|
|
3087
3318
|
};
|
|
3088
3319
|
|
|
@@ -3120,7 +3351,6 @@
|
|
|
3120
3351
|
var handleGeometryBoundsChanged = function handleGeometryBoundsChanged(e) {
|
|
3121
3352
|
var _object$elementSVG;
|
|
3122
3353
|
|
|
3123
|
-
var doc = _this.canvasConfig.document;
|
|
3124
3354
|
var object = e.target; // @ts-ignore
|
|
3125
3355
|
|
|
3126
3356
|
var $el = (_object$elementSVG = object.elementSVG) === null || _object$elementSVG === void 0 ? void 0 : _object$elementSVG.$el;
|
|
@@ -3129,11 +3359,11 @@
|
|
|
3129
3359
|
stroke = _object$parsedStyle.stroke;
|
|
3130
3360
|
|
|
3131
3361
|
if (fill && !(fill instanceof g.CSSRGB)) {
|
|
3132
|
-
createOrUpdateGradientAndPattern(
|
|
3362
|
+
_this.defElementManager.createOrUpdateGradientAndPattern(object, $el, fill, 'fill');
|
|
3133
3363
|
}
|
|
3134
3364
|
|
|
3135
3365
|
if (stroke && !(stroke instanceof g.CSSRGB)) {
|
|
3136
|
-
createOrUpdateGradientAndPattern(
|
|
3366
|
+
_this.defElementManager.createOrUpdateGradientAndPattern(object, $el, stroke, 'stroke');
|
|
3137
3367
|
}
|
|
3138
3368
|
};
|
|
3139
3369
|
|
|
@@ -3144,15 +3374,16 @@
|
|
|
3144
3374
|
while (1) {
|
|
3145
3375
|
switch (_context.prev = _context.next) {
|
|
3146
3376
|
case 0:
|
|
3147
|
-
_this$canvasConfig = _this.canvasConfig, background = _this$canvasConfig.background, document = _this$canvasConfig.document;
|
|
3148
|
-
|
|
3377
|
+
_this$canvasConfig = _this.canvasConfig, background = _this$canvasConfig.background, document = _this$canvasConfig.document; // <defs>
|
|
3378
|
+
|
|
3379
|
+
_this.defElementManager.init();
|
|
3380
|
+
|
|
3149
3381
|
$svg = _this.contextService.getContext();
|
|
3150
3382
|
|
|
3151
3383
|
if (background) {
|
|
3152
3384
|
$svg.style.background = background;
|
|
3153
|
-
}
|
|
3385
|
+
} // @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/color-interpolation-filters
|
|
3154
3386
|
|
|
3155
|
-
$svg.appendChild(_this.$def); // @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/color-interpolation-filters
|
|
3156
3387
|
|
|
3157
3388
|
$svg.setAttribute('color-interpolation-filters', 'sRGB');
|
|
3158
3389
|
_this.$camera = createSVGElement('g', document);
|
|
@@ -3170,7 +3401,7 @@
|
|
|
3170
3401
|
|
|
3171
3402
|
_this.renderingContext.root.addEventListener(g.ElementEvent.GEOMETRY_BOUNDS_CHANGED, handleGeometryBoundsChanged);
|
|
3172
3403
|
|
|
3173
|
-
case
|
|
3404
|
+
case 13:
|
|
3174
3405
|
case "end":
|
|
3175
3406
|
return _context.stop();
|
|
3176
3407
|
}
|
|
@@ -3346,14 +3577,14 @@
|
|
|
3346
3577
|
if (object.nodeName === g.Shape.HTML) {
|
|
3347
3578
|
$el.style.background = usedValue.toString();
|
|
3348
3579
|
} else {
|
|
3349
|
-
createOrUpdateGradientAndPattern(
|
|
3580
|
+
_this2.defElementManager.createOrUpdateGradientAndPattern(object, $el, usedValue, usedName);
|
|
3350
3581
|
}
|
|
3351
3582
|
} else if (name === 'stroke') {
|
|
3352
3583
|
if (object.nodeName === g.Shape.HTML) {
|
|
3353
3584
|
$el.style['border-color'] = usedValue.toString();
|
|
3354
3585
|
$el.style['border-style'] = 'solid';
|
|
3355
3586
|
} else {
|
|
3356
|
-
createOrUpdateGradientAndPattern(
|
|
3587
|
+
_this2.defElementManager.createOrUpdateGradientAndPattern(object, $el, usedValue, usedName);
|
|
3357
3588
|
}
|
|
3358
3589
|
} else if (name === 'visibility' && computedValue.value !== 'unset') {
|
|
3359
3590
|
// use computed value
|
|
@@ -3362,9 +3593,9 @@
|
|
|
3362
3593
|
} else if (name === 'clipPath') {
|
|
3363
3594
|
_this2.createOrUpdateClipPath(document, usedValue, $groupEl);
|
|
3364
3595
|
} else if (name === 'shadowColor' || name === 'shadowBlur' || name === 'shadowOffsetX' || name === 'shadowOffsetY') {
|
|
3365
|
-
createOrUpdateShadow(
|
|
3596
|
+
_this2.defElementManager.createOrUpdateShadow(object, $el, name);
|
|
3366
3597
|
} else if (name === 'filter') {
|
|
3367
|
-
createOrUpdateFilter(
|
|
3598
|
+
_this2.defElementManager.createOrUpdateFilter(object, $el, usedValue);
|
|
3368
3599
|
} else if (name === 'innerHTML') {
|
|
3369
3600
|
_this2.createOrUpdateInnerHTML(document, $el, usedValue);
|
|
3370
3601
|
} else if (name === 'anchor') {
|
|
@@ -3508,13 +3739,14 @@
|
|
|
3508
3739
|
var _clipPath$elementSVG;
|
|
3509
3740
|
|
|
3510
3741
|
var clipPathId = CLIP_PATH_PREFIX + clipPath.entity;
|
|
3511
|
-
var
|
|
3742
|
+
var $def = this.defElementManager.getDefElement();
|
|
3743
|
+
var existed = $def.querySelector("#" + clipPathId);
|
|
3512
3744
|
|
|
3513
3745
|
if (!existed) {
|
|
3514
3746
|
// create <clipPath> dom node, append it to <defs>
|
|
3515
3747
|
var $clipPath = createSVGElement('clipPath', document);
|
|
3516
3748
|
$clipPath.id = clipPathId;
|
|
3517
|
-
|
|
3749
|
+
$def.appendChild($clipPath); // <clipPath><circle /></clipPath>
|
|
3518
3750
|
|
|
3519
3751
|
this.createSVGDom(document, clipPath, $clipPath, true); // @ts-ignore
|
|
3520
3752
|
|
|
@@ -3557,10 +3789,23 @@
|
|
|
3557
3789
|
|
|
3558
3790
|
[(_object$elementSVG7 = object.elementSVG) === null || _object$elementSVG7 === void 0 ? void 0 : _object$elementSVG7.$el, (_object$elementSVG8 = object.elementSVG) === null || _object$elementSVG8 === void 0 ? void 0 : _object$elementSVG8.$hitTestingEl].forEach(function ($el) {
|
|
3559
3791
|
if ($el) {
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3792
|
+
var defX = 0;
|
|
3793
|
+
var defY = 0;
|
|
3794
|
+
|
|
3795
|
+
if (object.nodeName === g.Shape.POLYLINE || object.nodeName === g.Shape.POLYGON || object.nodeName === g.Shape.PATH) {
|
|
3796
|
+
defX = object.parsedStyle.defX;
|
|
3797
|
+
defY = object.parsedStyle.defY;
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3800
|
+
var tx = -(anchor[0].value * width + defX);
|
|
3801
|
+
var ty = -(anchor[1].value * height + defY);
|
|
3802
|
+
|
|
3803
|
+
if (tx !== 0 || ty !== 0) {
|
|
3804
|
+
// apply anchor to element's `transform` property
|
|
3805
|
+
$el.setAttribute('transform', // can't use percent unit like translate(-50%, -50%)
|
|
3806
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/transform#translate
|
|
3807
|
+
"translate(" + tx + "," + ty + ")");
|
|
3808
|
+
}
|
|
3564
3809
|
|
|
3565
3810
|
if (object.nodeName === g.Shape.CIRCLE || object.nodeName === g.Shape.ELLIPSE) {
|
|
3566
3811
|
$el.setAttribute('cx', "" + width / 2);
|
|
@@ -3583,10 +3828,13 @@
|
|
|
3583
3828
|
|
|
3584
3829
|
__decorate([g.inject(CreateElementContribution), __metadata("design:type", Object)], SVGRendererPlugin.prototype, "createElementContribution", void 0);
|
|
3585
3830
|
|
|
3831
|
+
__decorate([g.inject(DefElementManager), __metadata("design:type", DefElementManager)], SVGRendererPlugin.prototype, "defElementManager", void 0);
|
|
3832
|
+
|
|
3586
3833
|
SVGRendererPlugin = SVGRendererPlugin_1 = __decorate([g.singleton({
|
|
3587
3834
|
contrib: g.RenderingPluginContribution
|
|
3588
3835
|
})], SVGRendererPlugin);
|
|
3589
3836
|
var containerModule$1 = g.Module(function (register) {
|
|
3837
|
+
register(DefElementManager);
|
|
3590
3838
|
register(DefaultCreateElementContribution);
|
|
3591
3839
|
register(SVGRendererPlugin);
|
|
3592
3840
|
});
|