@antv/g-webgpu 1.7.14 → 1.7.15

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
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@antv/g')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@antv/g'], factory) :
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@antv/g-lite')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@antv/g-lite'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.G = global.G || {}, global.G.WebGPU = {}), global.window.G));
5
- }(this, (function (exports, g) { 'use strict';
5
+ }(this, (function (exports, gLite) { 'use strict';
6
6
 
7
7
  function _regeneratorRuntime() {
8
8
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -1192,8 +1192,17 @@
1192
1192
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1193
1193
  }
1194
1194
 
1195
- function __metadata(metadataKey, metadataValue) {
1196
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
1195
+ function __param(paramIndex, decorator) {
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;
1197
1206
  }
1198
1207
 
1199
1208
  var eventemitter3 = createCommonjsModule(function (module) {
@@ -1534,6 +1543,40 @@
1534
1543
  }
1535
1544
  });
1536
1545
 
1546
+ var toString = {}.toString;
1547
+ var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
1548
+
1549
+ // isFinite,
1550
+ var isNil = function (value) {
1551
+ /**
1552
+ * isNil(null) => true
1553
+ * isNil() => true
1554
+ */
1555
+ return value === null || value === undefined;
1556
+ };
1557
+
1558
+ var isString = (function (str) {
1559
+ return isType(str, 'String');
1560
+ });
1561
+
1562
+ var clamp = function (a, min, max) {
1563
+ if (a < min) {
1564
+ return min;
1565
+ }
1566
+ else if (a > max) {
1567
+ return max;
1568
+ }
1569
+ return a;
1570
+ };
1571
+
1572
+ /**
1573
+ * 判断是否数字
1574
+ * @return {Boolean} 是否数字
1575
+ */
1576
+ var isNumber = function (value) {
1577
+ return isType(value, 'Number');
1578
+ };
1579
+
1537
1580
  function _regeneratorRuntime$1() {
1538
1581
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
1539
1582
  _regeneratorRuntime$1 = function _regeneratorRuntime() {
@@ -1935,12 +1978,155 @@
1935
1978
  return _setPrototypeOf$1(o, p);
1936
1979
  }
1937
1980
 
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
+
1938
2123
  var ImagePool = /*#__PURE__*/function () {
1939
- function ImagePool() {
2124
+ function ImagePool(canvasConfig) {
2125
+ this.canvasConfig = void 0;
1940
2126
  this.imageCache = {};
1941
2127
  this.gradientCache = {};
1942
2128
  this.patternCache = {};
1943
- this.canvasConfig = void 0;
2129
+ this.canvasConfig = canvasConfig;
1944
2130
  }
1945
2131
 
1946
2132
  var _proto = ImagePool.prototype;
@@ -1975,7 +2161,7 @@
1975
2161
 
1976
2162
  if (createImage) {
1977
2163
  image = createImage(src);
1978
- } else if (g.isBrowser) {
2164
+ } else if (gLite.isBrowser) {
1979
2165
  image = new window.Image();
1980
2166
  }
1981
2167
 
@@ -2006,7 +2192,7 @@
2006
2192
  repetition = pattern.repetition;
2007
2193
  var src; // Image URL
2008
2194
 
2009
- if (g.isString(image)) {
2195
+ if (isString$1(image)) {
2010
2196
  src = this.getImageSync(image, callback);
2011
2197
  } else {
2012
2198
  src = image;
@@ -2039,8 +2225,8 @@
2039
2225
 
2040
2226
  var gradient = null;
2041
2227
 
2042
- if (type === g.GradientType.LinearGradient) {
2043
- var _computeLinearGradien = g.computeLinearGradient(width, height, angle),
2228
+ if (type === gLite.GradientType.LinearGradient) {
2229
+ var _computeLinearGradien = gLite.computeLinearGradient(width, height, angle),
2044
2230
  x1 = _computeLinearGradien.x1,
2045
2231
  y1 = _computeLinearGradien.y1,
2046
2232
  x2 = _computeLinearGradien.x2,
@@ -2048,8 +2234,8 @@
2048
2234
 
2049
2235
 
2050
2236
  gradient = context.createLinearGradient(x1, y1, x2, y2);
2051
- } else if (type === g.GradientType.RadialGradient) {
2052
- var _computeRadialGradien = g.computeRadialGradient(width, height, cx, cy),
2237
+ } else if (type === gLite.GradientType.RadialGradient) {
2238
+ var _computeRadialGradien = gLite.computeRadialGradient(width, height, cx, cy),
2053
2239
  x = _computeRadialGradien.x,
2054
2240
  y = _computeRadialGradien.y,
2055
2241
  r = _computeRadialGradien.r; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createRadialGradient
@@ -2090,7 +2276,7 @@
2090
2276
  var image = pattern.image,
2091
2277
  repetition = pattern.repetition; // only generate cache for Image
2092
2278
 
2093
- if (g.isString(image)) {
2279
+ if (isString$1(image)) {
2094
2280
  return "pattern-" + image + "-" + repetition;
2095
2281
  }
2096
2282
  };
@@ -2098,17 +2284,17 @@
2098
2284
  return ImagePool;
2099
2285
  }();
2100
2286
 
2101
- __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], ImagePool.prototype, "canvasConfig", void 0);
2102
-
2103
- ImagePool = __decorate([g.singleton()], ImagePool);
2287
+ ImagePool = __decorate([gLite.singleton(), __param(0, gLite.inject(gLite.CanvasConfig))], ImagePool);
2104
2288
 
2105
2289
  var _class;
2106
2290
 
2107
2291
  var LoadImagePlugin_1;
2108
2292
  var LoadImagePlugin = LoadImagePlugin_1 = (_class = /*#__PURE__*/function () {
2109
- function LoadImagePlugin() {
2293
+ function LoadImagePlugin(imagePool, renderingContext) {
2110
2294
  this.imagePool = void 0;
2111
2295
  this.renderingContext = void 0;
2296
+ this.imagePool = imagePool;
2297
+ this.renderingContext = renderingContext;
2112
2298
  }
2113
2299
 
2114
2300
  var _proto = LoadImagePlugin.prototype;
@@ -2121,10 +2307,10 @@
2121
2307
  var nodeName = object.nodeName,
2122
2308
  attributes = object.attributes;
2123
2309
 
2124
- if (nodeName === g.Shape.IMAGE) {
2310
+ if (nodeName === gLite.Shape.IMAGE) {
2125
2311
  var img = attributes.img;
2126
2312
 
2127
- if (g.isString(img)) {
2313
+ if (isString$1(img)) {
2128
2314
  _this.imagePool.getImageSync(img, function () {
2129
2315
  // set dirty rectangle flag
2130
2316
  object.renderable.dirty = true;
@@ -2139,9 +2325,9 @@
2139
2325
  var attrName = e.attrName,
2140
2326
  newValue = e.newValue;
2141
2327
 
2142
- if (object.nodeName === g.Shape.IMAGE) {
2328
+ if (object.nodeName === gLite.Shape.IMAGE) {
2143
2329
  if (attrName === 'img') {
2144
- if (g.isString(newValue)) {
2330
+ if (isString$1(newValue)) {
2145
2331
  _this.imagePool.getOrCreateImage(newValue).then(function () {
2146
2332
  // set dirty rectangle flag
2147
2333
  object.renderable.dirty = true;
@@ -2157,9 +2343,9 @@
2157
2343
  while (1) {
2158
2344
  switch (_context.prev = _context.next) {
2159
2345
  case 0:
2160
- _this.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED, handleMounted);
2346
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
2161
2347
 
2162
- _this.renderingContext.root.addEventListener(g.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
2348
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
2163
2349
 
2164
2350
  case 2:
2165
2351
  case "end":
@@ -2169,23 +2355,18 @@
2169
2355
  }, _callee);
2170
2356
  })));
2171
2357
  renderingService.hooks.destroy.tap(LoadImagePlugin_1.tag, function () {
2172
- _this.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED, handleMounted);
2358
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
2173
2359
 
2174
- _this.renderingContext.root.removeEventListener(g.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
2360
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
2175
2361
  });
2176
2362
  };
2177
2363
 
2178
2364
  return LoadImagePlugin;
2179
2365
  }(), _class.tag = 'LoadImage', _class);
2180
-
2181
- __decorate([g.inject(ImagePool), __metadata("design:type", ImagePool)], LoadImagePlugin.prototype, "imagePool", void 0);
2182
-
2183
- __decorate([g.inject(g.RenderingContext), __metadata("design:type", Object)], LoadImagePlugin.prototype, "renderingContext", void 0);
2184
-
2185
- LoadImagePlugin = LoadImagePlugin_1 = __decorate([g.singleton({
2186
- contrib: g.RenderingPluginContribution
2187
- })], LoadImagePlugin);
2188
- var containerModule = g.Module(function (register) {
2366
+ LoadImagePlugin = LoadImagePlugin_1 = __decorate([gLite.singleton({
2367
+ contrib: gLite.RenderingPluginContribution
2368
+ }), __param(0, gLite.inject(ImagePool)), __param(1, gLite.inject(gLite.RenderingContext))], LoadImagePlugin);
2369
+ var containerModule = gLite.Module(function (register) {
2189
2370
  register(ImagePool);
2190
2371
  register(LoadImagePlugin);
2191
2372
  });
@@ -2216,7 +2397,7 @@
2216
2397
  };
2217
2398
 
2218
2399
  return Plugin;
2219
- }(g.AbstractRendererPlugin);
2400
+ }(gLite.AbstractRendererPlugin);
2220
2401
 
2221
2402
  var earcut_1 = earcut;
2222
2403
  var _default = earcut;
@@ -2252,10 +2433,10 @@
2252
2433
 
2253
2434
  // minX, minY and invSize are later used to transform coords into integers for z-order calculation
2254
2435
  invSize = Math.max(maxX - minX, maxY - minY);
2255
- invSize = invSize !== 0 ? 1 / invSize : 0;
2436
+ invSize = invSize !== 0 ? 32767 / invSize : 0;
2256
2437
  }
2257
2438
 
2258
- earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
2439
+ earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
2259
2440
 
2260
2441
  return triangles;
2261
2442
  }
@@ -2319,9 +2500,9 @@
2319
2500
 
2320
2501
  if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
2321
2502
  // cut off the triangle
2322
- triangles.push(prev.i / dim);
2323
- triangles.push(ear.i / dim);
2324
- triangles.push(next.i / dim);
2503
+ triangles.push(prev.i / dim | 0);
2504
+ triangles.push(ear.i / dim | 0);
2505
+ triangles.push(next.i / dim | 0);
2325
2506
 
2326
2507
  removeNode(ear);
2327
2508
 
@@ -2364,10 +2545,18 @@
2364
2545
  if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
2365
2546
 
2366
2547
  // now make sure we don't have other points inside the potential ear
2367
- var p = ear.next.next;
2548
+ var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
2368
2549
 
2369
- while (p !== ear.prev) {
2370
- if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
2550
+ // triangle bbox; min & max are calculated like this for speed
2551
+ var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),
2552
+ y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),
2553
+ x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),
2554
+ y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);
2555
+
2556
+ var p = c.next;
2557
+ while (p !== a) {
2558
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&
2559
+ pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) &&
2371
2560
  area(p.prev, p, p.next) >= 0) return false;
2372
2561
  p = p.next;
2373
2562
  }
@@ -2382,45 +2571,43 @@
2382
2571
 
2383
2572
  if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
2384
2573
 
2574
+ var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
2575
+
2385
2576
  // triangle bbox; min & max are calculated like this for speed
2386
- var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),
2387
- minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),
2388
- maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),
2389
- maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);
2577
+ var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),
2578
+ y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),
2579
+ x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),
2580
+ y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);
2390
2581
 
2391
2582
  // z-order range for the current triangle bbox;
2392
- var minZ = zOrder(minTX, minTY, minX, minY, invSize),
2393
- maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
2583
+ var minZ = zOrder(x0, y0, minX, minY, invSize),
2584
+ maxZ = zOrder(x1, y1, minX, minY, invSize);
2394
2585
 
2395
2586
  var p = ear.prevZ,
2396
2587
  n = ear.nextZ;
2397
2588
 
2398
2589
  // look for points inside the triangle in both directions
2399
2590
  while (p && p.z >= minZ && n && n.z <= maxZ) {
2400
- if (p !== ear.prev && p !== ear.next &&
2401
- pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
2402
- area(p.prev, p, p.next) >= 0) return false;
2591
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&
2592
+ pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
2403
2593
  p = p.prevZ;
2404
2594
 
2405
- if (n !== ear.prev && n !== ear.next &&
2406
- pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&
2407
- area(n.prev, n, n.next) >= 0) return false;
2595
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&
2596
+ pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
2408
2597
  n = n.nextZ;
2409
2598
  }
2410
2599
 
2411
2600
  // look for remaining points in decreasing z-order
2412
2601
  while (p && p.z >= minZ) {
2413
- if (p !== ear.prev && p !== ear.next &&
2414
- pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
2415
- area(p.prev, p, p.next) >= 0) return false;
2602
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&
2603
+ pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
2416
2604
  p = p.prevZ;
2417
2605
  }
2418
2606
 
2419
2607
  // look for remaining points in increasing z-order
2420
2608
  while (n && n.z <= maxZ) {
2421
- if (n !== ear.prev && n !== ear.next &&
2422
- pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&
2423
- area(n.prev, n, n.next) >= 0) return false;
2609
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&
2610
+ pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
2424
2611
  n = n.nextZ;
2425
2612
  }
2426
2613
 
@@ -2436,9 +2623,9 @@
2436
2623
 
2437
2624
  if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
2438
2625
 
2439
- triangles.push(a.i / dim);
2440
- triangles.push(p.i / dim);
2441
- triangles.push(b.i / dim);
2626
+ triangles.push(a.i / dim | 0);
2627
+ triangles.push(p.i / dim | 0);
2628
+ triangles.push(b.i / dim | 0);
2442
2629
 
2443
2630
  // remove two nodes involved
2444
2631
  removeNode(p);
@@ -2468,8 +2655,8 @@
2468
2655
  c = filterPoints(c, c.next);
2469
2656
 
2470
2657
  // run earcut on each half
2471
- earcutLinked(a, triangles, dim, minX, minY, invSize);
2472
- earcutLinked(c, triangles, dim, minX, minY, invSize);
2658
+ earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
2659
+ earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
2473
2660
  return;
2474
2661
  }
2475
2662
  b = b.next;
@@ -2496,7 +2683,6 @@
2496
2683
  // process holes from left to right
2497
2684
  for (i = 0; i < queue.length; i++) {
2498
2685
  outerNode = eliminateHole(queue[i], outerNode);
2499
- outerNode = filterPoints(outerNode, outerNode.next);
2500
2686
  }
2501
2687
 
2502
2688
  return outerNode;
@@ -2516,11 +2702,8 @@
2516
2702
  var bridgeReverse = splitPolygon(bridge, hole);
2517
2703
 
2518
2704
  // filter collinear points around the cuts
2519
- var filteredBridge = filterPoints(bridge, bridge.next);
2520
2705
  filterPoints(bridgeReverse, bridgeReverse.next);
2521
-
2522
- // Check if input node was removed by the filtering
2523
- return outerNode === bridge ? filteredBridge : outerNode;
2706
+ return filterPoints(bridge, bridge.next);
2524
2707
  }
