@antv/g-webgpu 1.7.18 → 1.7.20

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.umd.js CHANGED
@@ -1194,15 +1194,6 @@
1194
1194
 
1195
1195
  function __param(paramIndex, decorator) {
1196
1196
  return function (target, key) { decorator(target, key, paramIndex); }
1197
- }
1198
-
1199
- /** @deprecated */
1200
- function __spreadArrays() {
1201
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
1202
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
1203
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
1204
- r[k] = a[j];
1205
- return r;
1206
1197
  }
1207
1198
 
1208
1199
  var eventemitter3 = createCommonjsModule(function (module) {
@@ -1978,148 +1969,6 @@
1978
1969
  return _setPrototypeOf$1(o, p);
1979
1970
  }
1980
1971
 
1981
- var toString$1 = {}.toString;
1982
-
1983
- var isType$1 = function isType(value, type) {
1984
- return toString$1.call(value) === '[object ' + type + ']';
1985
- };
1986
- /**
1987
- * 是否为函数
1988
- * @param {*} fn 对象
1989
- * @return {Boolean} 是否函数
1990
- */
1991
-
1992
-
1993
- var isFunction = function isFunction(value) {
1994
- return isType$1(value, 'Function');
1995
- };
1996
-
1997
- var isArray = function isArray(value) {
1998
- return Array.isArray ? Array.isArray(value) : isType$1(value, 'Array');
1999
- };
2000
-
2001
- var isObject = function isObject(value) {
2002
- /**
2003
- * isObject({}) => true
2004
- * isObject([1, 2, 3]) => true
2005
- * isObject(Function) => true
2006
- * isObject(null) => false
2007
- */
2008
- var type = typeof value;
2009
- return value !== null && type === 'object' || type === 'function';
2010
- };
2011
-
2012
- function each(elements, func) {
2013
- if (!elements) {
2014
- return;
2015
- }
2016
-
2017
- var rst;
2018
-
2019
- if (isArray(elements)) {
2020
- for (var i = 0, len = elements.length; i < len; i++) {
2021
- rst = func(elements[i], i);
2022
-
2023
- if (rst === false) {
2024
- break;
2025
- }
2026
- }
2027
- } else if (isObject(elements)) {
2028
- for (var k in elements) {
2029
- if (elements.hasOwnProperty(k)) {
2030
- rst = func(elements[k], k);
2031
-
2032
- if (rst === false) {
2033
- break;
2034
- }
2035
- }
2036
- }
2037
- }
2038
- }
2039
-
2040
- var isString$1 = function isString(str) {
2041
- return isType$1(str, 'String');
2042
- }; // @ts-ignore
2043
-
2044
-
2045
- var values = Object.values ? function (obj) {
2046
- return Object.values(obj);
2047
- } : function (obj) {
2048
- var result = [];
2049
- each(obj, function (value, key) {
2050
- if (!(isFunction(obj) && key === 'prototype')) {
2051
- result.push(value);
2052
- }
2053
- });
2054
- return result;
2055
- };
2056
- /**
2057
- * _.memoize(calColor);
2058
- * _.memoize(calColor, (...args) => args[0]);
2059
- * @param f
2060
- * @param resolver
2061
- */
2062
-
2063
- var memoize = function memoize(f, resolver) {
2064
- if (!isFunction(f)) {
2065
- throw new TypeError('Expected a function');
2066
- }
2067
-
2068
- var memoized = function memoized() {
2069
- var args = [];
2070
-
2071
- for (var _i = 0; _i < arguments.length; _i++) {
2072
- args[_i] = arguments[_i];
2073
- } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
2074
-
2075
-
2076
- var key = resolver ? resolver.apply(this, args) : args[0];
2077
- var cache = memoized.cache;
2078
-
2079
- if (cache.has(key)) {
2080
- return cache.get(key);
2081
- }
2082
-
2083
- var result = f.apply(this, args); // 缓存起来
2084
-
2085
- cache.set(key, result);
2086
- return result;
2087
- };
2088
-
2089
- memoized.cache = new Map();
2090
- return memoized;
2091
- };
2092
-
2093
- var ctx;
2094
- /**
2095
- * 计算文本的宽度
2096
- */
2097
-
2098
- memoize(function (text, font) {
2099
- if (font === void 0) {
2100
- font = {};
2101
- }
2102
-
2103
- var fontSize = font.fontSize,
2104
- fontFamily = font.fontFamily,
2105
- fontWeight = font.fontWeight,
2106
- fontStyle = font.fontStyle,
2107
- fontVariant = font.fontVariant;
2108
-
2109
- if (!ctx) {
2110
- ctx = document.createElement('canvas').getContext('2d');
2111
- }
2112
-
2113
- ctx.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
2114
- return ctx.measureText(isString$1(text) ? text : '').width;
2115
- }, function (text, font) {
2116
- if (font === void 0) {
2117
- font = {};
2118
- }
2119
-
2120
- return __spreadArrays([text], values(font)).join('');
2121
- });
2122
-
2123
1972
  var ImagePool = /*#__PURE__*/function () {
2124
1973
  function ImagePool(canvasConfig) {
2125
1974
  this.canvasConfig = void 0;
@@ -2192,7 +2041,7 @@
2192
2041
  repetition = pattern.repetition;
2193
2042
  var src; // Image URL
2194
2043
 
2195
- if (isString$1(image)) {
2044
+ if (isString(image)) {
2196
2045
  src = this.getImageSync(image, callback);
2197
2046
  } else {
2198
2047
  src = image;
@@ -2276,7 +2125,7 @@
2276
2125
  var image = pattern.image,
2277
2126
  repetition = pattern.repetition; // only generate cache for Image
2278
2127
 
2279
- if (isString$1(image)) {
2128
+ if (isString(image)) {
2280
2129
  return "pattern-" + image + "-" + repetition;
2281
2130
  }
2282
2131
  };
@@ -2310,7 +2159,7 @@
2310
2159
  if (nodeName === gLite.Shape.IMAGE) {
2311
2160
  var img = attributes.img;
2312
2161
 
2313
- if (isString$1(img)) {
2162
+ if (isString(img)) {
2314
2163
  _this.imagePool.getImageSync(img, function () {
2315
2164
  // set dirty rectangle flag
2316
2165
  object.renderable.dirty = true;
@@ -2327,7 +2176,7 @@
2327
2176
 
2328
2177
  if (object.nodeName === gLite.Shape.IMAGE) {
2329
2178
  if (attrName === 'img') {
2330
- if (isString$1(newValue)) {
2179
+ if (isString(newValue)) {
2331
2180
  _this.imagePool.getOrCreateImage(newValue).then(function () {
2332
2181
  // set dirty rectangle flag
2333
2182
  object.renderable.dirty = true;
@@ -14864,6 +14713,13 @@
14864
14713
  renderingService.hooks.destroy.tap(PickingPlugin_1.tag, function () {
14865
14714
  _this.renderingContext.root.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
14866
14715
  });
14716
+ /**
14717
+ * Sync version is not implemented.
14718
+ */
14719
+
14720
+ renderingService.hooks.pickSync.tap(PickingPlugin_1.tag, function (result) {
14721
+ return result;
14722
+ });
14867
14723
  renderingService.hooks.pick.tapPromise(PickingPlugin_1.tag, /*#__PURE__*/function () {
14868
14724
  var _ref2 = _asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee2(result) {
14869
14725
  var topmost, position, x, y, dpr, width, height, xInDevicePixel, yInDevicePixel, pickedDisplayObjects;
@@ -16615,148 +16471,6 @@
16615
16471
  return _setPrototypeOf$4(o, p);
16616
16472
  }
16617
16473
 
16618
- var toString$2 = {}.toString;
16619
-
16620
- var isType$2 = function isType(value, type) {
16621
- return toString$2.call(value) === '[object ' + type + ']';
16622
- };
16623
- /**
16624
- * 是否为函数
16625
- * @param {*} fn 对象
16626
- * @return {Boolean} 是否函数
16627
- */
16628
-
16629
-
16630
- var isFunction$1 = function isFunction(value) {
16631
- return isType$2(value, 'Function');
16632
- };
16633
-
16634
- var isArray$1 = function isArray(value) {
16635
- return Array.isArray ? Array.isArray(value) : isType$2(value, 'Array');
16636
- };
16637
-
16638
- var isObject$1 = function isObject(value) {
16639
- /**
16640
- * isObject({}) => true
16641
- * isObject([1, 2, 3]) => true
16642
- * isObject(Function) => true
16643
- * isObject(null) => false
16644
- */
16645
- var type = typeof value;
16646
- return value !== null && type === 'object' || type === 'function';
16647
- };
16648
-
16649
- function each$1(elements, func) {
16650
- if (!elements) {
16651
- return;
16652
- }
16653
-
16654
- var rst;
16655
-
16656
- if (isArray$1(elements)) {
16657
- for (var i = 0, len = elements.length; i < len; i++) {
16658
- rst = func(elements[i], i);
16659
-
16660
- if (rst === false) {
16661
- break;
16662
- }
16663
- }
16664
- } else if (isObject$1(elements)) {
16665
- for (var k in elements) {
16666
- if (elements.hasOwnProperty(k)) {
16667
- rst = func(elements[k], k);
16668
-
16669
- if (rst === false) {
16670
- break;
16671
- }
16672
- }
16673
- }
16674
- }
16675
- }
16676
-
16677
- var isString$2 = function isString(str) {
16678
- return isType$2(str, 'String');
16679
- }; // @ts-ignore
16680
-
16681
-
16682
- var values$1 = Object.values ? function (obj) {
16683
- return Object.values(obj);
16684
- } : function (obj) {
16685
- var result = [];
16686
- each$1(obj, function (value, key) {
16687
- if (!(isFunction$1(obj) && key === 'prototype')) {
16688
- result.push(value);
16689
- }
16690
- });
16691
- return result;
16692
- };
16693
- /**
16694
- * _.memoize(calColor);
16695
- * _.memoize(calColor, (...args) => args[0]);
16696
- * @param f
16697
- * @param resolver
16698
- */
16699
-
16700
- var memoize$1 = function memoize(f, resolver) {
16701
- if (!isFunction$1(f)) {
16702
- throw new TypeError('Expected a function');
16703
- }
16704
-
16705
- var memoized = function memoized() {
16706
- var args = [];
16707
-
16708
- for (var _i = 0; _i < arguments.length; _i++) {
16709
- args[_i] = arguments[_i];
16710
- } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
16711
-
16712
-
16713
- var key = resolver ? resolver.apply(this, args) : args[0];
16714
- var cache = memoized.cache;
16715
-
16716
- if (cache.has(key)) {
16717
- return cache.get(key);
16718
- }
16719
-
16720
- var result = f.apply(this, args); // 缓存起来
16721
-
16722
- cache.set(key, result);
16723
- return result;
16724
- };
16725
-
16726
- memoized.cache = new Map();
16727
- return memoized;
16728
- };
16729
-
16730
- var ctx$1;
16731
- /**
16732
- * 计算文本的宽度
16733
- */
16734
-
16735
- memoize$1(function (text, font) {
16736
- if (font === void 0) {
16737
- font = {};
16738
- }
16739
-
16740
- var fontSize = font.fontSize,
16741
- fontFamily = font.fontFamily,
16742
- fontWeight = font.fontWeight,
16743
- fontStyle = font.fontStyle,
16744
- fontVariant = font.fontVariant;
16745
-
16746
- if (!ctx$1) {
16747
- ctx$1 = document.createElement('canvas').getContext('2d');
16748
- }
16749
-
16750
- ctx$1.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
16751
- return ctx$1.measureText(isString$2(text) ? text : '').width;
16752
- }, function (text, font) {
16753
- if (font === void 0) {
16754
- font = {};
16755
- }
16756
-
16757
- return __spreadArrays([text], values$1(font)).join('');
16758
- });
16759
-
16760
16474
  var _class$3;
16761
16475
 
16762
16476
  var HTMLRenderingPlugin_1;
@@ -16919,7 +16633,7 @@
16919
16633
  case 'innerHTML':
16920
16634
  var innerHTML = object.parsedStyle.innerHTML;
16921
16635
 
16922
- if (isString$2(innerHTML)) {
16636
+ if (isString(innerHTML)) {
16923
16637
  $el.innerHTML = innerHTML;
16924
16638
  } else {
16925
16639
  $el.innerHTML = '';
@@ -18453,157 +18167,6 @@
18453
18167
  return ComputePipeline_WebGPU;
18454
18168
  }(ResourceBase_WebGPU);
18455
18169
 
18456
- var toString$3 = {}.toString;
18457
-
18458
- var isType$3 = function isType(value, type) {
18459
- return toString$3.call(value) === '[object ' + type + ']';
18460
- };
18461
- /**
18462
- * 是否为函数
18463
- * @param {*} fn 对象
18464
- * @return {Boolean} 是否函数
18465
- */
18466
-
18467
-
18468
- var isFunction$2 = function isFunction(value) {
18469
- return isType$3(value, 'Function');
18470
- }; // isFinite,
18471
-
18472
-
18473
- var isNil$1 = function isNil(value) {
18474
- /**
18475
- * isNil(null) => true
18476
- * isNil() => true
18477
- */
18478
- return value === null || value === undefined;
18479
- };
18480
-
18481
- var isArray$2 = function isArray(value) {
18482
- return Array.isArray ? Array.isArray(value) : isType$3(value, 'Array');
18483
- };
18484
-
18485
- var isObject$2 = function isObject(value) {
18486
- /**
18487
- * isObject({}) => true
18488
- * isObject([1, 2, 3]) => true
18489
- * isObject(Function) => true
18490
- * isObject(null) => false
18491
- */
18492
- var type = typeof value;
18493
- return value !== null && type === 'object' || type === 'function';
18494
- };
18495
-
18496
- function each$2(elements, func) {
18497
- if (!elements) {
18498
- return;
18499
- }
18500
-
18501
- var rst;
18502
-
18503
- if (isArray$2(elements)) {
18504
- for (var i = 0, len = elements.length; i < len; i++) {
18505
- rst = func(elements[i], i);
18506
-
18507
- if (rst === false) {
18508
- break;
18509
- }
18510
- }
18511
- } else if (isObject$2(elements)) {
18512
- for (var k in elements) {
18513
- if (elements.hasOwnProperty(k)) {
18514
- rst = func(elements[k], k);
18515
-
18516
- if (rst === false) {
18517
- break;
18518
- }
18519
- }
18520
- }
18521
- }
18522
- }
18523
-
18524
- var isString$3 = function isString(str) {
18525
- return isType$3(str, 'String');
18526
- }; // @ts-ignore
18527
-
18528
-
18529
- var values$2 = Object.values ? function (obj) {
18530
- return Object.values(obj);
18531
- } : function (obj) {
18532
- var result = [];
18533
- each$2(obj, function (value, key) {
18534
- if (!(isFunction$2(obj) && key === 'prototype')) {
18535
- result.push(value);
18536
- }
18537
- });
18538
- return result;
18539
- };
18540
- /**
18541
- * _.memoize(calColor);
18542
- * _.memoize(calColor, (...args) => args[0]);
18543
- * @param f
18544
- * @param resolver
18545
- */
18546
-
18547
- var memoize$2 = function memoize(f, resolver) {
18548
- if (!isFunction$2(f)) {
18549
- throw new TypeError('Expected a function');
18550
- }
18551
-
18552
- var memoized = function memoized() {
18553
- var args = [];
18554
-
18555
- for (var _i = 0; _i < arguments.length; _i++) {
18556
- args[_i] = arguments[_i];
18557
- } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
18558
-
18559
-
18560
- var key = resolver ? resolver.apply(this, args) : args[0];
18561
- var cache = memoized.cache;
18562
-
18563
- if (cache.has(key)) {
18564
- return cache.get(key);
18565
- }
18566
-
18567
- var result = f.apply(this, args); // 缓存起来
18568
-
18569
- cache.set(key, result);
18570
- return result;
18571
- };
18572
-
18573
- memoized.cache = new Map();
18574
- return memoized;
18575
- };
18576
-
18577
- var ctx$2;
18578
- /**
18579
- * 计算文本的宽度
18580
- */
18581
-
18582
- memoize$2(function (text, font) {
18583
- if (font === void 0) {
18584
- font = {};
18585
- }
18586
-
18587
- var fontSize = font.fontSize,
18588
- fontFamily = font.fontFamily,
18589
- fontWeight = font.fontWeight,
18590
- fontStyle = font.fontStyle,
18591
- fontVariant = font.fontVariant;
18592
-
18593
- if (!ctx$2) {
18594
- ctx$2 = document.createElement('canvas').getContext('2d');
18595
- }
18596
-
18597
- ctx$2.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
18598
- return ctx$2.measureText(isString$3(text) ? text : '').width;
18599
- }, function (text, font) {
18600
- if (font === void 0) {
18601
- font = {};
18602
- }
18603
-
18604
- return __spreadArrays([text], values$2(font)).join('');
18605
- });
18606
-
18607
18170
  var InputLayout_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
18608
18171
  _inheritsLoose$5(InputLayout_WebGPU, _ResourceBase_WebGPU);
18609
18172
 
@@ -18624,7 +18187,7 @@
18624
18187
 
18625
18188
  for (var i = 0; i < descriptor.vertexBufferDescriptors.length; i++) {
18626
18189
  var b = descriptor.vertexBufferDescriptors[i];
18627
- if (isNil$1(b)) continue;
18190
+ if (isNil(b)) continue;
18628
18191
  var arrayStride = b.byteStride;
18629
18192
  var stepMode = translateVertexBufferFrequency(b.frequency);
18630
18193
  var attributes = [];
@@ -19312,7 +18875,7 @@
19312
18875
 
19313
18876
  for (var i = 0; i < inputState.vertexBuffers.length; i++) {
19314
18877
  var b = inputState.vertexBuffers[i];
19315
- if (isNil$1(b)) continue;
18878
+ if (isNil(b)) continue;
19316
18879
  this.gpuRenderPassEncoder.setVertexBuffer(i, getPlatformBuffer(b.buffer), b.byteOffset);
19317
18880
  }
19318
18881
  };
@@ -20278,122 +19841,6 @@
20278
19841
 
20279
19842
  var DeviceRendererPlugin = gLite.Syringe.defineToken('');
20280
19843
 
20281
- var toString$4 = {}.toString;
20282
- var isType$4 = function (value, type) { return toString$4.call(value) === '[object ' + type + ']'; };
20283
-
20284
- /**
20285
- * 是否为函数
20286
- * @param {*} fn 对象
20287
- * @return {Boolean} 是否函数
20288
- */
20289
- var isFunction$3 = (function (value) {
20290
- return isType$4(value, 'Function');
20291
- });
20292
-
20293
- var isArray$3 = (function (value) {
20294
- return Array.isArray ?
20295
- Array.isArray(value) :
20296
- isType$4(value, 'Array');
20297
- });
20298
-
20299
- var isObject$3 = (function (value) {
20300
- /**
20301
- * isObject({}) => true
20302
- * isObject([1, 2, 3]) => true
20303
- * isObject(Function) => true
20304
- * isObject(null) => false
20305
- */
20306
- var type = typeof value;
20307
- return value !== null && type === 'object' || type === 'function';
20308
- });
20309
-
20310
- function each$3(elements, func) {
20311
- if (!elements) {
20312
- return;
20313
- }
20314
- var rst;
20315
- if (isArray$3(elements)) {
20316
- for (var i = 0, len = elements.length; i < len; i++) {
20317
- rst = func(elements[i], i);
20318
- if (rst === false) {
20319
- break;
20320
- }
20321
- }
20322
- }
20323
- else if (isObject$3(elements)) {
20324
- for (var k in elements) {
20325
- if (elements.hasOwnProperty(k)) {
20326
- rst = func(elements[k], k);
20327
- if (rst === false) {
20328
- break;
20329
- }
20330
- }
20331
- }
20332
- }
20333
- }
20334
-
20335
- var isString$4 = (function (str) {
20336
- return isType$4(str, 'String');
20337
- });
20338
-
20339
- // @ts-ignore
20340
- var values$3 = Object.values ? function (obj) { return Object.values(obj); } : function (obj) {
20341
- var result = [];
20342
- each$3(obj, function (value, key) {
20343
- if (!(isFunction$3(obj) && key === 'prototype')) {
20344
- result.push(value);
20345
- }
20346
- });
20347
- return result;
20348
- };
20349
-
20350
- /**
20351
- * _.memoize(calColor);
20352
- * _.memoize(calColor, (...args) => args[0]);
20353
- * @param f
20354
- * @param resolver
20355
- */
20356
- var memoize$3 = (function (f, resolver) {
20357
- if (!isFunction$3(f)) {
20358
- throw new TypeError('Expected a function');
20359
- }
20360
- var memoized = function () {
20361
- var args = [];
20362
- for (var _i = 0; _i < arguments.length; _i++) {
20363
- args[_i] = arguments[_i];
20364
- }
20365
- // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
20366
- var key = resolver ? resolver.apply(this, args) : args[0];
20367
- var cache = memoized.cache;
20368
- if (cache.has(key)) {
20369
- return cache.get(key);
20370
- }
20371
- var result = f.apply(this, args);
20372
- // 缓存起来
20373
- cache.set(key, result);
20374
- return result;
20375
- };
20376
- memoized.cache = new Map();
20377
- return memoized;
20378
- });
20379
-
20380
- var ctx$3;
20381
- /**
20382
- * 计算文本的宽度
20383
- */
20384
- memoize$3(function (text, font) {
20385
- if (font === void 0) { font = {}; }
20386
- var fontSize = font.fontSize, fontFamily = font.fontFamily, fontWeight = font.fontWeight, fontStyle = font.fontStyle, fontVariant = font.fontVariant;
20387
- if (!ctx$3) {
20388
- ctx$3 = document.createElement('canvas').getContext('2d');
20389
- }
20390
- ctx$3.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
20391
- return ctx$3.measureText(isString$4(text) ? text : '').width;
20392
- }, function (text, font) {
20393
- if (font === void 0) { font = {}; }
20394
- return __spreadArrays([text], values$3(font)).join('');
20395
- });
20396
-
20397
19844
  var WebGPUContextService = /*#__PURE__*/function () {
20398
19845
  function WebGPUContextService(canvasConfig, deviceRendererPlugin) {
20399
19846
  this.canvasConfig = void 0;
@@ -20428,7 +19875,7 @@
20428
19875
  this.canvasConfig.container = this.$container;
20429
19876
  } else if (container) {
20430
19877
  // create container
20431
- this.$container = isString$4(container) ? document.getElementById(container) : container;
19878
+ this.$container = isString(container) ? document.getElementById(container) : container;
20432
19879
 
20433
19880
  if (this.$container) {
20434
19881
  // create canvas