@antv/g-webgpu 1.1.8 → 1.2.0
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.d.ts.map +1 -1
- package/dist/index.esm.js +7 -4
- package/dist/index.js +3 -0
- package/dist/index.umd.js +925 -202
- package/dist/index.umd.min.js +7 -5
- package/package.json +7 -6
package/dist/index.umd.js
CHANGED
|
@@ -1535,6 +1535,661 @@
|
|
|
1535
1535
|
}
|
|
1536
1536
|
});
|
|
1537
1537
|
|
|
1538
|
+
var ImagePool = /*#__PURE__*/function () {
|
|
1539
|
+
function ImagePool() {
|
|
1540
|
+
this.imageCache = {};
|
|
1541
|
+
this.gradientCache = {};
|
|
1542
|
+
this.patternCache = {};
|
|
1543
|
+
this.canvasConfig = void 0;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
var _proto = ImagePool.prototype;
|
|
1547
|
+
|
|
1548
|
+
_proto.getImageSync = function getImageSync(src, callback) {
|
|
1549
|
+
if (!this.imageCache[src]) {
|
|
1550
|
+
this.getOrCreateImage(src).then(function () {
|
|
1551
|
+
if (callback) {
|
|
1552
|
+
callback();
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
return this.imageCache[src];
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
_proto.getOrCreateImage = function getOrCreateImage(src) {
|
|
1561
|
+
var _this = this;
|
|
1562
|
+
|
|
1563
|
+
if (this.imageCache[src]) {
|
|
1564
|
+
return Promise.resolve(this.imageCache[src]);
|
|
1565
|
+
} // @see https://github.com/antvis/g/issues/938
|
|
1566
|
+
|
|
1567
|
+
|
|
1568
|
+
var createImage = this.canvasConfig.createImage;
|
|
1569
|
+
return new Promise(function (resolve, reject) {
|
|
1570
|
+
var image;
|
|
1571
|
+
|
|
1572
|
+
if (createImage) {
|
|
1573
|
+
image = createImage(src);
|
|
1574
|
+
} else if (g.isBrowser) {
|
|
1575
|
+
image = new window.Image();
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
if (image) {
|
|
1579
|
+
image.onload = function () {
|
|
1580
|
+
resolve(image);
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
image.onerror = function (ev) {
|
|
1584
|
+
reject(ev);
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
image.crossOrigin = 'Anonymous';
|
|
1588
|
+
image.src = src;
|
|
1589
|
+
_this.imageCache[src] = image;
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
_proto.getOrCreatePatternSync = function getOrCreatePatternSync(pattern, context, callback) {
|
|
1595
|
+
var patternKey = this.generatePatternKey(pattern);
|
|
1596
|
+
|
|
1597
|
+
if (patternKey && this.patternCache[patternKey]) {
|
|
1598
|
+
return this.patternCache[patternKey];
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
var image = pattern.image,
|
|
1602
|
+
repetition = pattern.repetition;
|
|
1603
|
+
var src; // Image URL
|
|
1604
|
+
|
|
1605
|
+
if (g.isString(image)) {
|
|
1606
|
+
src = this.getImageSync(image, callback);
|
|
1607
|
+
} else {
|
|
1608
|
+
src = image;
|
|
1609
|
+
} // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createPattern
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
var canvasPattern = src && context.createPattern(src, repetition);
|
|
1613
|
+
|
|
1614
|
+
if (patternKey && canvasPattern) {
|
|
1615
|
+
this.patternCache[patternKey] = canvasPattern;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
return canvasPattern;
|
|
1619
|
+
};
|
|
1620
|
+
|
|
1621
|
+
_proto.getOrCreateGradient = function getOrCreateGradient(params, context) {
|
|
1622
|
+
var key = this.generateGradientKey(params); // @ts-ignore
|
|
1623
|
+
|
|
1624
|
+
var type = params.type,
|
|
1625
|
+
steps = params.steps,
|
|
1626
|
+
width = params.width,
|
|
1627
|
+
height = params.height,
|
|
1628
|
+
angle = params.angle,
|
|
1629
|
+
cx = params.cx,
|
|
1630
|
+
cy = params.cy;
|
|
1631
|
+
|
|
1632
|
+
if (this.gradientCache[key]) {
|
|
1633
|
+
return this.gradientCache[key];
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
var gradient = null;
|
|
1637
|
+
|
|
1638
|
+
if (type === g.GradientType.LinearGradient) {
|
|
1639
|
+
var _computeLinearGradien = g.computeLinearGradient(width, height, angle),
|
|
1640
|
+
x1 = _computeLinearGradien.x1,
|
|
1641
|
+
y1 = _computeLinearGradien.y1,
|
|
1642
|
+
x2 = _computeLinearGradien.x2,
|
|
1643
|
+
y2 = _computeLinearGradien.y2; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createLinearGradient
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
gradient = context.createLinearGradient(x1, y1, x2, y2);
|
|
1647
|
+
} else if (type === g.GradientType.RadialGradient) {
|
|
1648
|
+
var _computeRadialGradien = g.computeRadialGradient(width, height, cx, cy),
|
|
1649
|
+
x = _computeRadialGradien.x,
|
|
1650
|
+
y = _computeRadialGradien.y,
|
|
1651
|
+
r = _computeRadialGradien.r; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createRadialGradient
|
|
1652
|
+
|
|
1653
|
+
|
|
1654
|
+
gradient = context.createRadialGradient(x, y, 0, x, y, r);
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
if (gradient) {
|
|
1658
|
+
steps.forEach(function (_ref) {
|
|
1659
|
+
var _gradient;
|
|
1660
|
+
|
|
1661
|
+
var offset = _ref[0],
|
|
1662
|
+
color = _ref[1];
|
|
1663
|
+
(_gradient = gradient) === null || _gradient === void 0 ? void 0 : _gradient.addColorStop(offset, color);
|
|
1664
|
+
});
|
|
1665
|
+
this.gradientCache[key] = gradient;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
return this.gradientCache[key];
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1671
|
+
_proto.generateGradientKey = function generateGradientKey(params) {
|
|
1672
|
+
// @ts-ignore
|
|
1673
|
+
var type = params.type,
|
|
1674
|
+
width = params.width,
|
|
1675
|
+
height = params.height,
|
|
1676
|
+
steps = params.steps,
|
|
1677
|
+
angle = params.angle,
|
|
1678
|
+
cx = params.cx,
|
|
1679
|
+
cy = params.cy;
|
|
1680
|
+
return "gradient-" + type + "-" + (angle || 0) + "-" + (cx || 0) + "-" + (cy || 0) + "-" + width + "-" + height + "-" + steps.map(function (step) {
|
|
1681
|
+
return step.join('');
|
|
1682
|
+
}).join('-');
|
|
1683
|
+
};
|
|
1684
|
+
|
|
1685
|
+
_proto.generatePatternKey = function generatePatternKey(pattern) {
|
|
1686
|
+
var image = pattern.image,
|
|
1687
|
+
repetition = pattern.repetition; // only generate cache for Image
|
|
1688
|
+
|
|
1689
|
+
if (g.isString(image)) {
|
|
1690
|
+
return "pattern-" + image + "-" + repetition;
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
|
|
1694
|
+
return ImagePool;
|
|
1695
|
+
}();
|
|
1696
|
+
|
|
1697
|
+
__decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], ImagePool.prototype, "canvasConfig", void 0);
|
|
1698
|
+
|
|
1699
|
+
ImagePool = __decorate([g.singleton()], ImagePool);
|
|
1700
|
+
|
|
1701
|
+
function _regeneratorRuntime$1() {
|
|
1702
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
1703
|
+
_regeneratorRuntime$1 = function _regeneratorRuntime() {
|
|
1704
|
+
return exports;
|
|
1705
|
+
};
|
|
1706
|
+
|
|
1707
|
+
var exports = {},
|
|
1708
|
+
Op = Object.prototype,
|
|
1709
|
+
hasOwn = Op.hasOwnProperty,
|
|
1710
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
1711
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
1712
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
1713
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
1714
|
+
|
|
1715
|
+
function define(obj, key, value) {
|
|
1716
|
+
return Object.defineProperty(obj, key, {
|
|
1717
|
+
value: value,
|
|
1718
|
+
enumerable: !0,
|
|
1719
|
+
configurable: !0,
|
|
1720
|
+
writable: !0
|
|
1721
|
+
}), obj[key];
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
try {
|
|
1725
|
+
define({}, "");
|
|
1726
|
+
} catch (err) {
|
|
1727
|
+
define = function define(obj, key, value) {
|
|
1728
|
+
return obj[key] = value;
|
|
1729
|
+
};
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
1733
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
1734
|
+
generator = Object.create(protoGenerator.prototype),
|
|
1735
|
+
context = new Context(tryLocsList || []);
|
|
1736
|
+
return generator._invoke = function (innerFn, self, context) {
|
|
1737
|
+
var state = "suspendedStart";
|
|
1738
|
+
return function (method, arg) {
|
|
1739
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
1740
|
+
|
|
1741
|
+
if ("completed" === state) {
|
|
1742
|
+
if ("throw" === method) throw arg;
|
|
1743
|
+
return doneResult();
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
for (context.method = method, context.arg = arg;;) {
|
|
1747
|
+
var delegate = context.delegate;
|
|
1748
|
+
|
|
1749
|
+
if (delegate) {
|
|
1750
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
1751
|
+
|
|
1752
|
+
if (delegateResult) {
|
|
1753
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
1754
|
+
return delegateResult;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
1759
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
1760
|
+
context.dispatchException(context.arg);
|
|
1761
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
1762
|
+
state = "executing";
|
|
1763
|
+
var record = tryCatch(innerFn, self, context);
|
|
1764
|
+
|
|
1765
|
+
if ("normal" === record.type) {
|
|
1766
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
1767
|
+
return {
|
|
1768
|
+
value: record.arg,
|
|
1769
|
+
done: context.done
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
1774
|
+
}
|
|
1775
|
+
};
|
|
1776
|
+
}(innerFn, self, context), generator;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
function tryCatch(fn, obj, arg) {
|
|
1780
|
+
try {
|
|
1781
|
+
return {
|
|
1782
|
+
type: "normal",
|
|
1783
|
+
arg: fn.call(obj, arg)
|
|
1784
|
+
};
|
|
1785
|
+
} catch (err) {
|
|
1786
|
+
return {
|
|
1787
|
+
type: "throw",
|
|
1788
|
+
arg: err
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
exports.wrap = wrap;
|
|
1794
|
+
var ContinueSentinel = {};
|
|
1795
|
+
|
|
1796
|
+
function Generator() {}
|
|
1797
|
+
|
|
1798
|
+
function GeneratorFunction() {}
|
|
1799
|
+
|
|
1800
|
+
function GeneratorFunctionPrototype() {}
|
|
1801
|
+
|
|
1802
|
+
var IteratorPrototype = {};
|
|
1803
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
1804
|
+
return this;
|
|
1805
|
+
});
|
|
1806
|
+
var getProto = Object.getPrototypeOf,
|
|
1807
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1808
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
1809
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1810
|
+
|
|
1811
|
+
function defineIteratorMethods(prototype) {
|
|
1812
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
1813
|
+
define(prototype, method, function (arg) {
|
|
1814
|
+
return this._invoke(method, arg);
|
|
1815
|
+
});
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
1820
|
+
function invoke(method, arg, resolve, reject) {
|
|
1821
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
1822
|
+
|
|
1823
|
+
if ("throw" !== record.type) {
|
|
1824
|
+
var result = record.arg,
|
|
1825
|
+
value = result.value;
|
|
1826
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
1827
|
+
invoke("next", value, resolve, reject);
|
|
1828
|
+
}, function (err) {
|
|
1829
|
+
invoke("throw", err, resolve, reject);
|
|
1830
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
1831
|
+
result.value = unwrapped, resolve(result);
|
|
1832
|
+
}, function (error) {
|
|
1833
|
+
return invoke("throw", error, resolve, reject);
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
reject(record.arg);
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
var previousPromise;
|
|
1841
|
+
|
|
1842
|
+
this._invoke = function (method, arg) {
|
|
1843
|
+
function callInvokeWithMethodAndArg() {
|
|
1844
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
1845
|
+
invoke(method, arg, resolve, reject);
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1850
|
+
};
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
1854
|
+
var method = delegate.iterator[context.method];
|
|
1855
|
+
|
|
1856
|
+
if (undefined === method) {
|
|
1857
|
+
if (context.delegate = null, "throw" === context.method) {
|
|
1858
|
+
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
1859
|
+
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
return ContinueSentinel;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
1866
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
1867
|
+
var info = record.arg;
|
|
1868
|
+
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);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
function pushTryEntry(locs) {
|
|
1872
|
+
var entry = {
|
|
1873
|
+
tryLoc: locs[0]
|
|
1874
|
+
};
|
|
1875
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
function resetTryEntry(entry) {
|
|
1879
|
+
var record = entry.completion || {};
|
|
1880
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
function Context(tryLocsList) {
|
|
1884
|
+
this.tryEntries = [{
|
|
1885
|
+
tryLoc: "root"
|
|
1886
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
function values(iterable) {
|
|
1890
|
+
if (iterable) {
|
|
1891
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
1892
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
1893
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
1894
|
+
|
|
1895
|
+
if (!isNaN(iterable.length)) {
|
|
1896
|
+
var i = -1,
|
|
1897
|
+
next = function next() {
|
|
1898
|
+
for (; ++i < iterable.length;) {
|
|
1899
|
+
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
return next.value = undefined, next.done = !0, next;
|
|
1903
|
+
};
|
|
1904
|
+
|
|
1905
|
+
return next.next = next;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
return {
|
|
1910
|
+
next: doneResult
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
function doneResult() {
|
|
1915
|
+
return {
|
|
1916
|
+
value: undefined,
|
|
1917
|
+
done: !0
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
1922
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
1923
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
1924
|
+
}, exports.mark = function (genFun) {
|
|
1925
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
1926
|
+
}, exports.awrap = function (arg) {
|
|
1927
|
+
return {
|
|
1928
|
+
__await: arg
|
|
1929
|
+
};
|
|
1930
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
1931
|
+
return this;
|
|
1932
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
1933
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
1934
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
1935
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
1936
|
+
return result.done ? result.value : iter.next();
|
|
1937
|
+
});
|
|
1938
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
1939
|
+
return this;
|
|
1940
|
+
}), define(Gp, "toString", function () {
|
|
1941
|
+
return "[object Generator]";
|
|
1942
|
+
}), exports.keys = function (object) {
|
|
1943
|
+
var keys = [];
|
|
1944
|
+
|
|
1945
|
+
for (var key in object) {
|
|
1946
|
+
keys.push(key);
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
return keys.reverse(), function next() {
|
|
1950
|
+
for (; keys.length;) {
|
|
1951
|
+
var key = keys.pop();
|
|
1952
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
return next.done = !0, next;
|
|
1956
|
+
};
|
|
1957
|
+
}, exports.values = values, Context.prototype = {
|
|
1958
|
+
constructor: Context,
|
|
1959
|
+
reset: function reset(skipTempReset) {
|
|
1960
|
+
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) {
|
|
1961
|
+
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
1962
|
+
}
|
|
1963
|
+
},
|
|
1964
|
+
stop: function stop() {
|
|
1965
|
+
this.done = !0;
|
|
1966
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
1967
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
1968
|
+
return this.rval;
|
|
1969
|
+
},
|
|
1970
|
+
dispatchException: function dispatchException(exception) {
|
|
1971
|
+
if (this.done) throw exception;
|
|
1972
|
+
var context = this;
|
|
1973
|
+
|
|
1974
|
+
function handle(loc, caught) {
|
|
1975
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1979
|
+
var entry = this.tryEntries[i],
|
|
1980
|
+
record = entry.completion;
|
|
1981
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
1982
|
+
|
|
1983
|
+
if (entry.tryLoc <= this.prev) {
|
|
1984
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
1985
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1986
|
+
|
|
1987
|
+
if (hasCatch && hasFinally) {
|
|
1988
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1989
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1990
|
+
} else if (hasCatch) {
|
|
1991
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1992
|
+
} else {
|
|
1993
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
1994
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
},
|
|
1999
|
+
abrupt: function abrupt(type, arg) {
|
|
2000
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2001
|
+
var entry = this.tryEntries[i];
|
|
2002
|
+
|
|
2003
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
2004
|
+
var finallyEntry = entry;
|
|
2005
|
+
break;
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
2010
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
2011
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
2012
|
+
},
|
|
2013
|
+
complete: function complete(record, afterLoc) {
|
|
2014
|
+
if ("throw" === record.type) throw record.arg;
|
|
2015
|
+
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;
|
|
2016
|
+
},
|
|
2017
|
+
finish: function finish(finallyLoc) {
|
|
2018
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2019
|
+
var entry = this.tryEntries[i];
|
|
2020
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
2021
|
+
}
|
|
2022
|
+
},
|
|
2023
|
+
catch: function _catch(tryLoc) {
|
|
2024
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2025
|
+
var entry = this.tryEntries[i];
|
|
2026
|
+
|
|
2027
|
+
if (entry.tryLoc === tryLoc) {
|
|
2028
|
+
var record = entry.completion;
|
|
2029
|
+
|
|
2030
|
+
if ("throw" === record.type) {
|
|
2031
|
+
var thrown = record.arg;
|
|
2032
|
+
resetTryEntry(entry);
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
return thrown;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
throw new Error("illegal catch attempt");
|
|
2040
|
+
},
|
|
2041
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
2042
|
+
return this.delegate = {
|
|
2043
|
+
iterator: values(iterable),
|
|
2044
|
+
resultName: resultName,
|
|
2045
|
+
nextLoc: nextLoc
|
|
2046
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
2047
|
+
}
|
|
2048
|
+
}, exports;
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2052
|
+
try {
|
|
2053
|
+
var info = gen[key](arg);
|
|
2054
|
+
var value = info.value;
|
|
2055
|
+
} catch (error) {
|
|
2056
|
+
reject(error);
|
|
2057
|
+
return;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
if (info.done) {
|
|
2061
|
+
resolve(value);
|
|
2062
|
+
} else {
|
|
2063
|
+
Promise.resolve(value).then(_next, _throw);
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
function _asyncToGenerator$1(fn) {
|
|
2068
|
+
return function () {
|
|
2069
|
+
var self = this,
|
|
2070
|
+
args = arguments;
|
|
2071
|
+
return new Promise(function (resolve, reject) {
|
|
2072
|
+
var gen = fn.apply(self, args);
|
|
2073
|
+
|
|
2074
|
+
function _next(value) {
|
|
2075
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
function _throw(err) {
|
|
2079
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
_next(undefined);
|
|
2083
|
+
});
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
var _class;
|
|
2088
|
+
|
|
2089
|
+
var LoadImagePlugin_1;
|
|
2090
|
+
var LoadImagePlugin = LoadImagePlugin_1 = (_class = /*#__PURE__*/function () {
|
|
2091
|
+
function LoadImagePlugin() {
|
|
2092
|
+
this.imagePool = void 0;
|
|
2093
|
+
this.renderingContext = void 0;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
var _proto = LoadImagePlugin.prototype;
|
|
2097
|
+
|
|
2098
|
+
_proto.apply = function apply(renderingService) {
|
|
2099
|
+
var _this = this;
|
|
2100
|
+
|
|
2101
|
+
var handleMounted = function handleMounted(e) {
|
|
2102
|
+
var object = e.target;
|
|
2103
|
+
var nodeName = object.nodeName,
|
|
2104
|
+
attributes = object.attributes;
|
|
2105
|
+
|
|
2106
|
+
if (nodeName === g.Shape.IMAGE) {
|
|
2107
|
+
var img = attributes.img;
|
|
2108
|
+
|
|
2109
|
+
if (g.isString(img)) {
|
|
2110
|
+
_this.imagePool.getImageSync(img, function () {
|
|
2111
|
+
// set dirty rectangle flag
|
|
2112
|
+
object.renderable.dirty = true;
|
|
2113
|
+
renderingService.dirtify();
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
};
|
|
2118
|
+
|
|
2119
|
+
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
2120
|
+
var object = e.target;
|
|
2121
|
+
var attrName = e.attrName,
|
|
2122
|
+
newValue = e.newValue;
|
|
2123
|
+
|
|
2124
|
+
if (object.nodeName === g.Shape.IMAGE) {
|
|
2125
|
+
if (attrName === 'img') {
|
|
2126
|
+
if (g.isString(newValue)) {
|
|
2127
|
+
_this.imagePool.getOrCreateImage(newValue).then(function () {
|
|
2128
|
+
// set dirty rectangle flag
|
|
2129
|
+
object.renderable.dirty = true;
|
|
2130
|
+
renderingService.dirtify();
|
|
2131
|
+
});
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
};
|
|
2136
|
+
|
|
2137
|
+
renderingService.hooks.init.tapPromise(LoadImagePlugin_1.tag, /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
2138
|
+
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
2139
|
+
while (1) {
|
|
2140
|
+
switch (_context.prev = _context.next) {
|
|
2141
|
+
case 0:
|
|
2142
|
+
_this.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED, handleMounted);
|
|
2143
|
+
|
|
2144
|
+
_this.renderingContext.root.addEventListener(g.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
2145
|
+
|
|
2146
|
+
case 2:
|
|
2147
|
+
case "end":
|
|
2148
|
+
return _context.stop();
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
}, _callee);
|
|
2152
|
+
})));
|
|
2153
|
+
renderingService.hooks.destroy.tap(LoadImagePlugin_1.tag, function () {
|
|
2154
|
+
_this.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED, handleMounted);
|
|
2155
|
+
|
|
2156
|
+
_this.renderingContext.root.removeEventListener(g.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
2157
|
+
});
|
|
2158
|
+
};
|
|
2159
|
+
|
|
2160
|
+
return LoadImagePlugin;
|
|
2161
|
+
}(), _class.tag = 'LoadImage', _class);
|
|
2162
|
+
|
|
2163
|
+
__decorate([g.inject(ImagePool), __metadata("design:type", ImagePool)], LoadImagePlugin.prototype, "imagePool", void 0);
|
|
2164
|
+
|
|
2165
|
+
__decorate([g.inject(g.RenderingContext), __metadata("design:type", Object)], LoadImagePlugin.prototype, "renderingContext", void 0);
|
|
2166
|
+
|
|
2167
|
+
LoadImagePlugin = LoadImagePlugin_1 = __decorate([g.singleton({
|
|
2168
|
+
contrib: g.RenderingPluginContribution
|
|
2169
|
+
})], LoadImagePlugin);
|
|
2170
|
+
var containerModule = g.Module(function (register) {
|
|
2171
|
+
register(ImagePool);
|
|
2172
|
+
register(LoadImagePlugin);
|
|
2173
|
+
});
|
|
2174
|
+
|
|
2175
|
+
var Plugin = /*#__PURE__*/function () {
|
|
2176
|
+
function Plugin() {
|
|
2177
|
+
this.name = 'image-loader';
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
var _proto = Plugin.prototype;
|
|
2181
|
+
|
|
2182
|
+
_proto.init = function init(container) {
|
|
2183
|
+
container.load(containerModule, true);
|
|
2184
|
+
};
|
|
2185
|
+
|
|
2186
|
+
_proto.destroy = function destroy(container) {
|
|
2187
|
+
container.unload(containerModule);
|
|
2188
|
+
};
|
|
2189
|
+
|
|
2190
|
+
return Plugin;
|
|
2191
|
+
}();
|
|
2192
|
+
|
|
1538
2193
|
var earcut_1 = earcut;
|
|
1539
2194
|
var _default = earcut;
|
|
1540
2195
|
|
|
@@ -2436,9 +3091,9 @@
|
|
|
2436
3091
|
|
|
2437
3092
|
LightPool = __decorate([g.singleton()], LightPool);
|
|
2438
3093
|
|
|
2439
|
-
function _regeneratorRuntime$
|
|
3094
|
+
function _regeneratorRuntime$2() {
|
|
2440
3095
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
2441
|
-
_regeneratorRuntime$
|
|
3096
|
+
_regeneratorRuntime$2 = function _regeneratorRuntime() {
|
|
2442
3097
|
return exports;
|
|
2443
3098
|
};
|
|
2444
3099
|
|
|
@@ -2786,7 +3441,7 @@
|
|
|
2786
3441
|
}, exports;
|
|
2787
3442
|
}
|
|
2788
3443
|
|
|
2789
|
-
function asyncGeneratorStep$
|
|
3444
|
+
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2790
3445
|
try {
|
|
2791
3446
|
var info = gen[key](arg);
|
|
2792
3447
|
var value = info.value;
|
|
@@ -2802,7 +3457,7 @@
|
|
|
2802
3457
|
}
|
|
2803
3458
|
}
|
|
2804
3459
|
|
|
2805
|
-
function _asyncToGenerator$
|
|
3460
|
+
function _asyncToGenerator$2(fn) {
|
|
2806
3461
|
return function () {
|
|
2807
3462
|
var self = this,
|
|
2808
3463
|
args = arguments;
|
|
@@ -2810,11 +3465,11 @@
|
|
|
2810
3465
|
var gen = fn.apply(self, args);
|
|
2811
3466
|
|
|
2812
3467
|
function _next(value) {
|
|
2813
|
-
asyncGeneratorStep$
|
|
3468
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
2814
3469
|
}
|
|
2815
3470
|
|
|
2816
3471
|
function _throw(err) {
|
|
2817
|
-
asyncGeneratorStep$
|
|
3472
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2818
3473
|
}
|
|
2819
3474
|
|
|
2820
3475
|
_next(undefined);
|
|
@@ -6492,10 +7147,10 @@
|
|
|
6492
7147
|
return acc;
|
|
6493
7148
|
};
|
|
6494
7149
|
|
|
6495
|
-
_proto.values = /*#__PURE__*/_regeneratorRuntime$
|
|
7150
|
+
_proto.values = /*#__PURE__*/_regeneratorRuntime$2().mark(function values() {
|
|
6496
7151
|
var _iterator2, _step2, bucket, j;
|
|
6497
7152
|
|
|
6498
|
-
return _regeneratorRuntime$
|
|
7153
|
+
return _regeneratorRuntime$2().wrap(function values$(_context) {
|
|
6499
7154
|
while (1) {
|
|
6500
7155
|
switch (_context.prev = _context.next) {
|
|
6501
7156
|
case 0:
|
|
@@ -8760,23 +9415,25 @@
|
|
|
8760
9415
|
|
|
8761
9416
|
var TexturePool = /*#__PURE__*/function () {
|
|
8762
9417
|
function TexturePool() {
|
|
9418
|
+
this.imagePool = void 0;
|
|
8763
9419
|
this.offscreenCanvas = void 0;
|
|
8764
9420
|
this.renderingService = void 0;
|
|
8765
9421
|
this.canvasConfig = void 0;
|
|
8766
9422
|
this.textureCache = {};
|
|
8767
|
-
this.gradientCache = {};
|
|
8768
9423
|
}
|
|
8769
9424
|
|
|
8770
9425
|
var _proto = TexturePool.prototype;
|
|
8771
9426
|
|
|
8772
9427
|
_proto.getOrCreateTexture = function getOrCreateTexture(device, src, descriptor, successCallback) {
|
|
8773
|
-
var _this = this; //
|
|
9428
|
+
var _this = this; // use Image URL or src as cache key
|
|
9429
|
+
// @ts-ignore
|
|
8774
9430
|
|
|
8775
9431
|
|
|
8776
9432
|
var id = typeof src === 'string' ? src : src.src || '';
|
|
9433
|
+
var texture;
|
|
8777
9434
|
|
|
8778
|
-
if (!this.textureCache[id]) {
|
|
8779
|
-
|
|
9435
|
+
if (!id || !this.textureCache[id]) {
|
|
9436
|
+
texture = device.createTexture(_extends({
|
|
8780
9437
|
pixelFormat: Format.U8_RGBA_NORM,
|
|
8781
9438
|
width: 1,
|
|
8782
9439
|
height: 1,
|
|
@@ -8790,9 +9447,13 @@
|
|
|
8790
9447
|
immutable: false
|
|
8791
9448
|
}, descriptor));
|
|
8792
9449
|
|
|
8793
|
-
if (
|
|
8794
|
-
this.textureCache[id]
|
|
8795
|
-
|
|
9450
|
+
if (id) {
|
|
9451
|
+
this.textureCache[id] = texture;
|
|
9452
|
+
}
|
|
9453
|
+
|
|
9454
|
+
if (!g.isString(src)) {
|
|
9455
|
+
texture.setImageData(src);
|
|
9456
|
+
texture.emit(TextureEvent.LOADED);
|
|
8796
9457
|
this.renderingService.dirtify();
|
|
8797
9458
|
} else {
|
|
8798
9459
|
// @see https://github.com/antvis/g/issues/938
|
|
@@ -8825,10 +9486,11 @@
|
|
|
8825
9486
|
}
|
|
8826
9487
|
}
|
|
8827
9488
|
} else {
|
|
8828
|
-
this.textureCache[id]
|
|
9489
|
+
texture = this.textureCache[id];
|
|
9490
|
+
texture.emit(TextureEvent.LOADED);
|
|
8829
9491
|
}
|
|
8830
9492
|
|
|
8831
|
-
return
|
|
9493
|
+
return texture;
|
|
8832
9494
|
};
|
|
8833
9495
|
|
|
8834
9496
|
_proto.getOrCreateCanvas = function getOrCreateCanvas() {
|
|
@@ -8836,66 +9498,60 @@
|
|
|
8836
9498
|
};
|
|
8837
9499
|
|
|
8838
9500
|
_proto.getOrCreateGradient = function getOrCreateGradient(params) {
|
|
8839
|
-
var
|
|
8840
|
-
var type = params.type,
|
|
8841
|
-
x0 = params.x0,
|
|
8842
|
-
y0 = params.y0,
|
|
8843
|
-
x1 = params.x1,
|
|
8844
|
-
y1 = params.y1,
|
|
8845
|
-
steps = params.steps,
|
|
8846
|
-
width = params.width,
|
|
8847
|
-
height = params.height;
|
|
8848
|
-
var gradient = this.gradientCache[key];
|
|
8849
|
-
var canvas = this.offscreenCanvas.getOrCreateCanvas(this.canvasConfig.offscreenCanvas);
|
|
8850
|
-
var context = this.offscreenCanvas.getOrCreateContext(this.canvasConfig.offscreenCanvas);
|
|
9501
|
+
var _this2 = this;
|
|
8851
9502
|
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
canvas.height = height; // needs only 1px height
|
|
9503
|
+
var instance = params.instance,
|
|
9504
|
+
gradients = params.gradients;
|
|
8855
9505
|
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
gradient = context.createLinearGradient(x0 * width, y0 * height, x1 * width, y1 * height);
|
|
8859
|
-
} else if (type === g.GradientPatternType.RadialGradient) {
|
|
8860
|
-
var r = Math.sqrt(width * width + height * height) / 2; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createRadialGradient
|
|
9506
|
+
var _instance$getGeometry = instance.getGeometryBounds(),
|
|
9507
|
+
halfExtents = _instance$getGeometry.halfExtents;
|
|
8861
9508
|
|
|
8862
|
-
|
|
8863
|
-
|
|
9509
|
+
var width = halfExtents[0] * 2 || 1;
|
|
9510
|
+
var height = halfExtents[1] * 2 || 1;
|
|
9511
|
+
var canvas = this.offscreenCanvas.getOrCreateCanvas(this.canvasConfig.offscreenCanvas);
|
|
9512
|
+
var context = this.offscreenCanvas.getOrCreateContext(this.canvasConfig.offscreenCanvas);
|
|
9513
|
+
canvas.width = width;
|
|
9514
|
+
canvas.height = height;
|
|
9515
|
+
gradients.forEach(function (g) {
|
|
9516
|
+
var gradient = _this2.imagePool.getOrCreateGradient(_extends({
|
|
9517
|
+
type: g.type
|
|
9518
|
+
}, g.value, {
|
|
9519
|
+
width: width,
|
|
9520
|
+
height: height
|
|
9521
|
+
}), context); // used as canvas' ID
|
|
9522
|
+
// @ts-ignore
|
|
9523
|
+
// canvas.src = key;
|
|
8864
9524
|
|
|
8865
|
-
steps.forEach(function (_ref) {
|
|
8866
|
-
var _gradient;
|
|
8867
9525
|
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
this.gradientCache[key] = gradient;
|
|
8873
|
-
} // used as canvas' ID
|
|
8874
|
-
// @ts-ignore
|
|
9526
|
+
context.fillStyle = gradient;
|
|
9527
|
+
context.fillRect(0, 0, width, height);
|
|
9528
|
+
});
|
|
9529
|
+
};
|
|
8875
9530
|
|
|
9531
|
+
_proto.getOrCreatePattern = function getOrCreatePattern(pattern, instance, callback) {
|
|
9532
|
+
var image = pattern.image,
|
|
9533
|
+
repetition = pattern.repetition;
|
|
8876
9534
|
|
|
8877
|
-
|
|
9535
|
+
var _instance$getGeometry2 = instance.getGeometryBounds(),
|
|
9536
|
+
halfExtents = _instance$getGeometry2.halfExtents;
|
|
8878
9537
|
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
9538
|
+
var width = halfExtents[0] * 2 || 1;
|
|
9539
|
+
var height = halfExtents[1] * 2 || 1;
|
|
9540
|
+
var canvas = this.offscreenCanvas.getOrCreateCanvas(this.canvasConfig.offscreenCanvas);
|
|
9541
|
+
var context = this.offscreenCanvas.getOrCreateContext(this.canvasConfig.offscreenCanvas);
|
|
9542
|
+
canvas.width = width;
|
|
9543
|
+
canvas.height = height;
|
|
9544
|
+
var src; // Image URL
|
|
9545
|
+
|
|
9546
|
+
if (g.isString(image)) {
|
|
9547
|
+
src = this.imagePool.getImageSync(image, callback);
|
|
9548
|
+
} else {
|
|
9549
|
+
src = image;
|
|
8882
9550
|
}
|
|
8883
|
-
};
|
|
8884
9551
|
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
x0 = params.x0,
|
|
8889
|
-
y0 = params.y0,
|
|
8890
|
-
x1 = params.x1,
|
|
8891
|
-
y1 = params.y1,
|
|
8892
|
-
r1 = params.r1,
|
|
8893
|
-
steps = params.steps,
|
|
8894
|
-
width = params.width,
|
|
8895
|
-
height = params.height;
|
|
8896
|
-
return "gradient-" + type + "-" + x0 + "-" + y0 + "-" + x1 + "-" + y1 + "-" + (r1 || 0) + "-" + width + "-" + height + "-" + steps.map(function (step) {
|
|
8897
|
-
return step.join('');
|
|
8898
|
-
}).join('-');
|
|
9552
|
+
var canvasPattern = src && context.createPattern(src, repetition);
|
|
9553
|
+
context.fillStyle = canvasPattern;
|
|
9554
|
+
context.fillRect(0, 0, width, height);
|
|
8899
9555
|
};
|
|
8900
9556
|
|
|
8901
9557
|
_proto.destroy = function destroy() {
|
|
@@ -8904,12 +9560,13 @@
|
|
|
8904
9560
|
}
|
|
8905
9561
|
|
|
8906
9562
|
this.textureCache = {};
|
|
8907
|
-
this.gradientCache = {};
|
|
8908
9563
|
};
|
|
8909
9564
|
|
|
8910
9565
|
return TexturePool;
|
|
8911
9566
|
}();
|
|
8912
9567
|
|
|
9568
|
+
__decorate([g.inject(ImagePool), __metadata("design:type", ImagePool)], TexturePool.prototype, "imagePool", void 0);
|
|
9569
|
+
|
|
8913
9570
|
__decorate([g.inject(g.OffscreenCanvasCreator), __metadata("design:type", g.OffscreenCanvasCreator)], TexturePool.prototype, "offscreenCanvas", void 0);
|
|
8914
9571
|
|
|
8915
9572
|
__decorate([g.inject(g.RenderingService), __metadata("design:type", g.RenderingService)], TexturePool.prototype, "renderingService", void 0);
|
|
@@ -10094,47 +10751,58 @@
|
|
|
10094
10751
|
};
|
|
10095
10752
|
|
|
10096
10753
|
_proto.createFillGradientTextureMapping = function createFillGradientTextureMapping(objects) {
|
|
10097
|
-
var
|
|
10098
|
-
var fill = instance.nodeName === g.Shape.LINE ? instance.parsedStyle.stroke : instance.parsedStyle.fill; // use pattern & gradient
|
|
10754
|
+
var _this6 = this;
|
|
10099
10755
|
|
|
10100
|
-
|
|
10101
|
-
|
|
10756
|
+
var instance = objects[0];
|
|
10757
|
+
var fill = instance.nodeName === g.Shape.LINE ? instance.parsedStyle.stroke : instance.parsedStyle.fill;
|
|
10758
|
+
var texImageSource; // use pattern & gradient
|
|
10102
10759
|
|
|
10103
|
-
|
|
10760
|
+
if (fill && (g.isPattern(fill) || Array.isArray(fill))) {
|
|
10761
|
+
if (Array.isArray(fill)) {
|
|
10104
10762
|
this.program.setDefineBool('USE_PATTERN', false);
|
|
10105
|
-
this.texturePool.getOrCreateGradient(
|
|
10106
|
-
|
|
10107
|
-
}, fill.value, {
|
|
10763
|
+
this.texturePool.getOrCreateGradient({
|
|
10764
|
+
gradients: fill,
|
|
10108
10765
|
width: 128,
|
|
10109
|
-
height: 128
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
} else {
|
|
10113
|
-
this.program.setDefineBool('USE_PATTERN', true);
|
|
10114
|
-
|
|
10115
|
-
|
|
10766
|
+
height: 128,
|
|
10767
|
+
instance: instance
|
|
10768
|
+
});
|
|
10769
|
+
} else if (g.isPattern(fill)) {
|
|
10770
|
+
this.program.setDefineBool('USE_PATTERN', true);
|
|
10771
|
+
this.texturePool.getOrCreatePattern(fill, instance, function () {
|
|
10772
|
+
// need re-render
|
|
10773
|
+
objects.forEach(function (object) {
|
|
10774
|
+
object.renderable.dirty = true;
|
|
10775
|
+
});
|
|
10776
|
+
_this6.material.textureDirty = true;
|
|
10777
|
+
});
|
|
10116
10778
|
}
|
|
10117
10779
|
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10780
|
+
texImageSource = this.texturePool.getOrCreateCanvas();
|
|
10781
|
+
var texture = this.texturePool.getOrCreateTexture(this.device, texImageSource, makeTextureDescriptor2D(Format.U8_RGBA_NORM, 1, 1, 1));
|
|
10782
|
+
|
|
10783
|
+
if (texture) {
|
|
10784
|
+
var fillMapping = new TextureMapping();
|
|
10785
|
+
fillMapping.name = FILL_TEXTURE_MAPPING;
|
|
10786
|
+
fillMapping.texture = texture;
|
|
10787
|
+
fillMapping.texture.on('loaded', function () {
|
|
10788
|
+
// need re-render
|
|
10789
|
+
objects.forEach(function (object) {
|
|
10790
|
+
object.renderable.dirty = true;
|
|
10791
|
+
});
|
|
10792
|
+
_this6.material.textureDirty = true;
|
|
10125
10793
|
});
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10794
|
+
this.device.setResourceName(fillMapping.texture, 'Fill Texture' + this.id);
|
|
10795
|
+
fillMapping.sampler = this.renderHelper.getCache().createSampler({
|
|
10796
|
+
wrapS: WrapMode.Repeat,
|
|
10797
|
+
wrapT: WrapMode.Repeat,
|
|
10798
|
+
minFilter: TexFilterMode.Point,
|
|
10799
|
+
magFilter: TexFilterMode.Bilinear,
|
|
10800
|
+
mipFilter: MipFilterMode.Linear,
|
|
10801
|
+
minLOD: 0,
|
|
10802
|
+
maxLOD: 0
|
|
10803
|
+
});
|
|
10804
|
+
return fillMapping;
|
|
10805
|
+
}
|
|
10138
10806
|
}
|
|
10139
10807
|
|
|
10140
10808
|
return null;
|
|
@@ -10951,9 +11619,9 @@
|
|
|
10951
11619
|
return piMod(Math.atan2(dy, dx));
|
|
10952
11620
|
}
|
|
10953
11621
|
};
|
|
10954
|
-
var frag$2 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4
|
|
11622
|
+
var frag$2 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nin vec4 v_Distance;\nin vec4 v_Arc;\nin float v_Type;\nin float v_Travel;\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n float alpha = 1.0;\n float lineWidth = v_Distance.w;\n if (v_Type < 0.5) {\n float left = max(v_Distance.x - 0.5, -v_Distance.w);\n float right = min(v_Distance.x + 0.5, v_Distance.w);\n float near = v_Distance.y - 0.5;\n float far = min(v_Distance.y + 0.5, 0.0);\n float top = v_Distance.z - 0.5;\n float bottom = min(v_Distance.z + 0.5, 0.0);\n alpha = max(right - left, 0.0) * max(bottom - top, 0.0) * max(far - near, 0.0);\n } else if (v_Type < 1.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n } else if (v_Type < 2.5) {\n alpha *= max(min(v_Distance.x + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.y + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n } else if (v_Type < 3.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n float alpha_miter = a2 * b2 - a1 * b1;\n float alpha_plane = max(min(v_Distance.z + 0.5, 1.0), 0.0);\n float d = length(v_Arc.xy);\n float circle_hor = max(min(v_Arc.w, d + 0.5) - max(-v_Arc.w, d - 0.5), 0.0);\n float circle_vert = min(v_Arc.w * 2.0, 1.0);\n float alpha_circle = circle_hor * circle_vert;\n alpha = min(alpha_miter, max(alpha_circle, alpha_plane));\n } else {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n }\n\n if (u_Dash + u_Gap > 1.0) {\n float travel = mod(v_Travel + u_Gap * 0.5 + u_DashOffset, u_Dash + u_Gap) - (u_Gap * 0.5);\n float left = max(travel - 0.5, -0.5);\n float right = min(travel + 0.5, u_Gap + 0.5);\n alpha *= max(0.0, right - left);\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n outputColor.a *= alpha * u_Opacity * u_StrokeOpacity;\n }\n}"; // eslint-disable-line
|
|
10955
11623
|
|
|
10956
|
-
var vert$2 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_Color;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nlayout(location = PREV) in vec2 a_Prev;\nlayout(location = POINT1) in vec2 a_Point1;\nlayout(location = POINT2) in vec2 a_Point2;\nlayout(location = NEXT) in vec2 a_Next;\nlayout(location = VERTEX_JOINT) in float a_VertexJoint;\nlayout(location = VERTEX_NUM) in float a_VertexNum;\nlayout(location = TRAVEL) in float a_Travel;\n\nconst float FILL = 1.0;\nconst float BEVEL = 4.0;\nconst float MITER = 8.0;\nconst float ROUND = 12.0;\nconst float JOINT_CAP_BUTT = 16.0;\nconst float JOINT_CAP_SQUARE = 18.0;\nconst float JOINT_CAP_ROUND = 20.0;\nconst float FILL_EXPAND = 24.0;\nconst float CAP_BUTT = 1.0;\nconst float CAP_SQUARE = 2.0;\nconst float CAP_ROUND = 3.0;\nconst float CAP_BUTT2 = 4.0;\n\nout vec4 v_Distance;\nout vec4 v_Arc;\nout float v_Type;\nout float v_Travel;\n\nvec2 doBisect(\n vec2 norm, float len, vec2 norm2, float len2, float dy, float inner\n) {\n vec2 bisect = (norm + norm2) / 2.0;\n bisect /= dot(norm, bisect);\n vec2 shift = dy * bisect;\n if (inner > 0.5) {\n if (len < len2) {\n if (abs(dy * (bisect.x * norm.y - bisect.y * norm.x)) > len) {\n return dy * norm;\n }\n } else {\n if (abs(dy * (bisect.x * norm2.y - bisect.y * norm2.x)) > len2) {\n return dy * norm;\n }\n }\n }\n return dy * bisect;\n}\n\nvoid main() {\n vec2 pointA = (u_ModelMatrix * vec4(a_Point1, 0., 1.0)).xy;\n vec2 pointB = (u_ModelMatrix * vec4(a_Point2, 0., 1.0)).xy;\n\n vec2 xBasis = pointB - pointA;\n float len = length(xBasis);\n vec2 forward = xBasis / len;\n vec2 norm = vec2(forward.y, -forward.x);\n\n float type = a_VertexJoint;\n\n float lineWidth;\n if (u_IsPicking > 0.5) {\n lineWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n lineWidth = u_StrokeWidth;\n }\n\n if (u_ScaleMode > 2.5) {\n lineWidth *= length(u_ModelMatrix * vec4(1.0, 0.0, 0.0, 0.0));\n } else if (u_ScaleMode > 1.5) {\n lineWidth *= length(u_ModelMatrix * vec4(0.0, 1.0, 0.0, 0.0));\n } else if (u_ScaleMode > 0.5) {\n vec2 avgDiag = (u_ModelMatrix * vec4(1.0, 1.0, 0.0, 0.0)).xy;\n lineWidth *= sqrt(dot(avgDiag, avgDiag) * 0.5);\n }\n float capType = floor(type / 32.0);\n type -= capType * 32.0;\n v_Arc = vec4(0.0);\n lineWidth *= 0.5;\n float lineAlignment = 2.0 * u_Alignment - 1.0;\n\n vec2 pos;\n\n if (capType == CAP_ROUND) {\n if (a_VertexNum < 3.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n type = JOINT_CAP_ROUND;\n capType = 0.0;\n }\n\n if (type >= BEVEL) {\n float dy = lineWidth + u_Expand;\n float inner = 0.0;\n if (a_VertexNum >= 1.5) {\n dy = -dy;\n inner = 1.0;\n }\n\n vec2 base, next, xBasis2, bisect;\n float flag = 0.0;\n float sign2 = 1.0;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5 && a_VertexNum < 3.5) {\n next = (u_ModelMatrix * vec4(a_Prev, 0.0, 1.0)).xy;\n base = pointA;\n flag = type - floor(type / 2.0) * 2.0;\n sign2 = -1.0;\n\n } else {\n next = (u_ModelMatrix * vec4(a_Next, 0.0, 1.0)).xy;\n base = pointB;\n if (type >= MITER && type < MITER + 3.5) {\n flag = step(MITER + 1.5, type);\n // check miter limit here?\n }\n }\n xBasis2 = next - base;\n float len2 = length(xBasis2);\n vec2 norm2 = vec2(xBasis2.y, -xBasis2.x) / len2;\n float D = norm.x * norm2.y - norm.y * norm2.x;\n if (D < 0.0) {\n inner = 1.0 - inner;\n }\n norm2 *= sign2;\n\n if (abs(lineAlignment) > 0.01) {\n float shift = lineWidth * lineAlignment;\n pointA += norm * shift;\n pointB += norm * shift;\n if (abs(D) < 0.01) {\n base += norm * shift;\n } else {\n base += doBisect(norm, len, norm2, len2, shift, 0.0);\n }\n }\n\n float collinear = step(0.0, dot(norm, norm2));\n v_Type = 0.0;\n float dy2 = -1000.0;\n float dy3 = -1000.0;\n if (abs(D) < 0.01 && collinear < 0.5) {\n if (type >= ROUND && type < ROUND + 1.5) {\n type = JOINT_CAP_ROUND;\n }\n //TODO: BUTT here too\n }\n\n if (a_VertexNum < 3.5) {\n if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (flag < 0.5 && inner < 0.5) {\n pos = dy * norm;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, inner);\n }\n }\n if (capType >= CAP_BUTT && capType < CAP_ROUND) {\n float extra = step(CAP_SQUARE, capType) * lineWidth;\n vec2 back = -forward;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n pos += back * (u_Expand + extra);\n dy2 = u_Expand;\n } else {\n dy2 = dot(pos + base - pointA, back) - extra;\n }\n }\n if (type >= JOINT_CAP_BUTT && type < JOINT_CAP_SQUARE + 0.5) {\n float extra = step(JOINT_CAP_SQUARE, type) * lineWidth;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n dy3 = dot(pos + base - pointB, forward) - extra;\n } else {\n pos += forward * (u_Expand + extra);\n dy3 = u_Expand;\n if (capType >= CAP_BUTT) {\n dy2 -= u_Expand + extra;\n }\n }\n }\n } else if (type >= JOINT_CAP_ROUND && type < JOINT_CAP_ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n vec2 d2 = abs(dy) * forward;\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = dy * norm;\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum < 6.5) {\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n } else {\n dy = -dy;\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n }\n dy2 = 0.0;\n v_Arc.y = dy;\n v_Arc.z = 0.0;\n v_Arc.w = lineWidth;\n v_Type = 3.0;\n } else if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (type >= ROUND && type < ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n float d2 = abs(dy);\n if (length(pos) > abs(dy) * 1.5) {\n if (a_VertexNum < 6.5) {\n pos.x = dy * norm.x - d2 * norm.y;\n pos.y = dy * norm.y + d2 * norm.x;\n } else {\n pos.x = dy * norm2.x + d2 * norm2.y;\n pos.y = dy * norm2.y - d2 * norm2.x;\n }\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n v_Arc.x = sign * dot(pos, norm3);\n v_Arc.y = pos.x * norm3.y - pos.y * norm3.x;\n v_Arc.z = dot(norm, norm3) * lineWidth;\n v_Arc.w = lineWidth;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = v_Arc.z - v_Arc.x;\n v_Type = 3.0;\n } else {\n float hit = 0.0;\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (dot(norm, norm2) > 0.0) {\n type = MITER;\n }\n }\n if (type >= MITER && type < MITER + 3.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float sign = step(0.0, dy) * 2.0 - 1.0;\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n if (length(pos) > abs(dy) * u_MiterLimit) {\n type = BEVEL;\n } else {\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = doBisect(norm, len, norm2, len2, dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 6.5) {\n pos = dy * norm2;\n }\n v_Type = 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n hit = 1.0;\n }\n }\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float d2 = abs(dy);\n vec2 pos3 = vec2(dy * norm.x - d2 * norm.y, dy * norm.y + d2 * norm.x);\n vec2 pos4 = vec2(dy * norm2.x + d2 * norm2.y, dy * norm2.y - d2 * norm2.x);\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n if (a_VertexNum < 6.5) {\n pos = pos3;\n } else {\n pos = pos4;\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = (-sign * dot(pos, norm3)) + lineWidth;\n v_Type = 4.0;\n hit = 1.0;\n }\n if (hit < 0.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n }\n }\n pos += base;\n v_Distance = vec4(dy, dy2, dy3, lineWidth) * u_DevicePixelRatio;\n v_Arc = v_Arc * u_DevicePixelRatio;\n v_Travel = a_Travel + dot(pos - pointA, vec2(-norm.y, norm.x));\n }\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * vec4(pos, u_ZIndex, 1.0);\n}"; // eslint-disable-line
|
|
11624
|
+
var vert$2 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nlayout(location = PREV) in vec2 a_Prev;\nlayout(location = POINT1) in vec2 a_Point1;\nlayout(location = POINT2) in vec2 a_Point2;\nlayout(location = NEXT) in vec2 a_Next;\nlayout(location = VERTEX_JOINT) in float a_VertexJoint;\nlayout(location = VERTEX_NUM) in float a_VertexNum;\nlayout(location = TRAVEL) in float a_Travel;\n\nconst float FILL = 1.0;\nconst float BEVEL = 4.0;\nconst float MITER = 8.0;\nconst float ROUND = 12.0;\nconst float JOINT_CAP_BUTT = 16.0;\nconst float JOINT_CAP_SQUARE = 18.0;\nconst float JOINT_CAP_ROUND = 20.0;\nconst float FILL_EXPAND = 24.0;\nconst float CAP_BUTT = 1.0;\nconst float CAP_SQUARE = 2.0;\nconst float CAP_ROUND = 3.0;\nconst float CAP_BUTT2 = 4.0;\n\nout vec4 v_Distance;\nout vec4 v_Arc;\nout float v_Type;\nout float v_Travel;\n\nvec2 doBisect(\n vec2 norm, float len, vec2 norm2, float len2, float dy, float inner\n) {\n vec2 bisect = (norm + norm2) / 2.0;\n bisect /= dot(norm, bisect);\n vec2 shift = dy * bisect;\n if (inner > 0.5) {\n if (len < len2) {\n if (abs(dy * (bisect.x * norm.y - bisect.y * norm.x)) > len) {\n return dy * norm;\n }\n } else {\n if (abs(dy * (bisect.x * norm2.y - bisect.y * norm2.x)) > len2) {\n return dy * norm;\n }\n }\n }\n return dy * bisect;\n}\n\nvoid main() {\n vec2 pointA = (u_ModelMatrix * vec4(a_Point1, 0., 1.0)).xy;\n vec2 pointB = (u_ModelMatrix * vec4(a_Point2, 0., 1.0)).xy;\n\n vec2 xBasis = pointB - pointA;\n float len = length(xBasis);\n vec2 forward = xBasis / len;\n vec2 norm = vec2(forward.y, -forward.x);\n\n float type = a_VertexJoint;\n\n float lineWidth;\n if (u_IsPicking > 0.5) {\n lineWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n lineWidth = u_StrokeWidth;\n }\n\n if (u_ScaleMode > 2.5) {\n lineWidth *= length(u_ModelMatrix * vec4(1.0, 0.0, 0.0, 0.0));\n } else if (u_ScaleMode > 1.5) {\n lineWidth *= length(u_ModelMatrix * vec4(0.0, 1.0, 0.0, 0.0));\n } else if (u_ScaleMode > 0.5) {\n vec2 avgDiag = (u_ModelMatrix * vec4(1.0, 1.0, 0.0, 0.0)).xy;\n lineWidth *= sqrt(dot(avgDiag, avgDiag) * 0.5);\n }\n float capType = floor(type / 32.0);\n type -= capType * 32.0;\n v_Arc = vec4(0.0);\n lineWidth *= 0.5;\n float lineAlignment = 2.0 * u_Alignment - 1.0;\n\n vec2 pos;\n\n if (capType == CAP_ROUND) {\n if (a_VertexNum < 3.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n type = JOINT_CAP_ROUND;\n capType = 0.0;\n }\n\n if (type >= BEVEL) {\n float dy = lineWidth + u_Expand;\n float inner = 0.0;\n if (a_VertexNum >= 1.5) {\n dy = -dy;\n inner = 1.0;\n }\n\n vec2 base, next, xBasis2, bisect;\n float flag = 0.0;\n float sign2 = 1.0;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5 && a_VertexNum < 3.5) {\n next = (u_ModelMatrix * vec4(a_Prev, 0.0, 1.0)).xy;\n base = pointA;\n flag = type - floor(type / 2.0) * 2.0;\n sign2 = -1.0;\n\n } else {\n next = (u_ModelMatrix * vec4(a_Next, 0.0, 1.0)).xy;\n base = pointB;\n if (type >= MITER && type < MITER + 3.5) {\n flag = step(MITER + 1.5, type);\n // check miter limit here?\n }\n }\n xBasis2 = next - base;\n float len2 = length(xBasis2);\n vec2 norm2 = vec2(xBasis2.y, -xBasis2.x) / len2;\n float D = norm.x * norm2.y - norm.y * norm2.x;\n if (D < 0.0) {\n inner = 1.0 - inner;\n }\n norm2 *= sign2;\n\n if (abs(lineAlignment) > 0.01) {\n float shift = lineWidth * lineAlignment;\n pointA += norm * shift;\n pointB += norm * shift;\n if (abs(D) < 0.01) {\n base += norm * shift;\n } else {\n base += doBisect(norm, len, norm2, len2, shift, 0.0);\n }\n }\n\n float collinear = step(0.0, dot(norm, norm2));\n v_Type = 0.0;\n float dy2 = -1000.0;\n float dy3 = -1000.0;\n if (abs(D) < 0.01 && collinear < 0.5) {\n if (type >= ROUND && type < ROUND + 1.5) {\n type = JOINT_CAP_ROUND;\n }\n //TODO: BUTT here too\n }\n\n if (a_VertexNum < 3.5) {\n if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (flag < 0.5 && inner < 0.5) {\n pos = dy * norm;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, inner);\n }\n }\n if (capType >= CAP_BUTT && capType < CAP_ROUND) {\n float extra = step(CAP_SQUARE, capType) * lineWidth;\n vec2 back = -forward;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n pos += back * (u_Expand + extra);\n dy2 = u_Expand;\n } else {\n dy2 = dot(pos + base - pointA, back) - extra;\n }\n }\n if (type >= JOINT_CAP_BUTT && type < JOINT_CAP_SQUARE + 0.5) {\n float extra = step(JOINT_CAP_SQUARE, type) * lineWidth;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n dy3 = dot(pos + base - pointB, forward) - extra;\n } else {\n pos += forward * (u_Expand + extra);\n dy3 = u_Expand;\n if (capType >= CAP_BUTT) {\n dy2 -= u_Expand + extra;\n }\n }\n }\n } else if (type >= JOINT_CAP_ROUND && type < JOINT_CAP_ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n vec2 d2 = abs(dy) * forward;\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = dy * norm;\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum < 6.5) {\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n } else {\n dy = -dy;\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n }\n dy2 = 0.0;\n v_Arc.y = dy;\n v_Arc.z = 0.0;\n v_Arc.w = lineWidth;\n v_Type = 3.0;\n } else if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (type >= ROUND && type < ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n float d2 = abs(dy);\n if (length(pos) > abs(dy) * 1.5) {\n if (a_VertexNum < 6.5) {\n pos.x = dy * norm.x - d2 * norm.y;\n pos.y = dy * norm.y + d2 * norm.x;\n } else {\n pos.x = dy * norm2.x + d2 * norm2.y;\n pos.y = dy * norm2.y - d2 * norm2.x;\n }\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n v_Arc.x = sign * dot(pos, norm3);\n v_Arc.y = pos.x * norm3.y - pos.y * norm3.x;\n v_Arc.z = dot(norm, norm3) * lineWidth;\n v_Arc.w = lineWidth;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = v_Arc.z - v_Arc.x;\n v_Type = 3.0;\n } else {\n float hit = 0.0;\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (dot(norm, norm2) > 0.0) {\n type = MITER;\n }\n }\n if (type >= MITER && type < MITER + 3.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float sign = step(0.0, dy) * 2.0 - 1.0;\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n if (length(pos) > abs(dy) * u_MiterLimit) {\n type = BEVEL;\n } else {\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = doBisect(norm, len, norm2, len2, dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 6.5) {\n pos = dy * norm2;\n }\n v_Type = 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n hit = 1.0;\n }\n }\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float d2 = abs(dy);\n vec2 pos3 = vec2(dy * norm.x - d2 * norm.y, dy * norm.y + d2 * norm.x);\n vec2 pos4 = vec2(dy * norm2.x + d2 * norm2.y, dy * norm2.y - d2 * norm2.x);\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n if (a_VertexNum < 6.5) {\n pos = pos3;\n } else {\n pos = pos4;\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = (-sign * dot(pos, norm3)) + lineWidth;\n v_Type = 4.0;\n hit = 1.0;\n }\n if (hit < 0.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n }\n }\n pos += base;\n v_Distance = vec4(dy, dy2, dy3, lineWidth) * u_DevicePixelRatio;\n v_Arc = v_Arc * u_DevicePixelRatio;\n v_Travel = a_Travel + dot(pos - pointA, vec2(-norm.y, norm.x));\n }\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * vec4(pos, u_ZIndex, 1.0);\n}"; // eslint-disable-line
|
|
10957
11625
|
|
|
10958
11626
|
var JOINT_TYPE;
|
|
10959
11627
|
|
|
@@ -11000,7 +11668,7 @@
|
|
|
11000
11668
|
|
|
11001
11669
|
(function (Uniform) {
|
|
11002
11670
|
Uniform["MODEL_MATRIX"] = "u_ModelMatrix";
|
|
11003
|
-
Uniform["
|
|
11671
|
+
Uniform["FILL_COLOR"] = "u_FillColor";
|
|
11004
11672
|
Uniform["STROKE_COLOR"] = "u_StrokeColor";
|
|
11005
11673
|
Uniform["STROKE_WIDTH"] = "u_StrokeWidth";
|
|
11006
11674
|
Uniform["INCREASED_LINE_WIDTH_FOR_HIT_TESTING"] = "u_IncreasedLineWidthForHitTesting";
|
|
@@ -11179,7 +11847,7 @@
|
|
|
11179
11847
|
var m = create();
|
|
11180
11848
|
mul(m, instance.getWorldTransform(), // apply anchor
|
|
11181
11849
|
fromTranslation(m, fromValues$1(translateX, translateY, 0)));
|
|
11182
|
-
this.material.setUniforms((_this$material$setUni13 = {}, _this$material$setUni13[Uniform.MODEL_MATRIX] = m, _this$material$setUni13[Uniform.
|
|
11850
|
+
this.material.setUniforms((_this$material$setUni13 = {}, _this$material$setUni13[Uniform.MODEL_MATRIX] = m, _this$material$setUni13[Uniform.FILL_COLOR] = fillColor, _this$material$setUni13[Uniform.STROKE_COLOR] = strokeColor, _this$material$setUni13[Uniform.STROKE_WIDTH] = lineWidth.value, _this$material$setUni13[Uniform.INCREASED_LINE_WIDTH_FOR_HIT_TESTING] = increasedLineWidthForHitTesting.value, _this$material$setUni13[Uniform.OPACITY] = opacity.value, _this$material$setUni13[Uniform.FILL_OPACITY] = fillOpacity.value, _this$material$setUni13[Uniform.STROKE_OPACITY] = strokeOpacity.value, _this$material$setUni13[Uniform.EXPAND] = 1, _this$material$setUni13[Uniform.MITER_LIMIT] = 5, _this$material$setUni13[Uniform.SCALE_MODE] = 1, _this$material$setUni13[Uniform.ALIGNMENT] = 0.5, _this$material$setUni13[Uniform.PICKING_COLOR] = encodedPickingColor, _this$material$setUni13[Uniform.DASH] = lineDash && ((_lineDash$ = lineDash[0]) === null || _lineDash$ === void 0 ? void 0 : _lineDash$.value) || 0, _this$material$setUni13[Uniform.GAP] = lineDash && ((_lineDash$2 = lineDash[1]) === null || _lineDash$2 === void 0 ? void 0 : _lineDash$2.value) || 0, _this$material$setUni13[Uniform.DASH_OFFSET] = lineDashOffset && lineDashOffset.value || 0, _this$material$setUni13[Uniform.VISIBLE] = visibility.value === 'visible' ? 1 : 0, _this$material$setUni13[Uniform.Z_INDEX] = instance.sortable.renderOrder * RENDER_ORDER_SCALE, _this$material$setUni13));
|
|
11183
11851
|
this.material.cullMode = CullMode.None;
|
|
11184
11852
|
};
|
|
11185
11853
|
|
|
@@ -11352,7 +12020,21 @@
|
|
|
11352
12020
|
if (object.nodeName !== g.Shape.PATH) {
|
|
11353
12021
|
path = g.parsePath(g.convertToPath(object, false), object);
|
|
11354
12022
|
defX = path.rect.x;
|
|
11355
|
-
defY = path.rect.y;
|
|
12023
|
+
defY = path.rect.y; // support negative width/height of Rect
|
|
12024
|
+
|
|
12025
|
+
if (object.nodeName === g.Shape.RECT) {
|
|
12026
|
+
var _object$parsedStyle4 = object.parsedStyle,
|
|
12027
|
+
width = _object$parsedStyle4.width,
|
|
12028
|
+
height = _object$parsedStyle4.height;
|
|
12029
|
+
|
|
12030
|
+
if (width.value < 0) {
|
|
12031
|
+
defX += path.rect.width;
|
|
12032
|
+
}
|
|
12033
|
+
|
|
12034
|
+
if (height.value < 0) {
|
|
12035
|
+
defY += path.rect.height;
|
|
12036
|
+
}
|
|
12037
|
+
}
|
|
11356
12038
|
} else {
|
|
11357
12039
|
path = object.parsedStyle.path;
|
|
11358
12040
|
}
|
|
@@ -11519,9 +12201,9 @@
|
|
|
11519
12201
|
return [x1 + vec[0] * length, y1 + vec[1] * length];
|
|
11520
12202
|
}
|
|
11521
12203
|
|
|
11522
|
-
var meshFrag = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4
|
|
12204
|
+
var meshFrag = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec3 u_PickingColor;\n float u_Opacity;\n float u_FillOpacity;\n float u_Visible;\n float u_ZIndex;\n};\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n\n vec4 u_Color = u_FillColor;\n\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity * u_FillOpacity;\n }\n}"; // eslint-disable-line
|
|
11523
12205
|
|
|
11524
|
-
var meshVert = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4
|
|
12206
|
+
var meshVert = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec3 u_PickingColor;\n float u_Opacity;\n float u_FillOpacity;\n float u_Visible;\n float u_ZIndex;\n};\n\nlayout(location = POSITION) in vec2 a_Position;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nvoid main() {\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * u_ModelMatrix * vec4(a_Position, u_ZIndex, 1.0);\n}"; // eslint-disable-line
|
|
11525
12207
|
|
|
11526
12208
|
var FillMesh = /*#__PURE__*/function (_Instanced) {
|
|
11527
12209
|
_inheritsLoose$1(FillMesh, _Instanced);
|
|
@@ -11550,11 +12232,28 @@
|
|
|
11550
12232
|
attributes: [{
|
|
11551
12233
|
format: Format.F32_RG,
|
|
11552
12234
|
bufferByteOffset: 4 * 0,
|
|
11553
|
-
byteStride: 4 * 2,
|
|
11554
12235
|
location: VertexAttributeLocation.POSITION
|
|
11555
12236
|
}],
|
|
11556
12237
|
data: new Float32Array(pointsBuffer)
|
|
11557
12238
|
});
|
|
12239
|
+
|
|
12240
|
+
var _instance$getGeometry = instance.getGeometryBounds(),
|
|
12241
|
+
halfExtents = _instance$getGeometry.halfExtents;
|
|
12242
|
+
|
|
12243
|
+
var uvsBuffer = pointsBuffer.map(function (x, i) {
|
|
12244
|
+
return x / halfExtents[i % 2] / 2;
|
|
12245
|
+
});
|
|
12246
|
+
this.geometry.setVertexBuffer({
|
|
12247
|
+
bufferIndex: VertexAttributeBufferIndex.UV,
|
|
12248
|
+
byteStride: 4 * 2,
|
|
12249
|
+
frequency: VertexBufferFrequency.PerVertex,
|
|
12250
|
+
attributes: [{
|
|
12251
|
+
format: Format.F32_RG,
|
|
12252
|
+
bufferByteOffset: 4 * 0,
|
|
12253
|
+
location: VertexAttributeLocation.UV
|
|
12254
|
+
}],
|
|
12255
|
+
data: new Float32Array(uvsBuffer)
|
|
12256
|
+
});
|
|
11558
12257
|
this.geometry.vertexCount = triangles.length;
|
|
11559
12258
|
this.geometry.setIndexBuffer(new Uint32Array(triangles));
|
|
11560
12259
|
};
|
|
@@ -11592,7 +12291,7 @@
|
|
|
11592
12291
|
var m = create();
|
|
11593
12292
|
mul(m, instance.getWorldTransform(), // apply anchor
|
|
11594
12293
|
fromTranslation(m, fromValues$1(translateX, translateY, 0)));
|
|
11595
|
-
this.material.setUniforms((_this$material$setUni = {}, _this$material$setUni[Uniform.MODEL_MATRIX] = m, _this$material$setUni[Uniform.
|
|
12294
|
+
this.material.setUniforms((_this$material$setUni = {}, _this$material$setUni[Uniform.MODEL_MATRIX] = m, _this$material$setUni[Uniform.FILL_COLOR] = fillColor, _this$material$setUni[Uniform.PICKING_COLOR] = encodedPickingColor, _this$material$setUni[Uniform.OPACITY] = opacity.value, _this$material$setUni[Uniform.FILL_OPACITY] = fillOpacity.value, _this$material$setUni[Uniform.VISIBLE] = visibility.value === 'visible' ? 1 : 0, _this$material$setUni[Uniform.Z_INDEX] = instance.sortable.renderOrder * RENDER_ORDER_SCALE, _this$material$setUni));
|
|
11596
12295
|
};
|
|
11597
12296
|
|
|
11598
12297
|
_proto.updateAttribute = function updateAttribute(objects, startIndex, name, value) {
|
|
@@ -11613,15 +12312,25 @@
|
|
|
11613
12312
|
_this.material.geometryDirty = true;
|
|
11614
12313
|
_this.material.programDirty = true;
|
|
11615
12314
|
} else if (name === 'fill') {
|
|
11616
|
-
|
|
12315
|
+
if (fill instanceof g.CSSRGB) {
|
|
12316
|
+
var _this$material$setUni2;
|
|
11617
12317
|
|
|
11618
|
-
|
|
12318
|
+
var fillColor = [Number(fill.r) / 255, Number(fill.g) / 255, Number(fill.b) / 255, Number(fill.alpha)];
|
|
11619
12319
|
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
12320
|
+
_this.material.setUniforms((_this$material$setUni2 = {}, _this$material$setUni2[Uniform.FILL_COLOR] = fillColor, _this$material$setUni2));
|
|
12321
|
+
} else {
|
|
12322
|
+
var i = _this.textureMappings.findIndex(function (m) {
|
|
12323
|
+
return m.name === FILL_TEXTURE_MAPPING;
|
|
12324
|
+
});
|
|
12325
|
+
|
|
12326
|
+
var fillTextureMapping = _this.createFillGradientTextureMapping([_this.instance]);
|
|
12327
|
+
|
|
12328
|
+
if (i >= 0) {
|
|
12329
|
+
_this.textureMappings.splice(i, 1, fillTextureMapping);
|
|
12330
|
+
}
|
|
11623
12331
|
|
|
11624
|
-
|
|
12332
|
+
_this.material.textureDirty = true;
|
|
12333
|
+
}
|
|
11625
12334
|
} else if (name === 'opacity') {
|
|
11626
12335
|
var _this$material$setUni3;
|
|
11627
12336
|
|
|
@@ -12871,10 +13580,16 @@
|
|
|
12871
13580
|
_proto.shouldSubmitRenderInst = function shouldSubmitRenderInst(object, index) {
|
|
12872
13581
|
var _object$parsedStyle = object.parsedStyle,
|
|
12873
13582
|
fill = _object$parsedStyle.fill,
|
|
13583
|
+
stroke = _object$parsedStyle.stroke,
|
|
13584
|
+
opacity = _object$parsedStyle.opacity,
|
|
12874
13585
|
strokeOpacity = _object$parsedStyle.strokeOpacity,
|
|
12875
13586
|
lineDash = _object$parsedStyle.lineDash,
|
|
12876
13587
|
lineWidth = _object$parsedStyle.lineWidth;
|
|
12877
|
-
var nodeName = object.nodeName;
|
|
13588
|
+
var nodeName = object.nodeName;
|
|
13589
|
+
var hasStroke = stroke && !stroke.isNone;
|
|
13590
|
+
var hasDash = lineDash && lineDash.length && lineDash.every(function (item) {
|
|
13591
|
+
return item.value !== 0;
|
|
13592
|
+
}); // Polyline don't need fill
|
|
12878
13593
|
|
|
12879
13594
|
if (index === 0 && (object.nodeName === g.Shape.POLYLINE || fill.isNone)) {
|
|
12880
13595
|
return false;
|
|
@@ -12882,14 +13597,10 @@
|
|
|
12882
13597
|
|
|
12883
13598
|
|
|
12884
13599
|
if (index === 1) {
|
|
12885
|
-
if (strokeOpacity.value === 0 || lineWidth.value === 0) {
|
|
13600
|
+
if (strokeOpacity.value === 0 || opacity.value === 0 || lineWidth.value === 0 || !hasStroke) {
|
|
12886
13601
|
return false;
|
|
12887
13602
|
}
|
|
12888
13603
|
|
|
12889
|
-
var hasDash = lineDash && lineDash.length && lineDash.every(function (item) {
|
|
12890
|
-
return item.value !== 0;
|
|
12891
|
-
});
|
|
12892
|
-
|
|
12893
13604
|
if (nodeName === g.Shape.CIRCLE || nodeName === g.Shape.ELLIPSE) {
|
|
12894
13605
|
// @see https://github.com/antvis/g/issues/824
|
|
12895
13606
|
return hasDash;
|
|
@@ -13154,7 +13865,7 @@
|
|
|
13154
13865
|
|
|
13155
13866
|
Fog.tag = 'fog';
|
|
13156
13867
|
|
|
13157
|
-
var _class;
|
|
13868
|
+
var _class$1;
|
|
13158
13869
|
|
|
13159
13870
|
var RenderGraphPlugin_1;
|
|
13160
13871
|
var SceneUniformBufferIndex = 0; // uniforms in scene level
|
|
@@ -13171,7 +13882,7 @@
|
|
|
13171
13882
|
SceneUniform["IS_PICKING"] = "u_IsPicking";
|
|
13172
13883
|
})(SceneUniform || (SceneUniform = {}));
|
|
13173
13884
|
|
|
13174
|
-
var RenderGraphPlugin = RenderGraphPlugin_1 = (_class = /*#__PURE__*/function () {
|
|
13885
|
+
var RenderGraphPlugin = RenderGraphPlugin_1 = (_class$1 = /*#__PURE__*/function () {
|
|
13175
13886
|
function RenderGraphPlugin() {
|
|
13176
13887
|
this.canvasConfig = void 0;
|
|
13177
13888
|
this.contextService = void 0;
|
|
@@ -13274,10 +13985,10 @@
|
|
|
13274
13985
|
_this.batchManager.changeRenderOrder(object, renderOrder);
|
|
13275
13986
|
};
|
|
13276
13987
|
|
|
13277
|
-
renderingService.hooks.init.tapPromise(RenderGraphPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$
|
|
13988
|
+
renderingService.hooks.init.tapPromise(RenderGraphPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
13278
13989
|
var $canvas, _this$canvasConfig, width, height;
|
|
13279
13990
|
|
|
13280
|
-
return _regeneratorRuntime$
|
|
13991
|
+
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
13281
13992
|
while (1) {
|
|
13282
13993
|
switch (_context.prev = _context.next) {
|
|
13283
13994
|
case 0:
|
|
@@ -13455,7 +14166,7 @@
|
|
|
13455
14166
|
};
|
|
13456
14167
|
|
|
13457
14168
|
return RenderGraphPlugin;
|
|
13458
|
-
}(), _class.tag = 'RenderGraph', _class);
|
|
14169
|
+
}(), _class$1.tag = 'RenderGraph', _class$1);
|
|
13459
14170
|
|
|
13460
14171
|
__decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], RenderGraphPlugin.prototype, "canvasConfig", void 0);
|
|
13461
14172
|
|
|
@@ -13479,7 +14190,7 @@
|
|
|
13479
14190
|
contrib: g.RenderingPluginContribution
|
|
13480
14191
|
})], RenderGraphPlugin);
|
|
13481
14192
|
|
|
13482
|
-
var _class$1;
|
|
14193
|
+
var _class$1$1;
|
|
13483
14194
|
|
|
13484
14195
|
var PickingPlugin_1;
|
|
13485
14196
|
/**
|
|
@@ -13491,7 +14202,7 @@
|
|
|
13491
14202
|
* Use color-based picking in GPU
|
|
13492
14203
|
*/
|
|
13493
14204
|
|
|
13494
|
-
var PickingPlugin = PickingPlugin_1 = (_class$1 = /*#__PURE__*/function () {
|
|
14205
|
+
var PickingPlugin = PickingPlugin_1 = (_class$1$1 = /*#__PURE__*/function () {
|
|
13495
14206
|
function PickingPlugin() {
|
|
13496
14207
|
this.canvasConfig = void 0;
|
|
13497
14208
|
this.sceneGraphService = void 0;
|
|
@@ -13523,8 +14234,8 @@
|
|
|
13523
14234
|
}
|
|
13524
14235
|
};
|
|
13525
14236
|
|
|
13526
|
-
renderingService.hooks.init.tapPromise(PickingPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$
|
|
13527
|
-
return _regeneratorRuntime$
|
|
14237
|
+
renderingService.hooks.init.tapPromise(PickingPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
14238
|
+
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
13528
14239
|
while (1) {
|
|
13529
14240
|
switch (_context.prev = _context.next) {
|
|
13530
14241
|
case 0:
|
|
@@ -13541,9 +14252,9 @@
|
|
|
13541
14252
|
_this.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED, handleMounted);
|
|
13542
14253
|
});
|
|
13543
14254
|
renderingService.hooks.pick.tapPromise(PickingPlugin_1.tag, /*#__PURE__*/function () {
|
|
13544
|
-
var _ref2 = _asyncToGenerator$
|
|
14255
|
+
var _ref2 = _asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee2(result) {
|
|
13545
14256
|
var topmost, position, x, y, dpr, width, height, xInDevicePixel, yInDevicePixel, pickedDisplayObjects;
|
|
13546
|
-
return _regeneratorRuntime$
|
|
14257
|
+
return _regeneratorRuntime$2().wrap(function _callee2$(_context2) {
|
|
13547
14258
|
while (1) {
|
|
13548
14259
|
switch (_context2.prev = _context2.next) {
|
|
13549
14260
|
case 0:
|
|
@@ -13588,9 +14299,9 @@
|
|
|
13588
14299
|
};
|
|
13589
14300
|
|
|
13590
14301
|
_proto.pickByRectangleInDepth = /*#__PURE__*/function () {
|
|
13591
|
-
var _pickByRectangleInDepth = _asyncToGenerator$
|
|
14302
|
+
var _pickByRectangleInDepth = _asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee3(rect, depth) {
|
|
13592
14303
|
var picked, counter, targets;
|
|
13593
|
-
return _regeneratorRuntime$
|
|
14304
|
+
return _regeneratorRuntime$2().wrap(function _callee3$(_context3) {
|
|
13594
14305
|
while (1) {
|
|
13595
14306
|
switch (_context3.prev = _context3.next) {
|
|
13596
14307
|
case 0:
|
|
@@ -13806,7 +14517,7 @@
|
|
|
13806
14517
|
};
|
|
13807
14518
|
|
|
13808
14519
|
return PickingPlugin;
|
|
13809
|
-
}(), _class$1.tag = 'WebGLPicker', _class$1);
|
|
14520
|
+
}(), _class$1$1.tag = 'WebGLPicker', _class$1$1);
|
|
13810
14521
|
|
|
13811
14522
|
__decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], PickingPlugin.prototype, "canvasConfig", void 0);
|
|
13812
14523
|
|
|
@@ -14000,7 +14711,7 @@
|
|
|
14000
14711
|
});
|
|
14001
14712
|
}
|
|
14002
14713
|
|
|
14003
|
-
var containerModule = g.Module(function (register) {
|
|
14714
|
+
var containerModule$1 = g.Module(function (register) {
|
|
14004
14715
|
register(RenderHelper);
|
|
14005
14716
|
register(TexturePool);
|
|
14006
14717
|
register(LightPool);
|
|
@@ -14056,7 +14767,7 @@
|
|
|
14056
14767
|
});
|
|
14057
14768
|
});
|
|
14058
14769
|
|
|
14059
|
-
var Plugin = /*#__PURE__*/function () {
|
|
14770
|
+
var Plugin$1 = /*#__PURE__*/function () {
|
|
14060
14771
|
function Plugin() {
|
|
14061
14772
|
this.name = 'device-renderer';
|
|
14062
14773
|
this.container = void 0;
|
|
@@ -14070,7 +14781,7 @@
|
|
|
14070
14781
|
}
|
|
14071
14782
|
|
|
14072
14783
|
this.container = container;
|
|
14073
|
-
container.load(containerModule, true);
|
|
14784
|
+
container.load(containerModule$1, true);
|
|
14074
14785
|
};
|
|
14075
14786
|
|
|
14076
14787
|
_proto.destroy = function destroy(container) {
|
|
@@ -14078,7 +14789,7 @@
|
|
|
14078
14789
|
g.GlobalContainer.remove(MeshUpdater);
|
|
14079
14790
|
}
|
|
14080
14791
|
|
|
14081
|
-
container.unload(containerModule);
|
|
14792
|
+
container.unload(containerModule$1);
|
|
14082
14793
|
};
|
|
14083
14794
|
|
|
14084
14795
|
_proto.getDevice = function getDevice() {
|
|
@@ -14110,6 +14821,7 @@
|
|
|
14110
14821
|
DeviceProgram: DeviceProgram,
|
|
14111
14822
|
DynamicUniformBuffer: DynamicUniformBuffer,
|
|
14112
14823
|
get Endianness () { return Endianness; },
|
|
14824
|
+
FILL_TEXTURE_MAPPING: FILL_TEXTURE_MAPPING,
|
|
14113
14825
|
get FillMesh () { return FillMesh; },
|
|
14114
14826
|
Fog: Fog,
|
|
14115
14827
|
get FogType () { return FogType; },
|
|
@@ -14136,7 +14848,7 @@
|
|
|
14136
14848
|
get MipFilterMode () { return MipFilterMode; },
|
|
14137
14849
|
OpaqueBlack: OpaqueBlack,
|
|
14138
14850
|
OpaqueWhite: OpaqueWhite,
|
|
14139
|
-
Plugin: Plugin,
|
|
14851
|
+
Plugin: Plugin$1,
|
|
14140
14852
|
get PrimitiveTopology () { return PrimitiveTopology; },
|
|
14141
14853
|
get QueryPoolType () { return QueryPoolType; },
|
|
14142
14854
|
get RGAttachmentSlot () { return RGAttachmentSlot; },
|
|
@@ -14193,7 +14905,7 @@
|
|
|
14193
14905
|
colorNewFromRGBA: colorNewFromRGBA,
|
|
14194
14906
|
compareDefines: compareDefines,
|
|
14195
14907
|
compareDepthValues: compareDepthValues,
|
|
14196
|
-
containerModule: containerModule,
|
|
14908
|
+
containerModule: containerModule$1,
|
|
14197
14909
|
copyAttachmentState: copyAttachmentState,
|
|
14198
14910
|
copyAttachmentStateFromSimple: copyAttachmentStateFromSimple,
|
|
14199
14911
|
copyMegaState: copyMegaState,
|
|
@@ -14289,9 +15001,9 @@
|
|
|
14289
15001
|
vertexAttributeDescriptorEquals: vertexAttributeDescriptorEquals
|
|
14290
15002
|
});
|
|
14291
15003
|
|
|
14292
|
-
function _regeneratorRuntime$
|
|
15004
|
+
function _regeneratorRuntime$3() {
|
|
14293
15005
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
14294
|
-
_regeneratorRuntime$
|
|
15006
|
+
_regeneratorRuntime$3 = function _regeneratorRuntime() {
|
|
14295
15007
|
return exports;
|
|
14296
15008
|
};
|
|
14297
15009
|
|
|
@@ -14639,7 +15351,7 @@
|
|
|
14639
15351
|
}, exports;
|
|
14640
15352
|
}
|
|
14641
15353
|
|
|
14642
|
-
function asyncGeneratorStep$
|
|
15354
|
+
function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14643
15355
|
try {
|
|
14644
15356
|
var info = gen[key](arg);
|
|
14645
15357
|
var value = info.value;
|
|
@@ -14655,7 +15367,7 @@
|
|
|
14655
15367
|
}
|
|
14656
15368
|
}
|
|
14657
15369
|
|
|
14658
|
-
function _asyncToGenerator$
|
|
15370
|
+
function _asyncToGenerator$3(fn) {
|
|
14659
15371
|
return function () {
|
|
14660
15372
|
var self = this,
|
|
14661
15373
|
args = arguments;
|
|
@@ -14663,11 +15375,11 @@
|
|
|
14663
15375
|
var gen = fn.apply(self, args);
|
|
14664
15376
|
|
|
14665
15377
|
function _next(value) {
|
|
14666
|
-
asyncGeneratorStep$
|
|
15378
|
+
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
|
|
14667
15379
|
}
|
|
14668
15380
|
|
|
14669
15381
|
function _throw(err) {
|
|
14670
|
-
asyncGeneratorStep$
|
|
15382
|
+
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
|
|
14671
15383
|
}
|
|
14672
15384
|
|
|
14673
15385
|
_next(undefined);
|
|
@@ -14768,9 +15480,9 @@
|
|
|
14768
15480
|
globalThis.removeEventListener('mouseup', onPointerUp, true);
|
|
14769
15481
|
};
|
|
14770
15482
|
|
|
14771
|
-
renderingService.hooks.init.tapPromise(DOMInteractionPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$
|
|
15483
|
+
renderingService.hooks.init.tapPromise(DOMInteractionPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee() {
|
|
14772
15484
|
var $el;
|
|
14773
|
-
return _regeneratorRuntime$
|
|
15485
|
+
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
14774
15486
|
while (1) {
|
|
14775
15487
|
switch (_context.prev = _context.next) {
|
|
14776
15488
|
case 0:
|
|
@@ -14836,11 +15548,11 @@
|
|
|
14836
15548
|
DOMInteractionPlugin = DOMInteractionPlugin_1 = __decorate([g.singleton({
|
|
14837
15549
|
contrib: g.RenderingPluginContribution
|
|
14838
15550
|
})], DOMInteractionPlugin);
|
|
14839
|
-
var containerModule$
|
|
15551
|
+
var containerModule$2 = g.Module(function (register) {
|
|
14840
15552
|
register(DOMInteractionPlugin);
|
|
14841
15553
|
});
|
|
14842
15554
|
|
|
14843
|
-
var Plugin$
|
|
15555
|
+
var Plugin$2 = /*#__PURE__*/function () {
|
|
14844
15556
|
function Plugin() {
|
|
14845
15557
|
this.name = 'dom-interaction';
|
|
14846
15558
|
}
|
|
@@ -14848,11 +15560,11 @@
|
|
|
14848
15560
|
var _proto = Plugin.prototype;
|
|
14849
15561
|
|
|
14850
15562
|
_proto.init = function init(container) {
|
|
14851
|
-
container.load(containerModule$
|
|
15563
|
+
container.load(containerModule$2, true);
|
|
14852
15564
|
};
|
|
14853
15565
|
|
|
14854
15566
|
_proto.destroy = function destroy(container) {
|
|
14855
|
-
container.unload(containerModule$
|
|
15567
|
+
container.unload(containerModule$2);
|
|
14856
15568
|
};
|
|
14857
15569
|
|
|
14858
15570
|
return Plugin;
|
|
@@ -14860,12 +15572,12 @@
|
|
|
14860
15572
|
|
|
14861
15573
|
var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
14862
15574
|
__proto__: null,
|
|
14863
|
-
Plugin: Plugin$
|
|
15575
|
+
Plugin: Plugin$2
|
|
14864
15576
|
});
|
|
14865
15577
|
|
|
14866
|
-
function _regeneratorRuntime$
|
|
15578
|
+
function _regeneratorRuntime$4() {
|
|
14867
15579
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
14868
|
-
_regeneratorRuntime$
|
|
15580
|
+
_regeneratorRuntime$4 = function _regeneratorRuntime() {
|
|
14869
15581
|
return exports;
|
|
14870
15582
|
};
|
|
14871
15583
|
|
|
@@ -15213,7 +15925,7 @@
|
|
|
15213
15925
|
}, exports;
|
|
15214
15926
|
}
|
|
15215
15927
|
|
|
15216
|
-
function asyncGeneratorStep$
|
|
15928
|
+
function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
|
|
15217
15929
|
try {
|
|
15218
15930
|
var info = gen[key](arg);
|
|
15219
15931
|
var value = info.value;
|
|
@@ -15229,7 +15941,7 @@
|
|
|
15229
15941
|
}
|
|
15230
15942
|
}
|
|
15231
15943
|
|
|
15232
|
-
function _asyncToGenerator$
|
|
15944
|
+
function _asyncToGenerator$4(fn) {
|
|
15233
15945
|
return function () {
|
|
15234
15946
|
var self = this,
|
|
15235
15947
|
args = arguments;
|
|
@@ -15237,11 +15949,11 @@
|
|
|
15237
15949
|
var gen = fn.apply(self, args);
|
|
15238
15950
|
|
|
15239
15951
|
function _next(value) {
|
|
15240
|
-
asyncGeneratorStep$
|
|
15952
|
+
asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
|
|
15241
15953
|
}
|
|
15242
15954
|
|
|
15243
15955
|
function _throw(err) {
|
|
15244
|
-
asyncGeneratorStep$
|
|
15956
|
+
asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
|
|
15245
15957
|
}
|
|
15246
15958
|
|
|
15247
15959
|
_next(undefined);
|
|
@@ -15311,8 +16023,8 @@
|
|
|
15311
16023
|
}
|
|
15312
16024
|
};
|
|
15313
16025
|
|
|
15314
|
-
renderingService.hooks.init.tapPromise(HTMLRenderingPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$
|
|
15315
|
-
return _regeneratorRuntime$
|
|
16026
|
+
renderingService.hooks.init.tapPromise(HTMLRenderingPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$4( /*#__PURE__*/_regeneratorRuntime$4().mark(function _callee() {
|
|
16027
|
+
return _regeneratorRuntime$4().wrap(function _callee$(_context) {
|
|
15316
16028
|
while (1) {
|
|
15317
16029
|
switch (_context.prev = _context.next) {
|
|
15318
16030
|
case 0:
|
|
@@ -15438,24 +16150,33 @@
|
|
|
15438
16150
|
var color = '';
|
|
15439
16151
|
|
|
15440
16152
|
if (fill instanceof g.CSSRGB) {
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
// ['0', '#ffffff'],
|
|
15446
|
-
return cur[1] + " " + Number(cur[0]) * 100 + "%";
|
|
15447
|
-
}).join(','); // @see https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient()
|
|
15448
|
-
|
|
15449
|
-
color = "linear-gradient(to right, " + steps + ");";
|
|
16153
|
+
if (fill.isNone) {
|
|
16154
|
+
color = 'transparent';
|
|
16155
|
+
} else {
|
|
16156
|
+
color = object.getAttribute('fill');
|
|
15450
16157
|
}
|
|
15451
|
-
}
|
|
16158
|
+
} else if (Array.isArray(fill)) {
|
|
16159
|
+
color = object.getAttribute('fill');
|
|
16160
|
+
} else if (g.isPattern(fill)) ;
|
|
15452
16161
|
|
|
15453
16162
|
$el.style.background = color;
|
|
15454
16163
|
break;
|
|
15455
16164
|
|
|
15456
16165
|
case 'stroke':
|
|
15457
16166
|
var stroke = object.parsedStyle.stroke;
|
|
15458
|
-
|
|
16167
|
+
var borderColor = '';
|
|
16168
|
+
|
|
16169
|
+
if (stroke instanceof g.CSSRGB) {
|
|
16170
|
+
if (stroke.isNone) {
|
|
16171
|
+
borderColor = 'transparent';
|
|
16172
|
+
} else {
|
|
16173
|
+
borderColor = object.getAttribute('stroke');
|
|
16174
|
+
}
|
|
16175
|
+
} else if (Array.isArray(stroke)) {
|
|
16176
|
+
borderColor = object.getAttribute('stroke');
|
|
16177
|
+
} else if (g.isPattern(stroke)) ;
|
|
16178
|
+
|
|
16179
|
+
$el.style['border-color'] = borderColor;
|
|
15459
16180
|
$el.style['border-style'] = 'solid';
|
|
15460
16181
|
break;
|
|
15461
16182
|
|
|
@@ -15487,11 +16208,11 @@
|
|
|
15487
16208
|
HTMLRenderingPlugin = HTMLRenderingPlugin_1 = __decorate([g.singleton({
|
|
15488
16209
|
contrib: g.RenderingPluginContribution
|
|
15489
16210
|
})], HTMLRenderingPlugin);
|
|
15490
|
-
var containerModule$
|
|
16211
|
+
var containerModule$3 = g.Module(function (register) {
|
|
15491
16212
|
register(HTMLRenderingPlugin);
|
|
15492
16213
|
});
|
|
15493
16214
|
|
|
15494
|
-
var Plugin$
|
|
16215
|
+
var Plugin$3 = /*#__PURE__*/function () {
|
|
15495
16216
|
function Plugin() {
|
|
15496
16217
|
this.name = 'html-renderer';
|
|
15497
16218
|
}
|
|
@@ -15499,11 +16220,11 @@
|
|
|
15499
16220
|
var _proto = Plugin.prototype;
|
|
15500
16221
|
|
|
15501
16222
|
_proto.init = function init(container) {
|
|
15502
|
-
container.load(containerModule$
|
|
16223
|
+
container.load(containerModule$3, true);
|
|
15503
16224
|
};
|
|
15504
16225
|
|
|
15505
16226
|
_proto.destroy = function destroy(container) {
|
|
15506
|
-
container.unload(containerModule$
|
|
16227
|
+
container.unload(containerModule$3);
|
|
15507
16228
|
};
|
|
15508
16229
|
|
|
15509
16230
|
return Plugin;
|
|
@@ -15511,12 +16232,12 @@
|
|
|
15511
16232
|
|
|
15512
16233
|
var index_esm$2 = /*#__PURE__*/Object.freeze({
|
|
15513
16234
|
__proto__: null,
|
|
15514
|
-
Plugin: Plugin$
|
|
16235
|
+
Plugin: Plugin$3
|
|
15515
16236
|
});
|
|
15516
16237
|
|
|
15517
|
-
function _regeneratorRuntime$
|
|
16238
|
+
function _regeneratorRuntime$5() {
|
|
15518
16239
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
15519
|
-
_regeneratorRuntime$
|
|
16240
|
+
_regeneratorRuntime$5 = function _regeneratorRuntime() {
|
|
15520
16241
|
return exports;
|
|
15521
16242
|
};
|
|
15522
16243
|
|
|
@@ -15864,7 +16585,7 @@
|
|
|
15864
16585
|
}, exports;
|
|
15865
16586
|
}
|
|
15866
16587
|
|
|
15867
|
-
function asyncGeneratorStep$
|
|
16588
|
+
function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
|
|
15868
16589
|
try {
|
|
15869
16590
|
var info = gen[key](arg);
|
|
15870
16591
|
var value = info.value;
|
|
@@ -15880,7 +16601,7 @@
|
|
|
15880
16601
|
}
|
|
15881
16602
|
}
|
|
15882
16603
|
|
|
15883
|
-
function _asyncToGenerator$
|
|
16604
|
+
function _asyncToGenerator$5(fn) {
|
|
15884
16605
|
return function () {
|
|
15885
16606
|
var self = this,
|
|
15886
16607
|
args = arguments;
|
|
@@ -15888,11 +16609,11 @@
|
|
|
15888
16609
|
var gen = fn.apply(self, args);
|
|
15889
16610
|
|
|
15890
16611
|
function _next(value) {
|
|
15891
|
-
asyncGeneratorStep$
|
|
16612
|
+
asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
|
|
15892
16613
|
}
|
|
15893
16614
|
|
|
15894
16615
|
function _throw(err) {
|
|
15895
|
-
asyncGeneratorStep$
|
|
16616
|
+
asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
|
|
15896
16617
|
}
|
|
15897
16618
|
|
|
15898
16619
|
_next(undefined);
|
|
@@ -16082,9 +16803,9 @@
|
|
|
16082
16803
|
}
|
|
16083
16804
|
|
|
16084
16805
|
function _load() {
|
|
16085
|
-
_load = _asyncToGenerator$
|
|
16806
|
+
_load = _asyncToGenerator$5( /*#__PURE__*/_regeneratorRuntime$5().mark(function _callee(module, imports) {
|
|
16086
16807
|
var bytes, instance;
|
|
16087
|
-
return _regeneratorRuntime$
|
|
16808
|
+
return _regeneratorRuntime$5().wrap(function _callee$(_context) {
|
|
16088
16809
|
while (1) {
|
|
16089
16810
|
switch (_context.prev = _context.next) {
|
|
16090
16811
|
case 0:
|
|
@@ -16168,10 +16889,10 @@
|
|
|
16168
16889
|
}
|
|
16169
16890
|
|
|
16170
16891
|
function _init() {
|
|
16171
|
-
_init = _asyncToGenerator$
|
|
16892
|
+
_init = _asyncToGenerator$5( /*#__PURE__*/_regeneratorRuntime$5().mark(function _callee2(input) {
|
|
16172
16893
|
var imports, _yield$load, instance, module;
|
|
16173
16894
|
|
|
16174
|
-
return _regeneratorRuntime$
|
|
16895
|
+
return _regeneratorRuntime$5().wrap(function _callee2$(_context2) {
|
|
16175
16896
|
while (1) {
|
|
16176
16897
|
switch (_context2.prev = _context2.next) {
|
|
16177
16898
|
case 0:
|
|
@@ -18431,9 +19152,9 @@
|
|
|
18431
19152
|
var _proto = WebGPUDeviceContribution.prototype;
|
|
18432
19153
|
|
|
18433
19154
|
_proto.createSwapChain = /*#__PURE__*/function () {
|
|
18434
|
-
var _createSwapChain = _asyncToGenerator$
|
|
19155
|
+
var _createSwapChain = _asyncToGenerator$5( /*#__PURE__*/_regeneratorRuntime$5().mark(function _callee($canvas) {
|
|
18435
19156
|
var adapter, optionalFeatures, requiredFeatures, device, context;
|
|
18436
|
-
return _regeneratorRuntime$
|
|
19157
|
+
return _regeneratorRuntime$5().wrap(function _callee$(_context) {
|
|
18437
19158
|
while (1) {
|
|
18438
19159
|
switch (_context.prev = _context.next) {
|
|
18439
19160
|
case 0:
|
|
@@ -18538,11 +19259,11 @@
|
|
|
18538
19259
|
WebGPUDeviceContribution = __decorate([g.singleton({
|
|
18539
19260
|
token: DeviceContribution
|
|
18540
19261
|
})], WebGPUDeviceContribution);
|
|
18541
|
-
var containerModule$
|
|
19262
|
+
var containerModule$4 = g.Module(function (register) {
|
|
18542
19263
|
register(WebGPUDeviceContribution);
|
|
18543
19264
|
});
|
|
18544
19265
|
|
|
18545
|
-
var Plugin$
|
|
19266
|
+
var Plugin$4 = /*#__PURE__*/function () {
|
|
18546
19267
|
function Plugin(options) {
|
|
18547
19268
|
if (options === void 0) {
|
|
18548
19269
|
options = {};
|
|
@@ -18559,12 +19280,12 @@
|
|
|
18559
19280
|
container.register(WebGPUDeviceOptions, {
|
|
18560
19281
|
useValue: _extends$1({}, this.options)
|
|
18561
19282
|
});
|
|
18562
|
-
container.load(containerModule$
|
|
19283
|
+
container.load(containerModule$4, true);
|
|
18563
19284
|
};
|
|
18564
19285
|
|
|
18565
19286
|
_proto.destroy = function destroy(container) {
|
|
18566
19287
|
container.remove(WebGPUDeviceOptions);
|
|
18567
|
-
container.unload(containerModule$
|
|
19288
|
+
container.unload(containerModule$4);
|
|
18568
19289
|
};
|
|
18569
19290
|
|
|
18570
19291
|
return Plugin;
|
|
@@ -18572,7 +19293,7 @@
|
|
|
18572
19293
|
|
|
18573
19294
|
var index_esm$3 = /*#__PURE__*/Object.freeze({
|
|
18574
19295
|
__proto__: null,
|
|
18575
|
-
Plugin: Plugin$
|
|
19296
|
+
Plugin: Plugin$4
|
|
18576
19297
|
});
|
|
18577
19298
|
|
|
18578
19299
|
var WebGLContextService = /*#__PURE__*/function () {
|
|
@@ -18694,7 +19415,7 @@
|
|
|
18694
19415
|
token: g.ContextService
|
|
18695
19416
|
})], WebGLContextService);
|
|
18696
19417
|
|
|
18697
|
-
var containerModule$
|
|
19418
|
+
var containerModule$5 = g.Module(function (register) {
|
|
18698
19419
|
/**
|
|
18699
19420
|
* implements ContextService
|
|
18700
19421
|
*/
|
|
@@ -18708,11 +19429,11 @@
|
|
|
18708
19429
|
var _proto = ContextRegisterPlugin.prototype;
|
|
18709
19430
|
|
|
18710
19431
|
_proto.init = function init(container) {
|
|
18711
|
-
container.load(containerModule$
|
|
19432
|
+
container.load(containerModule$5, true);
|
|
18712
19433
|
};
|
|
18713
19434
|
|
|
18714
19435
|
_proto.destroy = function destroy(container) {
|
|
18715
|
-
container.unload(containerModule$
|
|
19436
|
+
container.unload(containerModule$5);
|
|
18716
19437
|
};
|
|
18717
19438
|
|
|
18718
19439
|
return ContextRegisterPlugin;
|
|
@@ -18728,14 +19449,16 @@
|
|
|
18728
19449
|
|
|
18729
19450
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
18730
19451
|
|
|
18731
|
-
_this.registerPlugin(new Plugin$3());
|
|
18732
|
-
|
|
18733
19452
|
_this.registerPlugin(new Plugin());
|
|
18734
19453
|
|
|
19454
|
+
_this.registerPlugin(new Plugin$4());
|
|
19455
|
+
|
|
18735
19456
|
_this.registerPlugin(new Plugin$1());
|
|
18736
19457
|
|
|
18737
19458
|
_this.registerPlugin(new Plugin$2());
|
|
18738
19459
|
|
|
19460
|
+
_this.registerPlugin(new Plugin$3());
|
|
19461
|
+
|
|
18739
19462
|
return _this;
|
|
18740
19463
|
}
|
|
18741
19464
|
|