2525
2708
 
2526
2709
  // David Eberly's algorithm for finding a bridge between hole and outer polygon
@@ -2538,11 +2721,8 @@
2538
2721
  var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
2539
2722
  if (x <= hx && x > qx) {
2540
2723
  qx = x;
2541
- if (x === hx) {
2542
- if (hy === p.y) return p;
2543
- if (hy === p.next.y) return p.next;
2544
- }
2545
2724
  m = p.x < p.next.x ? p : p.next;
2725
+ if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint
2546
2726
  }
2547
2727
  }
2548
2728
  p = p.next;
@@ -2550,8 +2730,6 @@
2550
2730
 
2551
2731
  if (!m) return null;
2552
2732
 
2553
- if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint
2554
-
2555
2733
  // look for points inside the triangle of hole point, segment intersection and endpoint;
2556
2734
  // if there are no points found, we have a valid connection;
2557
2735
  // otherwise choose the point of the minimum angle with the ray as connection point
@@ -2592,7 +2770,7 @@
2592
2770
  function indexCurve(start, minX, minY, invSize) {
2593
2771
  var p = start;
2594
2772
  do {
2595
- if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);
2773
+ if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
2596
2774
  p.prevZ = p.prev;
2597
2775
  p.nextZ = p.next;
2598
2776
  p = p.next;
@@ -2660,8 +2838,8 @@
2660
2838
  // z-order of a point given coords and inverse of the longer side of data bbox
2661
2839
  function zOrder(x, y, minX, minY, invSize) {
2662
2840
  // coords are transformed into non-negative 15-bit integer range
2663
- x = 32767 * (x - minX) * invSize;
2664
- y = 32767 * (y - minY) * invSize;
2841
+ x = (x - minX) * invSize | 0;
2842
+ y = (y - minY) * invSize | 0;
2665
2843
 
2666
2844
  x = (x | (x << 8)) & 0x00FF00FF;
2667
2845
  x = (x | (x << 4)) & 0x0F0F0F0F;
@@ -2690,9 +2868,9 @@
2690
2868
 
2691
2869
  // check if a point lies within a convex triangle
2692
2870
  function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
2693
- return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&
2694
- (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&
2695
- (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
2871
+ return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&
2872
+ (ax - px) * (by - py) >= (bx - px) * (ay - py) &&
2873
+ (bx - px) * (cy - py) >= (cx - px) * (by - py);
2696
2874
  }
2697
2875
 
2698
2876
  // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
@@ -2835,7 +3013,7 @@
2835
3013
  this.next = null;
2836
3014
 
2837
3015
  // z-order curve value
2838
- this.z = null;
3016
+ this.z = 0;
2839
3017
 
2840
3018
  // previous and next nodes in z-order
2841
3019
  this.prevZ = null;
@@ -3617,7 +3795,7 @@
3617
3795
  return LightPool;
3618
3796
  }();
3619
3797
 
3620
- LightPool = __decorate([g.singleton()], LightPool);
3798
+ LightPool = __decorate([gLite.singleton()], LightPool);
3621
3799
  var _excluded = ["style"];
3622
3800
 
3623
3801
  var Mesh = /*#__PURE__*/function (_DisplayObject) {
@@ -3630,7 +3808,7 @@
3630
3808
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
3631
3809
 
3632
3810
  _this = _DisplayObject.call(this, _extends({
3633
- type: g.Shape.MESH,
3811
+ type: gLite.Shape.MESH,
3634
3812
  style: _extends({
3635
3813
  x: '',
3636
3814
  y: '',
@@ -3671,7 +3849,7 @@
3671
3849
  };
3672
3850
 
3673
3851
  return Mesh;
3674
- }(g.DisplayObject);
3852
+ }(gLite.DisplayObject);
3675
3853
  /**
3676
3854
  * Common utilities
3677
3855
  * @module glMatrix
@@ -5730,8 +5908,8 @@
5730
5908
  }
5731
5909
 
5732
5910
  function inputLayoutBufferDescriptorEquals(a, b) {
5733
- if (g.isNil(a)) return g.isNil(b);
5734
- if (g.isNil(b)) return false;
5911
+ if (isNil(a)) return isNil(b);
5912
+ if (isNil(b)) return false;
5735
5913
  return a.byteStride === b.byteStride && a.frequency === b.frequency;
5736
5914
  }
5737
5915
 
@@ -5845,7 +6023,7 @@
5845
6023
  }
5846
6024
 
5847
6025
  function inputLayoutBufferDescriptorCopy(a) {
5848
- if (!g.isNil(a)) {
6026
+ if (!isNil(a)) {
5849
6027
  var byteStride = a.byteStride;
5850
6028
  var frequency = a.frequency;
5851
6029
  return {
@@ -6103,7 +6281,7 @@
6103
6281
  _proto.build = function build(meshes) {};
6104
6282
 
6105
6283
  _proto.computeBoundingBox = function computeBoundingBox() {
6106
- return new g.AABB();
6284
+ return new gLite.AABB();
6107
6285
  };
6108
6286
 
6109
6287
  _proto.setIndexBuffer = function setIndexBuffer(indices) {
@@ -6660,7 +6838,7 @@
6660
6838
  shoudDispatchMutationEvent = true;
6661
6839
  }
6662
6840
 
6663
- if (g.isNil(uniforms[key])) {
6841
+ if (isNil(uniforms[key])) {
6664
6842
  delete _this3.textures[key];
6665
6843
  delete _this3.uniforms[key];
6666
6844
  }
@@ -6943,7 +7121,7 @@
6943
7121
  if (this.defines[name] === v) return false;
6944
7122
  this.defines[name] = v;
6945
7123
  } else {
6946
- if (g.isNil(this.defines[name])) return false;
7124
+ if (isNil(this.defines[name])) return false;
6947
7125
  delete this.defines[name];
6948
7126
  }
6949
7127
 
@@ -8172,7 +8350,7 @@
8172
8350
  // These values are flipped if flipDepth is set.
8173
8351
 
8174
8352
 
8175
- var normalizedDepth = g.clamp(depth, 0, maxDepth) / maxDepth;
8353
+ var normalizedDepth = clamp(depth, 0, maxDepth) / maxDepth;
8176
8354
  if (flipDepth) normalizedDepth = 1.0 - normalizedDepth;
8177
8355
  var depthKey = normalizedDepth * ((1 << DEPTH_BITS) - 1);
8178
8356
  return depthKey & 0xffff;
@@ -8652,8 +8830,8 @@
8652
8830
  uniforms.forEach(function (uniform) {
8653
8831
  var value = uniform.value; // number | number[] | Float32Array
8654
8832
 
8655
- if (g.isNumber(value) || Array.isArray(value) || value instanceof Float32Array) {
8656
- var array = g.isNumber(value) ? [value] : value;
8833
+ if (isNumber(value) || Array.isArray(value) || value instanceof Float32Array) {
8834
+ var array = isNumber(value) ? [value] : value;
8657
8835
  var formatByteSize = array.length > 4 ? 4 : array.length; // std140 UBO layout
8658
8836
 
8659
8837
  var _emptySpace = 4 - offset % 4;
@@ -9261,7 +9439,7 @@
9261
9439
  return RenderHelper;
9262
9440
  }();
9263
9441
 
9264
- RenderHelper = __decorate([g.singleton()], RenderHelper);
9442
+ RenderHelper = __decorate([gLite.singleton()], RenderHelper);
9265
9443
 
9266
9444
  var RGRenderTargetDescription = /*#__PURE__*/function () {
9267
9445
  function RGRenderTargetDescription(pixelFormat) {
@@ -9439,12 +9617,16 @@
9439
9617
  }();
9440
9618
 
9441
9619
  var TexturePool = /*#__PURE__*/function () {
9442
- function TexturePool() {
9620
+ function TexturePool(imagePool, offscreenCanvas, renderingService, canvasConfig) {
9443
9621
  this.imagePool = void 0;
9444
9622
  this.offscreenCanvas = void 0;
9445
9623
  this.renderingService = void 0;
9446
9624
  this.canvasConfig = void 0;
9447
9625
  this.textureCache = {};
9626
+ this.imagePool = imagePool;
9627
+ this.offscreenCanvas = offscreenCanvas;
9628
+ this.renderingService = renderingService;
9629
+ this.canvasConfig = canvasConfig;
9448
9630
  }
9449
9631
 
9450
9632
  var _proto = TexturePool.prototype;
@@ -9476,7 +9658,7 @@
9476
9658
  this.textureCache[id] = texture;
9477
9659
  }
9478
9660
 
9479
- if (!g.isString(src)) {
9661
+ if (!isString(src)) {
9480
9662
  texture.setImageData(src);
9481
9663
  texture.emit(TextureEvent.LOADED);
9482
9664
  this.renderingService.dirtify();
@@ -9487,7 +9669,7 @@
9487
9669
 
9488
9670
  if (createImage) {
9489
9671
  image = createImage(src);
9490
- } else if (g.isBrowser) {
9672
+ } else if (gLite.isBrowser) {
9491
9673
  image = new window.Image();
9492
9674
  }
9493
9675
 
@@ -9568,7 +9750,7 @@
9568
9750
  canvas.height = height;
9569
9751
  var src; // Image URL
9570
9752
 
9571
- if (g.isString(image)) {
9753
+ if (isString(image)) {
9572
9754
  src = this.imagePool.getImageSync(image, callback);
9573
9755
  } else {
9574
9756
  src = image;
@@ -9590,23 +9772,15 @@
9590
9772
  return TexturePool;
9591
9773
  }();
9592
9774
 
9593
- __decorate([g.inject(ImagePool), __metadata("design:type", ImagePool)], TexturePool.prototype, "imagePool", void 0);
9594
-
9595
- __decorate([g.inject(g.OffscreenCanvasCreator), __metadata("design:type", g.OffscreenCanvasCreator)], TexturePool.prototype, "offscreenCanvas", void 0);
9596
-
9597
- __decorate([g.inject(g.RenderingService), __metadata("design:type", g.RenderingService)], TexturePool.prototype, "renderingService", void 0);
9598
-
9599
- __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], TexturePool.prototype, "canvasConfig", void 0);
9600
-
9601
- TexturePool = __decorate([g.singleton()], TexturePool);
9602
- var RendererFactory = g.Syringe.defineToken('');
9603
- var ShapeRenderer = g.Syringe.defineToken('');
9604
- var MeshFactory = g.Syringe.defineToken(''); // export const ShapeMesh = Syringe.defineToken('');
9775
+ TexturePool = __decorate([gLite.singleton(), __param(0, gLite.inject(ImagePool)), __param(1, gLite.inject(gLite.OffscreenCanvasCreator)), __param(2, gLite.inject(gLite.RenderingService)), __param(3, gLite.inject(gLite.CanvasConfig))], TexturePool);
9776
+ var RendererFactory = gLite.Syringe.defineToken('');
9777
+ var ShapeRenderer = gLite.Syringe.defineToken('');
9778
+ var MeshFactory = gLite.Syringe.defineToken(''); // export const ShapeMesh = Syringe.defineToken('');
9605
9779
 
9606
9780
  var stencilRefCounter = 1;
9607
9781
 
9608
9782
  var BatchManager = /*#__PURE__*/function () {
9609
- function BatchManager() {
9783
+ function BatchManager(renderHelper, rendererFactory, meshFactory) {
9610
9784
  this.renderHelper = void 0;
9611
9785
  this.rendererFactory = void 0;
9612
9786
  this.meshFactory = void 0;
@@ -9615,7 +9789,14 @@
9615
9789
  this.meshes = [];
9616
9790
  this.pendingUpdatePatches = {};
9617
9791
  this.stencilRefCache = {};
9792
+ this.renderHelper = renderHelper;
9793
+ this.rendererFactory = rendererFactory;
9794
+ this.meshFactory = meshFactory;
9618
9795
  }
9796
+ /**
9797
+ * attached when Device created
9798
+ */
9799
+
9619
9800
 
9620
9801
  var _proto = BatchManager.prototype;
9621
9802
 
@@ -9868,13 +10049,7 @@
9868
10049
  return BatchManager;
9869
10050
  }();
9870
10051
 
9871
- __decorate([g.inject(RenderHelper), __metadata("design:type", RenderHelper)], BatchManager.prototype, "renderHelper", void 0);
9872
-
9873
- __decorate([g.inject(RendererFactory), __metadata("design:type", Function)], BatchManager.prototype, "rendererFactory", void 0);
9874
-
9875
- __decorate([g.inject(MeshFactory), __metadata("design:type", Function)], BatchManager.prototype, "meshFactory", void 0);
9876
-
9877
- BatchManager = __decorate([g.singleton()], BatchManager);
10052
+ BatchManager = __decorate([gLite.singleton(), __param(0, gLite.inject(RenderHelper)), __param(1, gLite.inject(RendererFactory)), __param(2, gLite.inject(MeshFactory))], BatchManager);
9878
10053
  /**
9879
10054
  * render order start from 0, our default camera's Z is 500
9880
10055
  */
@@ -9915,17 +10090,17 @@
9915
10090
  return Batch;
9916
10091
  }();
9917
10092
 
9918
- __decorate([g.inject(RenderHelper), __metadata("design:type", RenderHelper)], Batch.prototype, "renderHelper", void 0);
10093
+ __decorate([gLite.inject(RenderHelper)], Batch.prototype, "renderHelper", void 0);
9919
10094
 
9920
- __decorate([g.inject(TexturePool), __metadata("design:type", TexturePool)], Batch.prototype, "texturePool", void 0);
10095
+ __decorate([gLite.inject(TexturePool)], Batch.prototype, "texturePool", void 0);
9921
10096
 
9922
- __decorate([g.inject(g.DefaultCamera), __metadata("design:type", g.Camera)], Batch.prototype, "camera", void 0);
10097
+ __decorate([gLite.inject(gLite.DefaultCamera)], Batch.prototype, "camera", void 0);
9923
10098
 
9924
- __decorate([g.inject(LightPool), __metadata("design:type", LightPool)], Batch.prototype, "lightPool", void 0);
10099
+ __decorate([gLite.inject(LightPool)], Batch.prototype, "lightPool", void 0);
9925
10100
 
9926
- __decorate([g.inject(BatchManager), __metadata("design:type", BatchManager)], Batch.prototype, "batchManager", void 0);
10101
+ __decorate([gLite.inject(BatchManager)], Batch.prototype, "batchManager", void 0);
9927
10102
 
9928
- Batch = __decorate([g.injectable()], Batch);
10103
+ Batch = __decorate([gLite.injectable()], Batch);
9929
10104
 
9930
10105
  function enumToObject(enumObject) {
9931
10106
  var result = {};
@@ -10086,12 +10261,12 @@
10086
10261
  var source = o1.parsedStyle[name];
10087
10262
  var target = o2.parsedStyle[name]; // constant color value
10088
10263
 
10089
- if (source instanceof g.CSSRGB && target instanceof g.CSSRGB) {
10264
+ if (source instanceof gLite.CSSRGB && target instanceof gLite.CSSRGB) {
10090
10265
  return true;
10091
10266
  } // pattern
10092
10267
 
10093
10268
 
10094
- if (g.isPattern(source) && g.isPattern(target) && source.image === target.image) {
10269
+ if (gLite.isPattern(source) && gLite.isPattern(target) && source.image === target.image) {
10095
10270
  return true;
10096
10271
  } // gradients
10097
10272
 
@@ -10155,13 +10330,13 @@
10155
10330
  increasedLineWidthForHitTesting = _object$parsedStyle.increasedLineWidthForHitTesting;
10156
10331
  var fillColor = [0, 0, 0, 0];
10157
10332
 
10158
- if (fill instanceof g.CSSRGB) {
10333
+ if (fill instanceof gLite.CSSRGB) {
10159
10334
  fillColor = [Number(fill.r) / 255, Number(fill.g) / 255, Number(fill.b) / 255, Number(fill.alpha)];
10160
10335
  }
10161
10336
 
10162
10337
  var strokeColor = [0, 0, 0, 0];
10163
10338
 
10164
- if (stroke instanceof g.CSSRGB) {
10339
+ if (stroke instanceof gLite.CSSRGB) {
10165
10340
  strokeColor = [Number(stroke.r) / 255, Number(stroke.g) / 255, Number(stroke.b) / 255, Number(stroke.alpha)];
10166
10341
  }
10167
10342
 
@@ -10485,13 +10660,13 @@
10485
10660
  stroke = _object$parsedStyle2.stroke;
10486
10661
  var fillColor = [0, 0, 0, 0];
10487
10662
 
10488
- if (fill instanceof g.CSSRGB) {
10663
+ if (fill instanceof gLite.CSSRGB) {
10489
10664
  fillColor = [Number(fill.r) / 255, Number(fill.g) / 255, Number(fill.b) / 255, Number(fill.alpha)];
10490
10665
  }
10491
10666
 
10492
10667
  var strokeColor = [0, 0, 0, 0];
10493
10668
 
10494
- if (stroke instanceof g.CSSRGB) {
10669
+ if (stroke instanceof gLite.CSSRGB) {
10495
10670
  strokeColor = [Number(stroke.r) / 255, Number(stroke.g) / 255, Number(stroke.b) / 255, Number(stroke.alpha)];
10496
10671
  }
10497
10672
 
@@ -10503,7 +10678,7 @@
10503
10678
  return m.name === FILL_TEXTURE_MAPPING;
10504
10679
  });
10505
10680
 
10506
- if (fill instanceof g.CSSRGB) {
10681
+ if (fill instanceof gLite.CSSRGB) {
10507
10682
  if (i >= 0) {
10508
10683
  // remove original fill texture mapping
10509
10684
  this.textureMappings.splice(i, -1);
@@ -10683,7 +10858,7 @@
10683
10858
  var uniforms = [];
10684
10859
 
10685
10860
  if (useWireframe) {
10686
- var wireframeColor = g.parseColor(material.wireframeColor);
10861
+ var wireframeColor = gLite.parseColor(material.wireframeColor);
10687
10862
  uniforms.push({
10688
10863
  name: 'u_WireframeLineColor',
10689
10864
  value: [Number(wireframeColor.r) / 255, Number(wireframeColor.g) / 255, Number(wireframeColor.b) / 255]
@@ -10779,7 +10954,7 @@
10779
10954
  end = _fog$parsedStyle.end,
10780
10955
  density = _fog$parsedStyle.density;
10781
10956
 
10782
- if (fill instanceof g.CSSRGB) {
10957
+ if (fill instanceof gLite.CSSRGB) {
10783
10958
  var fillColor = [Number(fill.r) / 255, Number(fill.g) / 255, Number(fill.b) / 255, Number(fill.alpha)];
10784
10959
  uniforms.push({
10785
10960
  name: 'u_FogInfos',
@@ -10807,10 +10982,10 @@
10807
10982
  var _this6 = this;
10808
10983
 
10809
10984
  var instance = objects[0];
10810
- var fill = instance.nodeName === g.Shape.LINE ? instance.parsedStyle.stroke : instance.parsedStyle.fill;
10985
+ var fill = instance.nodeName === gLite.Shape.LINE ? instance.parsedStyle.stroke : instance.parsedStyle.fill;
10811
10986
  var texImageSource; // use pattern & gradient
10812
10987
 
10813
- if (fill && (g.isPattern(fill) || Array.isArray(fill))) {
10988
+ if (fill && (gLite.isPattern(fill) || Array.isArray(fill))) {
10814
10989
  if (Array.isArray(fill)) {
10815
10990
  this.program.setDefineBool('USE_PATTERN', false);
10816
10991
  this.texturePool.getOrCreateGradient({
@@ -10819,7 +10994,7 @@
10819
10994
  height: 128,
10820
10995
  instance: instance
10821
10996
  });
10822
- } else if (g.isPattern(fill)) {
10997
+ } else if (gLite.isPattern(fill)) {
10823
10998
  this.program.setDefineBool('USE_PATTERN', true);
10824
10999
  this.texturePool.getOrCreatePattern(fill, instance, function () {
10825
11000
  // need re-render
@@ -10871,15 +11046,15 @@
10871
11046
  return Instanced;
10872
11047
  }();
10873
11048
 
10874
- __decorate([g.inject(RenderHelper), __metadata("design:type", RenderHelper)], Instanced.prototype, "renderHelper", void 0);
11049
+ __decorate([gLite.inject(RenderHelper)], Instanced.prototype, "renderHelper", void 0);
10875
11050
 
10876
- __decorate([g.inject(TexturePool), __metadata("design:type", TexturePool)], Instanced.prototype, "texturePool", void 0);
11051
+ __decorate([gLite.inject(TexturePool)], Instanced.prototype, "texturePool", void 0);
10877
11052
 
10878
- __decorate([g.inject(g.DefaultCamera), __metadata("design:type", g.Camera)], Instanced.prototype, "camera", void 0);
11053
+ __decorate([gLite.inject(gLite.DefaultCamera)], Instanced.prototype, "camera", void 0);
10879
11054
 
10880
- __decorate([g.inject(LightPool), __metadata("design:type", LightPool)], Instanced.prototype, "lightPool", void 0);
11055
+ __decorate([gLite.inject(LightPool)], Instanced.prototype, "lightPool", void 0);
10881
11056
 
10882
- Instanced = __decorate([g.injectable()], Instanced);
11057
+ Instanced = __decorate([gLite.injectable()], Instanced);
10883
11058
  var frag = "#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};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Data;\nin vec2 v_Radius;\nin vec4 v_StylePacked3;\n\nout vec4 outputColor;\n\n/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\n// @see http://www.iquilezles.org/www/articles/ellipsoids/ellipsoids.htm\nfloat sdEllipsoidApproximated(vec2 p, vec2 r) {\n float k0 = length(p / r);\n float k1 = length(p / (r * r));\n return k0 * (k0 - 1.0) / k1;\n}\n\nvoid main() {\n int shape = int(floor(v_Data.w + 0.5));\n float epsilon = 0.000001;\n\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\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 bool omitStroke = v_StylePacked3.z == 1.0;\n\n float antialiasblur = v_Data.z;\n float antialiased_blur = -max(0.0, antialiasblur);\n vec2 r = (v_Radius - (omitStroke ? 0.0 : u_StrokeWidth)) / v_Radius;\n\n float outer_df;\n float inner_df;\n // 'circle', 'ellipse', 'rect'\n if (shape == 0) {\n outer_df = sdCircle(v_Data.xy, 1.0);\n inner_df = sdCircle(v_Data.xy, r.x);\n } else if (shape == 1) {\n outer_df = sdEllipsoidApproximated(v_Data.xy, vec2(1.0));\n inner_df = sdEllipsoidApproximated(v_Data.xy, r);\n }\n\n float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);\n\n float color_t = u_StrokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n inner_df\n );\n\n // vec2 imagecoord = mod(v_Uv, 0.1);\n // vec4 texel = texture(SAMPLER_2D(u_Map), imagecoord);\n // u_Color = texel;\n\n vec4 diffuseColor;\n vec4 strokeColor;\n if (u_IsPicking > 0.5) {\n diffuseColor = vec4(u_PickingColor, 1.0);\n strokeColor = vec4(u_PickingColor, 1.0);\n } else {\n diffuseColor = u_Color;\n strokeColor = (u_StrokeColor == vec4(0) || omitStroke) ? vec4(0.0) : u_StrokeColor;\n }\n\n outputColor = mix(vec4(diffuseColor.rgb, diffuseColor.a * u_FillOpacity), strokeColor * u_StrokeOpacity, color_t);\n outputColor.a = outputColor.a * u_Opacity * opacity_t;\n\n if (outputColor.a < epsilon)\n discard;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n }\n}"; // eslint-disable-line
10884
11059
 
10885
11060
  var vert = "#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};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Extrude;\nlayout(location = PACKED_STYLE3) in vec4 a_StylePacked3;\nlayout(location = SIZE) in vec2 a_Size;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nout vec4 v_Data;\nout vec2 v_Radius;\nout vec4 v_StylePacked3;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\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 float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float antialiasblur = 1.0 / (a_Size.x + strokeWidth);\n\n bool omitStroke = a_StylePacked3.z == 1.0;\n vec2 radius = a_Size + vec2(omitStroke ? 0.0 : strokeWidth / 2.0);\n vec2 offset = (a_Extrude + vec2(1.0) - 2.0 * u_Anchor.xy) * radius;\n\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n \n v_Radius = radius;\n v_Data = vec4(a_Extrude, antialiasblur, a_StylePacked3.x);\n v_StylePacked3 = a_StylePacked3;\n}"; // eslint-disable-line
@@ -10897,7 +11072,7 @@
10897
11072
  SDFVertexAttributeLocation[SDFVertexAttributeLocation["SIZE"] = 14] = "SIZE";
10898
11073
  })(SDFVertexAttributeLocation || (SDFVertexAttributeLocation = {}));
10899
11074
 
10900
- var SDF_Shape = [g.Shape.CIRCLE, g.Shape.ELLIPSE];
11075
+ var SDF_Shape = [gLite.Shape.CIRCLE, gLite.Shape.ELLIPSE];
10901
11076
  /**
10902
11077
  * Use SDF to render 2D shapes, eg. circle, ellipse.
10903
11078
  * Use less triangles(2) and vertices compared with normal triangulation.
@@ -11026,10 +11201,10 @@
11026
11201
  _proto.getSize = function getSize(parsed, tagName) {
11027
11202
  var size = [0, 0];
11028
11203
 
11029
- if (tagName === g.Shape.CIRCLE) {
11204
+ if (tagName === gLite.Shape.CIRCLE) {
11030
11205
  var r = parsed.r;
11031
11206
  size = [r, r];
11032
- } else if (tagName === g.Shape.ELLIPSE) {
11207
+ } else if (tagName === gLite.Shape.ELLIPSE) {
11033
11208
  var rx = parsed.rx,
11034
11209
  ry = parsed.ry;
11035
11210
  size = [rx, ry];
@@ -11066,7 +11241,7 @@
11066
11241
  return SDFMesh;
11067
11242
  }(Instanced);
11068
11243
 
11069
- SDFMesh = __decorate([g.injectable()], SDFMesh);
11244
+ SDFMesh = __decorate([gLite.injectable()], SDFMesh);
11070
11245
  var frag$1 = "#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};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Dash;\n// in vec2 v_Normal;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\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 if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n #ifdef USE_MAP\n outputColor = u_Color;\n #endif\n\n // float blur = 1. - smoothstep(0.98, 1., length(v_Normal));\n float u_dash_offset = v_Dash.y;\n float u_dash_array = v_Dash.z;\n float u_dash_ratio = v_Dash.w;\n outputColor.a = outputColor.a\n // * blur\n * u_Opacity * u_StrokeOpacity\n * ceil(mod(v_Dash.x + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));\n }\n}"; // eslint-disable-line
11071
11246
 
11072
11247
  var vert$1 = "#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};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\nlayout(location = POINTA) in vec3 a_PointA;\nlayout(location = POINTB) in vec3 a_PointB;\nlayout(location = CAP) in float a_Cap;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\nlayout(location = DASH) in vec4 a_Dash;\n\nout vec4 v_Dash;\n// out vec2 v_Normal;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\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 float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float isBillboard = a_Dash.w;\n if (isBillboard < 0.5) {\n vec2 xBasis = a_PointB.xy - a_PointA.xy;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n\n vec2 point = a_PointA.xy + xBasis * a_Position.x + yBasis * strokeWidth * a_Position.y;\n point = point - u_Anchor.xy * abs(xBasis);\n\n // round & square\n if (a_Cap > 1.0) {\n point += sign(a_Position.x - 0.5) * normalize(xBasis) * vec2(strokeWidth / 2.0);\n }\n\n gl_Position = project(vec4(point, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n } else {\n // clip space\n vec4 clip0 = project(vec4(a_PointA, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n vec4 clip1 = project(vec4(a_PointB, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n // screen space\n vec2 screen0 = u_Viewport * (0.5 * clip0.xy / clip0.w + 0.5);\n vec2 screen1 = u_Viewport * (0.5 * clip1.xy / clip1.w + 0.5);\n vec2 xBasis = normalize(screen1 - screen0);\n vec2 yBasis = vec2(-xBasis.y, xBasis.x);\n vec2 pt0 = screen0 + strokeWidth * (a_Position.x * xBasis + a_Position.y * yBasis);\n vec2 pt1 = screen1 + strokeWidth * (a_Position.x * xBasis + a_Position.y * yBasis);\n vec2 pt = mix(pt0, pt1, a_Position.z);\n vec4 clip = mix(clip0, clip1, a_Position.z);\n gl_Position = vec4(clip.w * (2.0 * pt / u_Viewport - 1.0), clip.z, clip.w);\n }\n\n v_Dash = vec4(a_Position.x, a_Dash.xyz);\n}"; // eslint-disable-line
@@ -11137,10 +11312,10 @@
11137
11312
  var parsedLineStyleProps;
11138
11313
  var totalLength;
11139
11314
 
11140
- if (object.nodeName === g.Shape.LINE) {
11315
+ if (object.nodeName === gLite.Shape.LINE) {
11141
11316
  parsedLineStyleProps = object.parsedStyle;
11142
11317
  totalLength = object.getTotalLength();
11143
- } else if (object.nodeName === g.Shape.POLYLINE) {
11318
+ } else if (object.nodeName === gLite.Shape.POLYLINE) {
11144
11319
  var _object$parsedStyle = object.parsedStyle,
11145
11320
  points = _object$parsedStyle.points.points,
11146
11321
  _defX = _object$parsedStyle.defX,
@@ -11167,7 +11342,7 @@
11167
11342
  markerEndOffset: markerEndOffset
11168
11343
  };
11169
11344
  totalLength = object.getTotalLength();
11170
- } else if (object.nodeName === g.Shape.PATH) {
11345
+ } else if (object.nodeName === gLite.Shape.PATH) {
11171
11346
  var _object$parsedStyle2 = object.parsedStyle,
11172
11347
  curve = _object$parsedStyle2.path.curve,
11173
11348
  _defX2 = _object$parsedStyle2.defX,
@@ -11301,9 +11476,9 @@
11301
11476
  objects.forEach(function (object) {
11302
11477
  var parsedLineStyleProps;
11303
11478
 
11304
- if (object.nodeName === g.Shape.LINE) {
11479
+ if (object.nodeName === gLite.Shape.LINE) {
11305
11480
  parsedLineStyleProps = object.parsedStyle;
11306
- } else if (object.nodeName === g.Shape.POLYLINE && object.renderable.proxyNodeName === g.Shape.LINE) {
11481
+ } else if (object.nodeName === gLite.Shape.POLYLINE && object.renderable.proxyNodeName === gLite.Shape.LINE) {
11307
11482
  var _object$parsedStyle3 = object.parsedStyle,
11308
11483
  points = _object$parsedStyle3.points.points,
11309
11484
  _defX3 = _object$parsedStyle3.defX,
@@ -11329,7 +11504,7 @@
11329
11504
  markerStartOffset: markerStartOffset,
11330
11505
  markerEndOffset: markerEndOffset
11331
11506
  };
11332
- } else if (object.nodeName === g.Shape.PATH && object.renderable.proxyNodeName === g.Shape.LINE) {
11507
+ } else if (object.nodeName === gLite.Shape.PATH && object.renderable.proxyNodeName === gLite.Shape.LINE) {
11333
11508
  var _object$parsedStyle4 = object.parsedStyle,
11334
11509
  curve = _object$parsedStyle4.path.curve,
11335
11510
  _defX4 = _object$parsedStyle4.defX,
@@ -11418,7 +11593,7 @@
11418
11593
  var x;
11419
11594
  var y;
11420
11595
 
11421
- if (markerStart && markerStart instanceof g.DisplayObject && markerStartOffset) {
11596
+ if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
11422
11597
  x = x2 - x1;
11423
11598
  y = y2 - y1;
11424
11599
  rad = Math.atan2(y, x);
@@ -11426,7 +11601,7 @@
11426
11601
  startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
11427
11602
  }
11428
11603
 
11429
- if (markerEnd && markerEnd instanceof g.DisplayObject && markerEndOffset) {
11604
+ if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
11430
11605
  x = x1 - x2;
11431
11606
  y = y1 - y2;
11432
11607
  rad = Math.atan2(y, x);
@@ -11474,7 +11649,7 @@
11474
11649
  return InstancedLineMesh;
11475
11650
  }(Instanced);
11476
11651
 
11477
- InstancedLineMesh = __decorate([g.injectable()], InstancedLineMesh);
11652
+ InstancedLineMesh = __decorate([gLite.injectable()], InstancedLineMesh);
11478
11653
  /**
11479
11654
  * 两点之间的距离
11480
11655
  * @param {number} x1 起始点 x
@@ -11938,7 +12113,7 @@
11938
12113
  lineDashOffset = _object$parsedStyle.lineDashOffset,
11939
12114
  visibility = _object$parsedStyle.visibility;
11940
12115
 
11941
- if (name === 'lineJoin' || name === 'lineCap' || name === 'markerStart' || name === 'markerEnd' || name === 'markerStartOffset' || name === 'markerEndOffset' || object.nodeName === g.Shape.CIRCLE && name === 'r' || object.nodeName === g.Shape.ELLIPSE && (name === 'rx' || name === 'ry') || object.nodeName === g.Shape.RECT && (name === 'width' || name === 'height' || name === 'radius') || object.nodeName === g.Shape.LINE && (name === 'x1' || name === 'y1' || name === 'x2' || name === 'y2') || object.nodeName === g.Shape.POLYLINE && name === 'points' || object.nodeName === g.Shape.POLYGON && name === 'points' || object.nodeName === g.Shape.PATH && name === 'path') {
12116
+ if (name === 'lineJoin' || name === 'lineCap' || name === 'markerStart' || name === 'markerEnd' || name === 'markerStartOffset' || name === 'markerEndOffset' || object.nodeName === gLite.Shape.CIRCLE && name === 'r' || object.nodeName === gLite.Shape.ELLIPSE && (name === 'rx' || name === 'ry') || object.nodeName === gLite.Shape.RECT && (name === 'width' || name === 'height' || name === 'radius') || object.nodeName === gLite.Shape.LINE && (name === 'x1' || name === 'y1' || name === 'x2' || name === 'y2') || object.nodeName === gLite.Shape.POLYLINE && name === 'points' || object.nodeName === gLite.Shape.POLYGON && name === 'points' || object.nodeName === gLite.Shape.PATH && name === 'path') {
11942
12117
  // need re-calc geometry
11943
12118
  _this.material.geometryDirty = true;
11944
12119
  _this.material.programDirty = true;
@@ -11947,7 +12122,7 @@
11947
12122
 
11948
12123
  var strokeColor = [0, 0, 0, 0];
11949
12124
 
11950
- if (stroke instanceof g.CSSRGB) {
12125
+ if (stroke instanceof gLite.CSSRGB) {
11951
12126
  strokeColor = [Number(stroke.r) / 255, Number(stroke.g) / 255, Number(stroke.b) / 255, Number(stroke.alpha)];
11952
12127
  }
11953
12128
 
@@ -12042,13 +12217,13 @@
12042
12217
  visibility = _instance$parsedStyle.visibility;
12043
12218
  var fillColor = [0, 0, 0, 0];
12044
12219
 
12045
- if (fill instanceof g.CSSRGB) {
12220
+ if (fill instanceof gLite.CSSRGB) {
12046
12221
  fillColor = [Number(fill.r) / 255, Number(fill.g) / 255, Number(fill.b) / 255, Number(fill.alpha)];
12047
12222
  }
12048
12223
 
12049
12224
  var strokeColor = [0, 0, 0, 0];
12050
12225
 
12051
- if (stroke instanceof g.CSSRGB) {
12226
+ if (stroke instanceof gLite.CSSRGB) {
12052
12227
  strokeColor = [Number(stroke.r) / 255, Number(stroke.g) / 255, Number(stroke.b) / 255, Number(stroke.alpha)];
12053
12228
  }
12054
12229
 
@@ -12150,7 +12325,7 @@
12150
12325
  return LineMesh;
12151
12326
  }(Instanced);
12152
12327
 
12153
- LineMesh = __decorate([g.injectable()], LineMesh);
12328
+ LineMesh = __decorate([gLite.injectable()], LineMesh);
12154
12329
 
12155
12330
  function curveTo(cpX, cpY, cpX2, cpY2, toX, toY, points) {
12156
12331
  var fromX = points[points.length - 2];
@@ -12215,7 +12390,7 @@
12215
12390
  var points = [];
12216
12391
  var triangles = [];
12217
12392
 
12218
- if (object.nodeName === g.Shape.POLYLINE || object.nodeName === g.Shape.POLYGON) {
12393
+ if (object.nodeName === gLite.Shape.POLYLINE || object.nodeName === gLite.Shape.POLYGON) {
12219
12394
  var polylineControlPoints = object.parsedStyle.points.points;
12220
12395
  var length = polylineControlPoints.length;
12221
12396
  var startOffsetX = 0;
@@ -12226,7 +12401,7 @@
12226
12401
  var x;
12227
12402
  var y;
12228
12403
 
12229
- if (markerStart && markerStart instanceof g.DisplayObject && markerStartOffset) {
12404
+ if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
12230
12405
  x = polylineControlPoints[1][0] - polylineControlPoints[0][0];
12231
12406
  y = polylineControlPoints[1][1] - polylineControlPoints[0][1];
12232
12407
  rad = Math.atan2(y, x);
@@ -12234,7 +12409,7 @@
12234
12409
  startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
12235
12410
  }
12236
12411
 
12237
- if (markerEnd && markerEnd instanceof g.DisplayObject && markerEndOffset) {
12412
+ if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
12238
12413
  x = polylineControlPoints[length - 2][0] - polylineControlPoints[length - 1][0];
12239
12414
  y = polylineControlPoints[length - 2][1] - polylineControlPoints[length - 1][1];
12240
12415
  rad = Math.atan2(y, x);
@@ -12258,7 +12433,7 @@
12258
12433
  return prev;
12259
12434
  }, []); // close polygon, dealing with extra joint
12260
12435
 
12261
- if (object.nodeName === g.Shape.POLYGON) {
12436
+ if (object.nodeName === gLite.Shape.POLYGON) {
12262
12437
  if (needEarcut) {
12263
12438
  // use earcut for triangulation
12264
12439
  triangles = earcut_1(points[0], [], 2);
@@ -12276,15 +12451,15 @@
12276
12451
  (_points$ = points[0]).push.apply(_points$, addTailSegment(points[0][0], points[0][1], points[0][2], points[0][3]));
12277
12452
  }
12278
12453
  }
12279
- } else if (object.nodeName === g.Shape.PATH || object.nodeName === g.Shape.CIRCLE || object.nodeName === g.Shape.ELLIPSE || object.nodeName === g.Shape.RECT) {
12454
+ } else if (object.nodeName === gLite.Shape.PATH || object.nodeName === gLite.Shape.CIRCLE || object.nodeName === gLite.Shape.ELLIPSE || object.nodeName === gLite.Shape.RECT) {
12280
12455
  var path;
12281
12456
 
12282
- if (object.nodeName !== g.Shape.PATH) {
12283
- path = g.parsePath(g.convertToPath(object, false), object);
12457
+ if (object.nodeName !== gLite.Shape.PATH) {
12458
+ path = gLite.parsePath(gLite.convertToPath(object, false), object);
12284
12459
  defX = path.rect.x;
12285
12460
  defY = path.rect.y; // support negative width/height of Rect
12286
12461
 
12287
- if (object.nodeName === g.Shape.RECT) {
12462
+ if (object.nodeName === gLite.Shape.RECT) {
12288
12463
  var _object$parsedStyle5 = object.parsedStyle,
12289
12464
  width = _object$parsedStyle5.width,
12290
12465
  height = _object$parsedStyle5.height;
@@ -12318,7 +12493,7 @@
12318
12493
 
12319
12494
  var _y;
12320
12495
 
12321
- if (markerStart && markerStart instanceof g.DisplayObject && markerStartOffset) {
12496
+ if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
12322
12497
  var _markerStart$parentNo = markerStart.parentNode.getStartTangent(),
12323
12498
  p1 = _markerStart$parentNo[0],
12324
12499
  p2 = _markerStart$parentNo[1];
@@ -12330,7 +12505,7 @@
12330
12505
  _startOffsetY = Math.sin(_rad) * (markerStartOffset || 0);
12331
12506
  }
12332
12507
 
12333
- if (markerEnd && markerEnd instanceof g.DisplayObject && markerEndOffset) {
12508
+ if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
12334
12509
  var _markerEnd$parentNode = markerEnd.parentNode.getEndTangent(),
12335
12510
  _p = _markerEnd$parentNode[0],
12336
12511
  _p2 = _markerEnd$parentNode[1];
@@ -12358,7 +12533,7 @@
12358
12533
  var offsetX = i === curve.length - (isClosed ? 2 : 1) ? _endOffsetX : 0;
12359
12534
  var offsetY = i === curve.length - (isClosed ? 2 : 1) ? _endOffsetY : 0;
12360
12535
  curveTo(params[0] - defX, params[1] - defY, params[2] - defX, params[3] - defY, params[4] - defX + offsetX, params[5] - defY + offsetY, points[mCommandsNum]);
12361
- } else if (command === 'Z' && (object.nodeName === g.Shape.PATH || object.nodeName === g.Shape.RECT)) {
12536
+ } else if (command === 'Z' && (object.nodeName === gLite.Shape.PATH || object.nodeName === gLite.Shape.RECT)) {
12362
12537
  var _points$mCommandsNum;
12363
12538
 
12364
12539
  var epsilon = 0.0001; // skip if already closed
@@ -12596,7 +12771,7 @@
12596
12771
  visibility = _instance$parsedStyle.visibility;
12597
12772
  var fillColor = [0, 0, 0, 0];
12598
12773
 
12599
- if (fill instanceof g.CSSRGB) {
12774
+ if (fill instanceof gLite.CSSRGB) {
12600
12775
  fillColor = [Number(fill.r) / 255, Number(fill.g) / 255, Number(fill.b) / 255, Number(fill.alpha)];
12601
12776
  }
12602
12777
 
@@ -12631,12 +12806,12 @@
12631
12806
  anchor = _object$parsedStyle.anchor,
12632
12807
  visibility = _object$parsedStyle.visibility;
12633
12808
 
12634
- if (name === 'lineJoin' || name === 'lineCap' || name === 'markerStart' || name === 'markerEnd' || name === 'markerStartOffset' || name === 'markerEndOffset' || object.nodeName === g.Shape.RECT && (name === 'width' || name === 'height' || name === 'radius') || object.nodeName === g.Shape.LINE && (name === 'x1' || name === 'y1' || name === 'x2' || name === 'y2') || object.nodeName === g.Shape.POLYLINE && name === 'points' || object.nodeName === g.Shape.POLYGON && name === 'points' || object.nodeName === g.Shape.PATH && name === 'path') {
12809
+ if (name === 'lineJoin' || name === 'lineCap' || name === 'markerStart' || name === 'markerEnd' || name === 'markerStartOffset' || name === 'markerEndOffset' || object.nodeName === gLite.Shape.RECT && (name === 'width' || name === 'height' || name === 'radius') || object.nodeName === gLite.Shape.LINE && (name === 'x1' || name === 'y1' || name === 'x2' || name === 'y2') || object.nodeName === gLite.Shape.POLYLINE && name === 'points' || object.nodeName === gLite.Shape.POLYGON && name === 'points' || object.nodeName === gLite.Shape.PATH && name === 'path') {
12635
12810
  // need re-calc geometry
12636
12811
  _this.material.geometryDirty = true;
12637
12812
  _this.material.programDirty = true;
12638
12813
  } else if (name === 'fill') {
12639
- if (fill instanceof g.CSSRGB) {
12814
+ if (fill instanceof gLite.CSSRGB) {
12640
12815
  var _this$material$setUni2;
12641
12816
 
12642
12817
  var fillColor = [Number(fill.r) / 255, Number(fill.g) / 255, Number(fill.b) / 255, Number(fill.alpha)];
@@ -12707,7 +12882,7 @@
12707
12882
  return FillMesh;
12708
12883
  }(Instanced);
12709
12884
 
12710
- FillMesh = __decorate([g.injectable()], FillMesh);
12885
+ FillMesh = __decorate([gLite.injectable()], FillMesh);
12711
12886
  var frag$3 = "#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};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\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\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\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 if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n }\n}"; // eslint-disable-line
12712
12887
 
12713
12888
  var vert$3 = "#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(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Size;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec2 offset = (a_Uv - u_Anchor.xy) * a_Size;\n\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\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}"; // eslint-disable-line
@@ -12816,7 +12991,7 @@
12816
12991
  return ImageMesh;
12817
12992
  }(Instanced);
12818
12993
 
12819
- ImageMesh = __decorate([g.injectable()], ImageMesh);
12994
+ ImageMesh = __decorate([gLite.injectable()], ImageMesh);
12820
12995
  var frag$4 = "#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 vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n\nuniform sampler2D u_SDFMap;\n\n#define SDF_PX 8.0\n\nin vec2 v_UV;\nin float v_GammaScale;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n\n float dist = texture(SAMPLER_2D(u_SDFMap), v_UV).a;\n\n float EDGE_GAMMA = 0.105 / u_DevicePixelRatio;\n float fontScale = u_FontSize / 24.0;\n highp float gamma = EDGE_GAMMA / (fontScale * u_GammaScale);\n lowp vec4 color = u_Color;\n lowp float buff = (256.0 - 64.0) / 256.0;\n float opacity = u_FillOpacity;\n if (u_HasStroke > 0.5 && u_StrokeWidth > 0.0) {\n color = u_StrokeColor;\n gamma = (u_StrokeBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_GammaScale);\n buff = (6.0 - u_StrokeWidth / fontScale / 2.0) / SDF_PX;\n opacity = u_StrokeOpacity;\n }\n\n highp float gamma_scaled = gamma * v_GammaScale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n opacity *= alpha * u_Opacity;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n\n if (opacity < 0.001) {\n discard;\n }\n\n outputColor = color;\n outputColor.a *= opacity;\n }\n}"; // eslint-disable-line
12821
12996
 
12822
12997
  var vert$4 = "#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 vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = TEX) in vec2 a_Tex;\nlayout(location = OFFSET) in vec2 a_Offset;\n\nout vec2 v_UV;\nout float v_GammaScale;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n v_UV = a_Tex / u_SDFMapSize;\n\n float fontScale = u_FontSize / 24.;\n\n gl_Position = project(vec4(a_Offset * fontScale, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n v_GammaScale = gl_Position.w;\n}"; // eslint-disable-line
@@ -13288,7 +13463,7 @@
13288
13463
  return GlyphManager;
13289
13464
  }();
13290
13465
 
13291
- GlyphManager = __decorate([g.injectable()], GlyphManager);
13466
+ GlyphManager = __decorate([gLite.injectable()], GlyphManager);
13292
13467
  /**
13293
13468
  * Create the quads used for rendering a text label.
13294
13469
  */
@@ -13626,13 +13801,13 @@
13626
13801
  visibility = _object$parsedStyle4.visibility;
13627
13802
  var fillColor = [0, 0, 0, 0];
13628
13803
 
13629
- if (fill instanceof g.CSSRGB) {
13804
+ if (fill instanceof gLite.CSSRGB) {
13630
13805
  fillColor = [Number(fill.r) / 255, Number(fill.g) / 255, Number(fill.b) / 255, Number(fill.alpha)];
13631
13806
  }
13632
13807
 
13633
13808
  var strokeColor = [0, 0, 0, 0];
13634
13809
 
13635
- if (stroke instanceof g.CSSRGB) {
13810
+ if (stroke instanceof gLite.CSSRGB) {
13636
13811
  strokeColor = [Number(stroke.r) / 255, Number(stroke.g) / 255, Number(stroke.b) / 255, Number(stroke.alpha)];
13637
13812
  }
13638
13813
 
@@ -13673,9 +13848,9 @@
13673
13848
  return TextMesh;
13674
13849
  }(Instanced);
13675
13850
 
13676
- __decorate([g.inject(GlyphManager), __metadata("design:type", GlyphManager)], TextMesh.prototype, "glyphManager", void 0);
13851
+ __decorate([gLite.inject(GlyphManager)], TextMesh.prototype, "glyphManager", void 0);
13677
13852
 
13678
- TextMesh = __decorate([g.injectable()], TextMesh);
13853
+ TextMesh = __decorate([gLite.injectable()], TextMesh);
13679
13854
 
13680
13855
  var MeshMesh = /*#__PURE__*/function (_Instanced) {
13681
13856
  _inheritsLoose$2(MeshMesh, _Instanced);
@@ -13693,7 +13868,7 @@
13693
13868
  return false;
13694
13869
  }
13695
13870
 
13696
- if (this.instance.nodeName === g.Shape.MESH) {
13871
+ if (this.instance.nodeName === gLite.Shape.MESH) {
13697
13872
  if (this.instance.parsedStyle.material !== object.parsedStyle.material || this.instance.parsedStyle.geometry !== object.parsedStyle.geometry) {
13698
13873
  return false;
13699
13874
  }
@@ -13728,7 +13903,7 @@
13728
13903
  return MeshMesh;
13729
13904
  }(Instanced);
13730
13905
 
13731
- MeshMesh = __decorate([g.injectable()], MeshMesh);
13906
+ MeshMesh = __decorate([gLite.injectable()], MeshMesh);
13732
13907
 
13733
13908
  var MeshUpdater = /*#__PURE__*/function () {
13734
13909
  function MeshUpdater() {}
@@ -13754,10 +13929,10 @@
13754
13929
  return MeshUpdater;
13755
13930
  }();
13756
13931
 
13757
- MeshUpdater = __decorate([g.singleton({
13932
+ MeshUpdater = __decorate([gLite.singleton({
13758
13933
  token: {
13759
- token: g.GeometryAABBUpdater,
13760
- named: g.Shape.MESH
13934
+ token: gLite.GeometryAABBUpdater,
13935
+ named: gLite.Shape.MESH
13761
13936
  }
13762
13937
  })], MeshUpdater);
13763
13938
 
@@ -13799,7 +13974,7 @@
13799
13974
  return PickingIdGenerator;
13800
13975
  }();
13801
13976
 
13802
- PickingIdGenerator = __decorate([g.singleton()], PickingIdGenerator);
13977
+ PickingIdGenerator = __decorate([gLite.singleton()], PickingIdGenerator);
13803
13978
  /**
13804
13979
  * Use 2 meshes:
13805
13980
  * * SDF to draw fill
@@ -13864,13 +14039,13 @@
13864
14039
  return CircleRenderer;
13865
14040
  }(Batch);
13866
14041
 
13867
- CircleRenderer = __decorate([g.injectable({
14042
+ CircleRenderer = __decorate([gLite.injectable({
13868
14043
  token: [{
13869
14044
  token: ShapeRenderer,
13870
- named: g.Shape.CIRCLE
14045
+ named: gLite.Shape.CIRCLE
13871
14046
  }, {
13872
14047
  token: ShapeRenderer,
13873
- named: g.Shape.ELLIPSE
14048
+ named: gLite.Shape.ELLIPSE
13874
14049
  }]
13875
14050
  })], CircleRenderer);
13876
14051
  /**
@@ -13909,9 +14084,9 @@
13909
14084
  return item !== 0;
13910
14085
  });
13911
14086
  var isLine = this.isLine(object);
13912
- object.renderable.proxyNodeName = isLine ? g.Shape.LINE : null; // Polyline don't need fill
14087
+ object.renderable.proxyNodeName = isLine ? gLite.Shape.LINE : null; // Polyline don't need fill
13913
14088
 
13914
- if (index === 0 && (object.nodeName === g.Shape.POLYLINE || fill.isNone)) {
14089
+ if (index === 0 && (object.nodeName === gLite.Shape.POLYLINE || fill.isNone)) {
13915
14090
  return false;
13916
14091
  } // stroke mesh
13917
14092
 
@@ -13921,7 +14096,7 @@
13921
14096
  return false;
13922
14097
  }
13923
14098
 
13924
- if (nodeName === g.Shape.CIRCLE || nodeName === g.Shape.ELLIPSE) {
14099
+ if (nodeName === gLite.Shape.CIRCLE || nodeName === gLite.Shape.ELLIPSE) {
13925
14100
  // @see https://github.com/antvis/g/issues/824
13926
14101
  return hasDash;
13927
14102
  }
@@ -13936,7 +14111,7 @@
13936
14111
  };
13937
14112
 
13938
14113
  _proto.isLine = function isLine(object) {
13939
- if (object.nodeName === g.Shape.PATH) {
14114
+ if (object.nodeName === gLite.Shape.PATH) {
13940
14115
  var curve = object.parsedStyle.path.curve;
13941
14116
  var eps = 0.01; // only contains M & L commands
13942
14117
 
@@ -13958,7 +14133,7 @@
13958
14133
  var tangent = (p1x - p2x) / (p1y - p2y);
13959
14134
  return (p1x - cpx1) / (p1y - cpy1) - tangent < eps && (cpx2 - p2x) / (cpy2 - p2y) - tangent < eps;
13960
14135
  }
13961
- } else if (object.nodeName === g.Shape.POLYLINE) {
14136
+ } else if (object.nodeName === gLite.Shape.POLYLINE) {
13962
14137
  var points = object.parsedStyle.points.points;
13963
14138
 
13964
14139
  var _tangent = (points[1][0] - points[1][1]) / (points[0][0] - points[0][1]);
@@ -13978,19 +14153,19 @@
13978
14153
  return PathRenderer;
13979
14154
  }(Batch);
13980
14155
 
13981
- PathRenderer = __decorate([g.injectable({
14156
+ PathRenderer = __decorate([gLite.injectable({
13982
14157
  token: [{
13983
14158
  token: ShapeRenderer,
13984
- named: g.Shape.POLYLINE
14159
+ named: gLite.Shape.POLYLINE
13985
14160
  }, {
13986
14161
  token: ShapeRenderer,
13987
- named: g.Shape.PATH
14162
+ named: gLite.Shape.PATH
13988
14163
  }, {
13989
14164
  token: ShapeRenderer,
13990
- named: g.Shape.POLYGON
14165
+ named: gLite.Shape.POLYGON
13991
14166
  }, {
13992
14167
  token: ShapeRenderer,
13993
- named: g.Shape.RECT
14168
+ named: gLite.Shape.RECT
13994
14169
  }]
13995
14170
  })], PathRenderer); // @injectable({
13996
14171
  // token: [{ token: ShapeMesh, named: Shape.GROUP }],
@@ -14025,10 +14200,10 @@
14025
14200
  return GroupRenderer;
14026
14201
  }(Batch);
14027
14202
 
14028
- GroupRenderer = __decorate([g.injectable({
14203
+ GroupRenderer = __decorate([gLite.injectable({
14029
14204
  token: [{
14030
14205
  token: ShapeRenderer,
14031
- named: g.Shape.GROUP
14206
+ named: gLite.Shape.GROUP
14032
14207
  }]
14033
14208
  })], GroupRenderer);
14034
14209
 
@@ -14056,10 +14231,10 @@
14056
14231
  return ImageRenderer;
14057
14232
  }(Batch);
14058
14233
 
14059
- ImageRenderer = __decorate([g.injectable({
14234
+ ImageRenderer = __decorate([gLite.injectable({
14060
14235
  token: [{
14061
14236
  token: ShapeRenderer,
14062
- named: g.Shape.IMAGE
14237
+ named: gLite.Shape.IMAGE
14063
14238
  }]
14064
14239
  })], ImageRenderer);
14065
14240
 
@@ -14103,10 +14278,10 @@
14103
14278
  return TextRenderer;
14104
14279
  }(Batch);
14105
14280
 
14106
- TextRenderer = __decorate([g.injectable({
14281
+ TextRenderer = __decorate([gLite.injectable({
14107
14282
  token: [{
14108
14283
  token: ShapeRenderer,
14109
- named: g.Shape.TEXT
14284
+ named: gLite.Shape.TEXT
14110
14285
  }]
14111
14286
  })], TextRenderer);
14112
14287
  /**
@@ -14141,10 +14316,10 @@
14141
14316
  return LineRenderer;
14142
14317
  }(Batch);
14143
14318
 
14144
- LineRenderer = __decorate([g.injectable({
14319
+ LineRenderer = __decorate([gLite.injectable({
14145
14320
  token: {
14146
14321
  token: ShapeRenderer,
14147
- named: g.Shape.LINE
14322
+ named: gLite.Shape.LINE
14148
14323
  }
14149
14324
  })], LineRenderer);
14150
14325
 
@@ -14166,13 +14341,13 @@
14166
14341
  return MeshRenderer;
14167
14342
  }(Batch);
14168
14343
 
14169
- MeshRenderer = __decorate([g.injectable({
14344
+ MeshRenderer = __decorate([gLite.injectable({
14170
14345
  token: [{
14171
14346
  token: ShapeRenderer,
14172
- named: g.Shape.MESH
14347
+ named: gLite.Shape.MESH
14173
14348
  }]
14174
14349
  })], MeshRenderer);
14175
- var DeviceContribution = g.Syringe.defineToken('');
14350
+ var DeviceContribution = gLite.Syringe.defineToken('');
14176
14351
  var _excluded$1 = ["style"];
14177
14352
 
14178
14353
  var Light = /*#__PURE__*/function (_DisplayObject) {
@@ -14192,7 +14367,7 @@
14192
14367
  }
14193
14368
 
14194
14369
  return Light;
14195
- }(g.DisplayObject);
14370
+ }(gLite.DisplayObject);
14196
14371
 
14197
14372
  Light.tag = 'light';
14198
14373
  var _excluded$2 = ["style"];
@@ -14226,7 +14401,7 @@
14226
14401
  }
14227
14402
 
14228
14403
  return Fog;
14229
- }(g.DisplayObject);
14404
+ }(gLite.DisplayObject);
14230
14405
 
14231
14406
  Fog.tag = 'fog';
14232
14407
 
@@ -14248,7 +14423,7 @@
14248
14423
  })(SceneUniform || (SceneUniform = {}));
14249
14424
 
14250
14425
  var RenderGraphPlugin = RenderGraphPlugin_1 = (_class$1 = /*#__PURE__*/function () {
14251
- function RenderGraphPlugin() {
14426
+ function RenderGraphPlugin(canvasConfig, contextService, renderingContext, camera, renderHelper, lightPool, texturePool, batchManager, deviceContribution) {
14252
14427
  this.canvasConfig = void 0;
14253
14428
  this.contextService = void 0;
14254
14429
  this.renderingContext = void 0;
@@ -14276,6 +14451,15 @@
14276
14451
  this.captureOptions = void 0;
14277
14452
  this.capturePromise = void 0;
14278
14453
  this.resolveCapturePromise = void 0;
14454
+ this.canvasConfig = canvasConfig;
14455
+ this.contextService = contextService;
14456
+ this.renderingContext = renderingContext;
14457
+ this.camera = camera;
14458
+ this.renderHelper = renderHelper;
14459
+ this.lightPool = lightPool;
14460
+ this.texturePool = texturePool;
14461
+ this.batchManager = batchManager;
14462
+ this.deviceContribution = deviceContribution;
14279
14463
  }
14280
14464
 
14281
14465
  var _proto = RenderGraphPlugin.prototype;
@@ -14373,15 +14557,15 @@
14373
14557
  while (1) {
14374
14558
  switch (_context.prev = _context.next) {
14375
14559
  case 0:
14376
- _this.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED, handleMounted);
14560
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
14377
14561
 
14378
- _this.renderingContext.root.addEventListener(g.ElementEvent.UNMOUNTED, handleUnmounted);
14562
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
14379
14563
 
14380
- _this.renderingContext.root.addEventListener(g.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
14564
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
14381
14565
 
14382
- _this.renderingContext.root.addEventListener(g.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
14566
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
14383
14567
 
14384
- _this.renderingContext.root.addEventListener(g.ElementEvent.RENDER_ORDER_CHANGED, handleRenderOrderChanged);
14568
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.RENDER_ORDER_CHANGED, handleRenderOrderChanged);
14385
14569
 
14386
14570
  _this.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering = false;
14387
14571
  $canvas = _this.contextService.getDomElement();
@@ -14403,7 +14587,7 @@
14403
14587
 
14404
14588
  _this.swapChain.configureSwapChain($canvas.width, $canvas.height);
14405
14589
 
14406
- _this.renderingContext.root.ownerDocument.defaultView.addEventListener(g.CanvasEvent.RESIZE, function () {
14590
+ _this.renderingContext.root.ownerDocument.defaultView.addEventListener(gLite.CanvasEvent.RESIZE, function () {
14407
14591
  _this.swapChain.configureSwapChain($canvas.width, $canvas.height);
14408
14592
  });
14409
14593
 
@@ -14419,15 +14603,15 @@
14419
14603
  renderingService.hooks.destroy.tap(RenderGraphPlugin_1.tag, function () {
14420
14604
  _this.renderHelper.destroy();
14421
14605
 
14422
- _this.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED, handleMounted);
14606
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
14423
14607
 
14424
- _this.renderingContext.root.removeEventListener(g.ElementEvent.UNMOUNTED, handleUnmounted);
14608
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
14425
14609
 
14426
- _this.renderingContext.root.removeEventListener(g.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
14610
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
14427
14611
 
14428
- _this.renderingContext.root.removeEventListener(g.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
14612
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
14429
14613
 
14430
- _this.renderingContext.root.removeEventListener(g.ElementEvent.RENDER_ORDER_CHANGED, handleRenderOrderChanged);
14614
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.RENDER_ORDER_CHANGED, handleRenderOrderChanged);
14431
14615
  });
14432
14616
  /**
14433
14617
  * build frame graph at the beginning of each frame
@@ -14442,7 +14626,7 @@
14442
14626
  var renderInstManager = _this.renderHelper.renderInstManager;
14443
14627
  _this.builder = _this.renderHelper.renderGraph.newGraphBuilder(); // use canvas.background
14444
14628
 
14445
- var backgroundColor = g.parseColor(_this.canvasConfig.background);
14629
+ var backgroundColor = gLite.parseColor(_this.canvasConfig.background);
14446
14630
  var clearColor = _this.canvasConfig.background ? // use premultipliedAlpha
14447
14631
  // @see https://canvatechblog.com/alpha-blending-and-webgl-99feb392779e
14448
14632
  colorNewFromRGBA(Number(backgroundColor.r) / 255 * Number(backgroundColor.alpha), Number(backgroundColor.g) / 255 * Number(backgroundColor.alpha), Number(backgroundColor.b) / 255 * Number(backgroundColor.alpha), Number(backgroundColor.alpha)) : TransparentBlack; // retrieve at each frame since canvas may resize
@@ -14606,28 +14790,9 @@
14606
14790
 
14607
14791
  return RenderGraphPlugin;
14608
14792
  }(), _class$1.tag = 'RenderGraph', _class$1);
14609
-
14610
- __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], RenderGraphPlugin.prototype, "canvasConfig", void 0);
14611
-
14612
- __decorate([g.inject(g.ContextService), __metadata("design:type", Object)], RenderGraphPlugin.prototype, "contextService", void 0);
14613
-
14614
- __decorate([g.inject(g.RenderingContext), __metadata("design:type", Object)], RenderGraphPlugin.prototype, "renderingContext", void 0);
14615
-
14616
- __decorate([g.inject(g.DefaultCamera), __metadata("design:type", g.Camera)], RenderGraphPlugin.prototype, "camera", void 0);
14617
-
14618
- __decorate([g.inject(RenderHelper), __metadata("design:type", RenderHelper)], RenderGraphPlugin.prototype, "renderHelper", void 0);
14619
-
14620
- __decorate([g.inject(LightPool), __metadata("design:type", LightPool)], RenderGraphPlugin.prototype, "lightPool", void 0);
14621
-
14622
- __decorate([g.inject(TexturePool), __metadata("design:type", TexturePool)], RenderGraphPlugin.prototype, "texturePool", void 0);
14623
-
14624
- __decorate([g.inject(BatchManager), __metadata("design:type", BatchManager)], RenderGraphPlugin.prototype, "batchManager", void 0);
14625
-
14626
- __decorate([g.inject(DeviceContribution), __metadata("design:type", Object)], RenderGraphPlugin.prototype, "deviceContribution", void 0);
14627
-
14628
- RenderGraphPlugin = RenderGraphPlugin_1 = __decorate([g.singleton({
14629
- contrib: g.RenderingPluginContribution
14630
- })], RenderGraphPlugin);
14793
+ RenderGraphPlugin = RenderGraphPlugin_1 = __decorate([gLite.singleton({
14794
+ contrib: gLite.RenderingPluginContribution
14795
+ }), __param(0, gLite.inject(gLite.CanvasConfig)), __param(1, gLite.inject(gLite.ContextService)), __param(2, gLite.inject(gLite.RenderingContext)), __param(3, gLite.inject(gLite.DefaultCamera)), __param(4, gLite.inject(RenderHelper)), __param(5, gLite.inject(LightPool)), __param(6, gLite.inject(TexturePool)), __param(7, gLite.inject(BatchManager)), __param(8, gLite.inject(DeviceContribution))], RenderGraphPlugin);
14631
14796
 
14632
14797
  var _class$1$1;
14633
14798
 
@@ -14642,7 +14807,7 @@
14642
14807
  */
14643
14808
 
14644
14809
  var PickingPlugin = PickingPlugin_1 = (_class$1$1 = /*#__PURE__*/function () {
14645
- function PickingPlugin() {
14810
+ function PickingPlugin(canvasConfig, sceneGraphService, contextService, renderingContext, renderHelper, renderGraphPlugin, pickingIdGenerator, camera, batchManager) {
14646
14811
  this.canvasConfig = void 0;
14647
14812
  this.sceneGraphService = void 0;
14648
14813
  this.contextService = void 0;
@@ -14652,6 +14817,15 @@
14652
14817
  this.pickingIdGenerator = void 0;
14653
14818
  this.camera = void 0;
14654
14819
  this.batchManager = void 0;
14820
+ this.canvasConfig = canvasConfig;
14821
+ this.sceneGraphService = sceneGraphService;
14822
+ this.contextService = contextService;
14823
+ this.renderingContext = renderingContext;
14824
+ this.renderHelper = renderHelper;
14825
+ this.renderGraphPlugin = renderGraphPlugin;
14826
+ this.pickingIdGenerator = pickingIdGenerator;
14827
+ this.camera = camera;
14828
+ this.batchManager = batchManager;
14655
14829
  }
14656
14830
 
14657
14831
  var _proto = PickingPlugin.prototype;
@@ -14678,7 +14852,7 @@
14678
14852
  while (1) {
14679
14853
  switch (_context.prev = _context.next) {
14680
14854
  case 0:
14681
- _this.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED, handleMounted);
14855
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
14682
14856
 
14683
14857
  case 1:
14684
14858
  case "end":
@@ -14688,7 +14862,7 @@
14688
14862
  }, _callee);
14689
14863
  })));
14690
14864
  renderingService.hooks.destroy.tap(PickingPlugin_1.tag, function () {
14691
- _this.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED, handleMounted);
14865
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
14692
14866
  });
14693
14867
  renderingService.hooks.pick.tapPromise(PickingPlugin_1.tag, /*#__PURE__*/function () {
14694
14868
  var _ref2 = _asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee2(result) {
@@ -14716,7 +14890,7 @@
14716
14890
 
14717
14891
  case 10:
14718
14892
  _context2.next = 12;
14719
- return _this.pickByRectangleInDepth(new g.Rectangle(g.clamp(Math.round(xInDevicePixel), 0, width - 1), g.clamp(Math.round(yInDevicePixel), 0, height - 1), 1, 1), topmost ? 1 : MAX_PICKING_DEPTH);
14893
+ return _this.pickByRectangleInDepth(new gLite.Rectangle(clamp(Math.round(xInDevicePixel), 0, width - 1), clamp(Math.round(yInDevicePixel), 0, height - 1), 1, 1), topmost ? 1 : MAX_PICKING_DEPTH);
14720
14894
 
14721
14895
  case 12:
14722
14896
  pickedDisplayObjects = _context2.sent;
@@ -14957,28 +15131,9 @@
14957
15131
 
14958
15132
  return PickingPlugin;
14959
15133
  }(), _class$1$1.tag = 'WebGLPicker', _class$1$1);
14960
-
14961
- __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], PickingPlugin.prototype, "canvasConfig", void 0);
14962
-
14963
- __decorate([g.inject(g.SceneGraphService), __metadata("design:type", Object)], PickingPlugin.prototype, "sceneGraphService", void 0);
14964
-
14965
- __decorate([g.inject(g.ContextService), __metadata("design:type", Object)], PickingPlugin.prototype, "contextService", void 0);
14966
-
14967
- __decorate([g.inject(g.RenderingContext), __metadata("design:type", Object)], PickingPlugin.prototype, "renderingContext", void 0);
14968
-
14969
- __decorate([g.inject(RenderHelper), __metadata("design:type", RenderHelper)], PickingPlugin.prototype, "renderHelper", void 0);
14970
-
14971
- __decorate([g.inject(RenderGraphPlugin), __metadata("design:type", RenderGraphPlugin)], PickingPlugin.prototype, "renderGraphPlugin", void 0);
14972
-
14973
- __decorate([g.inject(PickingIdGenerator), __metadata("design:type", PickingIdGenerator)], PickingPlugin.prototype, "pickingIdGenerator", void 0);
14974
-
14975
- __decorate([g.inject(g.DefaultCamera), __metadata("design:type", g.Camera)], PickingPlugin.prototype, "camera", void 0);
14976
-
14977
- __decorate([g.inject(BatchManager), __metadata("design:type", BatchManager)], PickingPlugin.prototype, "batchManager", void 0);
14978
-
14979
- PickingPlugin = PickingPlugin_1 = __decorate([g.singleton({
14980
- contrib: g.RenderingPluginContribution
14981
- })], PickingPlugin);
15134
+ PickingPlugin = PickingPlugin_1 = __decorate([gLite.singleton({
15135
+ contrib: gLite.RenderingPluginContribution
15136
+ }), __param(0, gLite.inject(gLite.CanvasConfig)), __param(1, gLite.inject(gLite.SceneGraphService)), __param(2, gLite.inject(gLite.ContextService)), __param(3, gLite.inject(gLite.RenderingContext)), __param(4, gLite.inject(RenderHelper)), __param(5, gLite.inject(RenderGraphPlugin)), __param(6, gLite.inject(PickingIdGenerator)), __param(7, gLite.inject(gLite.DefaultCamera)), __param(8, gLite.inject(BatchManager))], PickingPlugin);
14982
15137
  var vert$5 = "#define GLSLIFY 1\nlayout(location = 0) in vec2 a_Position;\n\nout vec2 v_TexCoord;\n\nvoid main() {\n v_TexCoord = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n\n #ifdef VIEWPORT_ORIGIN_TL\n v_TexCoord.y = 1.0 - v_TexCoord.y;\n #endif\n}"; // eslint-disable-line
14983
15138
 
14984
15139
  var frag$5 = "#define GLSLIFY 1\nuniform sampler2D u_Texture;\nin vec2 v_TexCoord;\n\nout vec4 outputColor;\n\nvoid main() {\n outputColor = texture(SAMPLER_2D(u_Texture), v_TexCoord);\n}"; // eslint-disable-line
@@ -15150,7 +15305,7 @@
15150
15305
  });
15151
15306
  }
15152
15307
 
15153
- var containerModule$1 = g.Module(function (register) {
15308
+ var containerModule$1 = gLite.Module(function (register) {
15154
15309
  register(RenderHelper);
15155
15310
  register(TexturePool);
15156
15311
  register(LightPool);
@@ -15224,16 +15379,16 @@
15224
15379
  var _proto = Plugin.prototype;
15225
15380
 
15226
15381
  _proto.init = function init() {
15227
- if (!g.GlobalContainer.isBound(MeshUpdater)) {
15228
- g.GlobalContainer.register(MeshUpdater);
15382
+ if (!gLite.GlobalContainer.isBound(MeshUpdater)) {
15383
+ gLite.GlobalContainer.register(MeshUpdater);
15229
15384
  }
15230
15385
 
15231
15386
  this.container.load(containerModule$1, true);
15232
15387
  };
15233
15388
 
15234
15389
  _proto.destroy = function destroy() {
15235
- if (g.GlobalContainer.isBound(MeshUpdater)) {
15236
- g.GlobalContainer.remove(MeshUpdater);
15390
+ if (gLite.GlobalContainer.isBound(MeshUpdater)) {
15391
+ gLite.GlobalContainer.remove(MeshUpdater);
15237
15392
  }
15238
15393
 
15239
15394
  this.container.unload(containerModule$1);
@@ -15252,7 +15407,7 @@
15252
15407
  };
15253
15408
 
15254
15409
  return Plugin;
15255
- }(g.AbstractRendererPlugin);
15410
+ }(gLite.AbstractRendererPlugin);
15256
15411
 
15257
15412
  var index_esm = /*#__PURE__*/Object.freeze({
15258
15413
  __proto__: null,
@@ -15861,9 +16016,11 @@
15861
16016
  */
15862
16017
 
15863
16018
  var DOMInteractionPlugin = DOMInteractionPlugin_1 = (_class$2 = /*#__PURE__*/function () {
15864
- function DOMInteractionPlugin() {
16019
+ function DOMInteractionPlugin(contextService, renderingContext) {
15865
16020
  this.contextService = void 0;
15866
16021
  this.renderingContext = void 0;
16022
+ this.contextService = contextService;
16023
+ this.renderingContext = renderingContext;
15867
16024
  }
15868
16025
 
15869
16026
  var _proto = DOMInteractionPlugin.prototype;
@@ -16017,15 +16174,10 @@
16017
16174
 
16018
16175
  return DOMInteractionPlugin;
16019
16176
  }(), _class$2.tag = 'DOMInteraction', _class$2);
16020
-
16021
- __decorate([g.inject(g.ContextService), __metadata("design:type", Object)], DOMInteractionPlugin.prototype, "contextService", void 0);
16022
-
16023
- __decorate([g.inject(g.RenderingContext), __metadata("design:type", Object)], DOMInteractionPlugin.prototype, "renderingContext", void 0);
16024
-
16025
- DOMInteractionPlugin = DOMInteractionPlugin_1 = __decorate([g.singleton({
16026
- contrib: g.RenderingPluginContribution
16027
- })], DOMInteractionPlugin);
16028
- var containerModule$2 = g.Module(function (register) {
16177
+ DOMInteractionPlugin = DOMInteractionPlugin_1 = __decorate([gLite.singleton({
16178
+ contrib: gLite.RenderingPluginContribution
16179
+ }), __param(0, gLite.inject(gLite.ContextService)), __param(1, gLite.inject(gLite.RenderingContext))], DOMInteractionPlugin);
16180
+ var containerModule$2 = gLite.Module(function (register) {
16029
16181
  register(DOMInteractionPlugin);
16030
16182
  });
16031
16183
 
@@ -16055,7 +16207,7 @@
16055
16207
  };
16056
16208
 
16057
16209
  return Plugin;
16058
- }(g.AbstractRendererPlugin);
16210
+ }(gLite.AbstractRendererPlugin);
16059
16211
 
16060
16212
  var index_esm$1 = /*#__PURE__*/Object.freeze({
16061
16213
  __proto__: null,
@@ -16463,16 +16615,161 @@
16463
16615
  return _setPrototypeOf$4(o, p);
16464
16616
  }
16465
16617
 
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
+
16466
16760
  var _class$3;
16467
16761
 
16468
16762
  var HTMLRenderingPlugin_1;
16469
16763
  var HTML_PREFIX = 'g-html-';
16470
16764
  var HTMLRenderingPlugin = HTMLRenderingPlugin_1 = (_class$3 = /*#__PURE__*/function () {
16471
- function HTMLRenderingPlugin() {
16765
+ function HTMLRenderingPlugin(contextService, renderingContext, canvasConfig) {
16472
16766
  this.contextService = void 0;
16473
16767
  this.renderingContext = void 0;
16474
16768
  this.canvasConfig = void 0;
16475
16769
  this.$camera = void 0;
16770
+ this.contextService = contextService;
16771
+ this.renderingContext = renderingContext;
16772
+ this.canvasConfig = canvasConfig;
16476
16773
  }
16477
16774
 
16478
16775
  var _proto = HTMLRenderingPlugin.prototype;
@@ -16488,7 +16785,7 @@
16488
16785
  var handleMounted = function handleMounted(e) {
16489
16786
  var object = e.target;
16490
16787
 
16491
- if (object.nodeName === g.Shape.HTML) {
16788
+ if (object.nodeName === gLite.Shape.HTML) {
16492
16789
  var $el = _this.getOrCreateEl(object); // apply documentElement's style
16493
16790
 
16494
16791
 
@@ -16506,7 +16803,7 @@
16506
16803
  var handleUnmounted = function handleUnmounted(e) {
16507
16804
  var object = e.target;
16508
16805
 
16509
- if (object.nodeName === g.Shape.HTML) {
16806
+ if (object.nodeName === gLite.Shape.HTML) {
16510
16807
  var existedId = _this.getId(object);
16511
16808
 
16512
16809
  var $container = _this.contextService.getDomElement().parentNode;
@@ -16524,7 +16821,7 @@
16524
16821
  var handleAttributeChanged = function handleAttributeChanged(e) {
16525
16822
  var object = e.target;
16526
16823
 
16527
- if (object.nodeName === g.Shape.HTML) {
16824
+ if (object.nodeName === gLite.Shape.HTML) {
16528
16825
  var attrName = e.attrName;
16529
16826
 
16530
16827
  _this.updateAttribute(attrName, object);
@@ -16534,7 +16831,7 @@
16534
16831
  var handleBoundsChanged = function handleBoundsChanged(e) {
16535
16832
  var object = e.target;
16536
16833
 
16537
- if (object.nodeName === g.Shape.HTML) {
16834
+ if (object.nodeName === gLite.Shape.HTML) {
16538
16835
  var $el = _this.getOrCreateEl(object);
16539
16836
 
16540
16837
  setTransform(object, $el);
@@ -16546,13 +16843,13 @@
16546
16843
  while (1) {
16547
16844
  switch (_context.prev = _context.next) {
16548
16845
  case 0:
16549
- _this.renderingContext.root.addEventListener(g.ElementEvent.MOUNTED, handleMounted);
16846
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
16550
16847
 
16551
- _this.renderingContext.root.addEventListener(g.ElementEvent.UNMOUNTED, handleUnmounted);
16848
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
16552
16849
 
16553
- _this.renderingContext.root.addEventListener(g.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
16850
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
16554
16851
 
16555
- _this.renderingContext.root.addEventListener(g.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
16852
+ _this.renderingContext.root.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
16556
16853
 
16557
16854
  case 4:
16558
16855
  case "end":
@@ -16562,13 +16859,13 @@
16562
16859
  }, _callee);
16563
16860
  })));
16564
16861
  renderingService.hooks.destroy.tap(HTMLRenderingPlugin_1.tag, function () {
16565
- _this.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED, handleMounted);
16862
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
16566
16863
 
16567
- _this.renderingContext.root.removeEventListener(g.ElementEvent.UNMOUNTED, handleUnmounted);
16864
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
16568
16865
 
16569
- _this.renderingContext.root.removeEventListener(g.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
16866
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
16570
16867
 
16571
- _this.renderingContext.root.removeEventListener(g.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
16868
+ _this.renderingContext.root.removeEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
16572
16869
  });
16573
16870
  };
16574
16871
 
@@ -16579,7 +16876,8 @@
16579
16876
  _proto.getOrCreateEl = function getOrCreateEl(object) {
16580
16877
  var doc = this.canvasConfig.document;
16581
16878
  var existedId = this.getId(object);
16582
- var $container = this.contextService.getDomElement().parentNode;
16879
+ var $canvas = this.contextService.getDomElement();
16880
+ var $container = $canvas.parentNode;
16583
16881
 
16584
16882
  if ($container) {
16585
16883
  var $existedElement = $container.querySelector('#' + existedId);
@@ -16599,9 +16897,10 @@
16599
16897
 
16600
16898
  $container.appendChild($existedElement); // use absolute position
16601
16899
 
16602
- $existedElement.style.position = 'absolute';
16603
- $existedElement.style.left = '0';
16604
- $existedElement.style.top = '0';
16900
+ $existedElement.style.position = 'absolute'; // @see https://github.com/antvis/G/issues/1150
16901
+
16902
+ $existedElement.style.left = ($canvas.offsetLeft || 0) + "px";
16903
+ $existedElement.style.top = ($canvas.offsetTop || 0) + "px";
16605
16904
  $existedElement.style['will-change'] = 'transform';
16606
16905
  var worldTransform = object.getWorldTransform();
16607
16906
  $existedElement.style.transform = "matrix(" + [worldTransform[0], worldTransform[1], worldTransform[4], worldTransform[5], worldTransform[12], worldTransform[13]].join(',') + ")";
@@ -16620,7 +16919,7 @@
16620
16919
  case 'innerHTML':
16621
16920
  var innerHTML = object.parsedStyle.innerHTML;
16622
16921
 
16623
- if (g.isString(innerHTML)) {
16922
+ if (isString$2(innerHTML)) {
16624
16923
  $el.innerHTML = innerHTML;
16625
16924
  } else {
16626
16925
  $el.innerHTML = '';
@@ -16668,7 +16967,7 @@
16668
16967
  var fill = object.parsedStyle.fill;
16669
16968
  var color = '';
16670
16969
 
16671
- if (fill instanceof g.CSSRGB) {
16970
+ if (fill instanceof gLite.CSSRGB) {
16672
16971
  if (fill.isNone) {
16673
16972
  color = 'transparent';
16674
16973
  } else {
@@ -16676,7 +16975,7 @@
16676
16975
  }
16677
16976
  } else if (Array.isArray(fill)) {
16678
16977
  color = object.getAttribute('fill');
16679
- } else if (g.isPattern(fill)) ;
16978
+ } else if (gLite.isPattern(fill)) ;
16680
16979
 
16681
16980
  $el.style.background = color;
16682
16981
  break;
@@ -16685,7 +16984,7 @@
16685
16984
  var stroke = object.parsedStyle.stroke;
16686
16985
  var borderColor = '';
16687
16986
 
16688
- if (stroke instanceof g.CSSRGB) {
16987
+ if (stroke instanceof gLite.CSSRGB) {
16689
16988
  if (stroke.isNone) {
16690
16989
  borderColor = 'transparent';
16691
16990
  } else {
@@ -16693,7 +16992,7 @@
16693
16992
  }
16694
16993
  } else if (Array.isArray(stroke)) {
16695
16994
  borderColor = object.getAttribute('stroke');
16696
- } else if (g.isPattern(stroke)) ;
16995
+ } else if (gLite.isPattern(stroke)) ;
16697
16996
 
16698
16997
  $el.style['border-color'] = borderColor;
16699
16998
  $el.style['border-style'] = 'solid';
@@ -16717,17 +17016,10 @@
16717
17016
 
16718
17017
  return HTMLRenderingPlugin;
16719
17018
  }(), _class$3.tag = 'HTMLRendering', _class$3);
16720
-
16721
- __decorate([g.inject(g.ContextService), __metadata("design:type", Object)], HTMLRenderingPlugin.prototype, "contextService", void 0);
16722
-
16723
- __decorate([g.inject(g.RenderingContext), __metadata("design:type", Object)], HTMLRenderingPlugin.prototype, "renderingContext", void 0);
16724
-
16725
- __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], HTMLRenderingPlugin.prototype, "canvasConfig", void 0);
16726
-
16727
- HTMLRenderingPlugin = HTMLRenderingPlugin_1 = __decorate([g.singleton({
16728
- contrib: g.RenderingPluginContribution
16729
- })], HTMLRenderingPlugin);
16730
- var containerModule$3 = g.Module(function (register) {
17019
+ HTMLRenderingPlugin = HTMLRenderingPlugin_1 = __decorate([gLite.singleton({
17020
+ contrib: gLite.RenderingPluginContribution
17021
+ }), __param(0, gLite.inject(gLite.ContextService)), __param(1, gLite.inject(gLite.RenderingContext)), __param(2, gLite.inject(gLite.CanvasConfig))], HTMLRenderingPlugin);
17022
+ var containerModule$3 = gLite.Module(function (register) {
16731
17023
  register(HTMLRenderingPlugin);
16732
17024
  });
16733
17025
 
@@ -16757,7 +17049,7 @@
16757
17049
  };
16758
17050
 
16759
17051
  return Plugin;
16760
- }(g.AbstractRendererPlugin);
17052
+ }(gLite.AbstractRendererPlugin);
16761
17053
 
16762
17054
  var index_esm$2 = /*#__PURE__*/Object.freeze({
16763
17055
  __proto__: null,
@@ -17190,7 +17482,7 @@
17190
17482
  return self;
17191
17483
  }
17192
17484
 
17193
- var WebGPUDeviceOptions = g.Syringe.defineToken('');
17485
+ var WebGPUDeviceOptions = gLite.Syringe.defineToken('');
17194
17486
  var wasm;
17195
17487
  var cachedTextDecoder = new TextDecoder('utf-8', {
17196
17488
  ignoreBOM: true,
@@ -18161,6 +18453,157 @@
18161
18453
  return ComputePipeline_WebGPU;
18162
18454
  }(ResourceBase_WebGPU);
18163
18455
 
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
+
18164
18607
  var InputLayout_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
18165
18608
  _inheritsLoose$5(InputLayout_WebGPU, _ResourceBase_WebGPU);
18166
18609
 
@@ -18181,7 +18624,7 @@
18181
18624
 
18182
18625
  for (var i = 0; i < descriptor.vertexBufferDescriptors.length; i++) {
18183
18626
  var b = descriptor.vertexBufferDescriptors[i];
18184
- if (g.isNil(b)) continue;
18627
+ if (isNil$1(b)) continue;
18185
18628
  var arrayStride = b.byteStride;
18186
18629
  var stepMode = translateVertexBufferFrequency(b.frequency);
18187
18630
  var attributes = [];
@@ -18869,7 +19312,7 @@
18869
19312
 
18870
19313
  for (var i = 0; i < inputState.vertexBuffers.length; i++) {
18871
19314
  var b = inputState.vertexBuffers[i];
18872
- if (g.isNil(b)) continue;
19315
+ if (isNil$1(b)) continue;
18873
19316
  this.gpuRenderPassEncoder.setVertexBuffer(i, getPlatformBuffer(b.buffer), b.byteOffset);
18874
19317
  }
18875
19318
  };
@@ -19676,8 +20119,9 @@
19676
20119
  }();
19677
20120
 
19678
20121
  var WebGPUDeviceContribution = /*#__PURE__*/function () {
19679
- function WebGPUDeviceContribution() {
20122
+ function WebGPUDeviceContribution(pluginOptions) {
19680
20123
  this.pluginOptions = void 0;
20124
+ this.pluginOptions = pluginOptions;
19681
20125
  }
19682
20126
 
19683
20127
  var _proto = WebGPUDeviceContribution.prototype;
@@ -19786,12 +20230,10 @@
19786
20230
  return WebGPUDeviceContribution;
19787
20231
  }();
19788
20232
 
19789
- __decorate([g.inject(WebGPUDeviceOptions), __metadata("design:type", Object)], WebGPUDeviceContribution.prototype, "pluginOptions", void 0);
19790
-
19791
- WebGPUDeviceContribution = __decorate([g.singleton({
20233
+ WebGPUDeviceContribution = __decorate([gLite.singleton({
19792
20234
  token: DeviceContribution
19793
- })], WebGPUDeviceContribution);
19794
- var containerModule$4 = g.Module(function (register) {
20235
+ }), __param(0, gLite.inject(WebGPUDeviceOptions))], WebGPUDeviceContribution);
20236
+ var containerModule$4 = gLite.Module(function (register) {
19795
20237
  register(WebGPUDeviceContribution);
19796
20238
  });
19797
20239
 
@@ -19827,22 +20269,140 @@
19827
20269
  };
19828
20270
 
19829
20271
  return Plugin;
19830
- }(g.AbstractRendererPlugin);
20272
+ }(gLite.AbstractRendererPlugin);
19831
20273
 
19832
20274
  var index_esm$3 = /*#__PURE__*/Object.freeze({
19833
20275
  __proto__: null,
19834
20276
  Plugin: Plugin$4
19835
20277
  });
19836
20278
 
19837
- var DeviceRendererPlugin = g.Syringe.defineToken('');
20279
+ var DeviceRendererPlugin = gLite.Syringe.defineToken('');
20280
+
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
+ });
19838
20396
 
19839
20397
  var WebGPUContextService = /*#__PURE__*/function () {
19840
- function WebGPUContextService() {
20398
+ function WebGPUContextService(canvasConfig, deviceRendererPlugin) {
20399
+ this.canvasConfig = void 0;
20400
+ this.deviceRendererPlugin = void 0;
19841
20401
  this.$container = void 0;
19842
20402
  this.$canvas = void 0;
19843
20403
  this.dpr = void 0;
19844
- this.canvasConfig = void 0;
19845
- this.deviceRendererPlugin = void 0;
20404
+ this.canvasConfig = canvasConfig;
20405
+ this.deviceRendererPlugin = deviceRendererPlugin;
19846
20406
  }
19847
20407
 
19848
20408
  var _proto = WebGPUContextService.prototype;
@@ -19868,7 +20428,7 @@
19868
20428
  this.canvasConfig.container = this.$container;
19869
20429
  } else if (container) {
19870
20430
  // create container
19871
- this.$container = g.isString(container) ? document.getElementById(container) : container;
20431
+ this.$container = isString$4(container) ? document.getElementById(container) : container;
19872
20432
 
19873
20433
  if (this.$container) {
19874
20434
  // create canvas
@@ -19884,7 +20444,7 @@
19884
20444
  } // use user-defined dpr first
19885
20445
 
19886
20446
 
19887
- dpr = devicePixelRatio || g.isBrowser && window.devicePixelRatio || 1;
20447
+ dpr = devicePixelRatio || gLite.isBrowser && window.devicePixelRatio || 1;
19888
20448
  dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
19889
20449
  this.dpr = dpr;
19890
20450
 
@@ -19933,7 +20493,7 @@
19933
20493
  this.$canvas.width = dpr * width;
19934
20494
  this.$canvas.height = dpr * height; // set CSS style width & height
19935
20495
 
19936
- g.setDOMSize(this.$canvas, width, height);
20496
+ gLite.setDOMSize(this.$canvas, width, height);
19937
20497
  }
19938
20498
  };
19939
20499
 
@@ -19973,15 +20533,11 @@
19973
20533
  return WebGPUContextService;
19974
20534
  }();
19975
20535
 
19976
- __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], WebGPUContextService.prototype, "canvasConfig", void 0);
19977
-
19978
- __decorate([g.inject(DeviceRendererPlugin), __metadata("design:type", Plugin$1)], WebGPUContextService.prototype, "deviceRendererPlugin", void 0);
19979
-
19980
- WebGPUContextService = __decorate([g.singleton({
19981
- token: g.ContextService
19982
- })], WebGPUContextService);
20536
+ WebGPUContextService = __decorate([gLite.singleton({
20537
+ token: gLite.ContextService
20538
+ }), __param(0, gLite.inject(gLite.CanvasConfig)), __param(1, gLite.inject(DeviceRendererPlugin))], WebGPUContextService);
19983
20539
 
19984
- var containerModule$5 = g.Module(function (register) {
20540
+ var containerModule$5 = gLite.Module(function (register) {
19985
20541
  /**
19986
20542
  * implements ContextService
19987
20543
  */
@@ -20015,7 +20571,7 @@
20015
20571
  };
20016
20572
 
20017
20573
  return ContextRegisterPlugin;
20018
- }(g.AbstractRendererPlugin);
20574
+ }(gLite.AbstractRendererPlugin);
20019
20575
 
20020
20576
  var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
20021
20577
  _inheritsLoose(Renderer, _AbstractRenderer);
@@ -20042,7 +20598,7 @@
20042
20598
  }
20043
20599
 
20044
20600
  return Renderer;
20045
- }(g.AbstractRenderer);
20601
+ }(gLite.AbstractRenderer);
20046
20602
 
20047
20603
  exports.DeviceRenderer = index_esm;
20048
20604
  exports.DomInteraction = index_esm$1;