@antv/g-lite 1.0.22 → 1.0.24

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.js CHANGED
@@ -455,7 +455,29 @@ var Rectangle = /*#__PURE__*/function () {
455
455
  Shape["MESH"] = "mesh";
456
456
  })(exports.Shape || (exports.Shape = {}));
457
457
 
458
- var camelCase = util.memoize(function (str) {
458
+ function memoize(func, resolver) {
459
+ if (typeof func !== 'function' || resolver != null && typeof resolver !== 'function') {
460
+ throw new TypeError('Expected a function');
461
+ }
462
+ var memoized = function memoized() {
463
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
464
+ args[_key] = arguments[_key];
465
+ }
466
+ var key = resolver ? resolver.apply(this, args) : args[0];
467
+ var cache = memoized.cache;
468
+ if (cache.has(key)) {
469
+ return cache.get(key);
470
+ }
471
+ var result = func.apply(this, args);
472
+ memoized.cache = cache.set(key, result) || cache;
473
+ return result;
474
+ };
475
+ memoized.cache = new (memoize.Cache || Map)();
476
+ return memoized;
477
+ }
478
+ memoize.Cache = Map;
479
+
480
+ var camelCase = memoize(function (str) {
459
481
  if (str === void 0) {
460
482
  str = '';
461
483
  }
@@ -505,7 +527,7 @@ var FORMAT_ATTR_MAP = {
505
527
  alias: 'img'
506
528
  }
507
529
  };
508
- var formatAttributeName = util.memoize(function (name) {
530
+ var formatAttributeName = memoize(function (name) {
509
531
  var attributeName = camelCase(name);
510
532
  var map = FORMAT_ATTR_MAP[attributeName];
511
533
  attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
@@ -3124,12 +3146,12 @@ var getOrCreateKeyword = function getOrCreateKeyword(name) {
3124
3146
  */
3125
3147
  var noneColor = new CSSRGB(0, 0, 0, 0, true);
3126
3148
  var transparentColor = new CSSRGB(0, 0, 0, 0);
3127
- var getOrCreateRGBA = util.memoize(function (r, g, b, a) {
3149
+ var getOrCreateRGBA = memoize(function (r, g, b, a) {
3128
3150
  return new CSSRGB(r, g, b, a);
3129
3151
  }, function (r, g, b, a) {
3130
3152
  return "rgba(" + r + "," + g + "," + b + "," + a + ")";
3131
3153
  });
3132
- var getOrCreateUnitValue = util.memoize(function (value, unitOrName) {
3154
+ var getOrCreateUnitValue = memoize(function (value, unitOrName) {
3133
3155
  if (unitOrName === void 0) {
3134
3156
  unitOrName = exports.UnitType.kNumber;
3135
3157
  }
@@ -3193,7 +3215,7 @@ var SideOrCornerToDegMap = {
3193
3215
  'right bottom': 135 - 90,
3194
3216
  'bottom right': 135 - 90
3195
3217
  };
3196
- var angleToDeg = util.memoize(function (orientation) {
3218
+ var angleToDeg = memoize(function (orientation) {
3197
3219
  var angle;
3198
3220
  if (orientation.type === 'angular') {
3199
3221
  angle = Number(orientation.value);
@@ -3202,7 +3224,7 @@ var angleToDeg = util.memoize(function (orientation) {
3202
3224
  }
3203
3225
  return getOrCreateUnitValue(angle, 'deg');
3204
3226
  });
3205
- var positonToCSSUnitValue = util.memoize(function (position) {
3227
+ var positonToCSSUnitValue = memoize(function (position) {
3206
3228
  var cx = 50;
3207
3229
  var cy = 50;
3208
3230
  var unitX = '%';
@@ -3251,7 +3273,7 @@ var positonToCSSUnitValue = util.memoize(function (position) {
3251
3273
  cy: getOrCreateUnitValue(cy, unitY)
3252
3274
  };
3253
3275
  });
3254
- var parseGradient = util.memoize(function (colorStr) {
3276
+ var parseGradient = memoize(function (colorStr) {
3255
3277
  if (colorStr.indexOf('linear') > -1 || colorStr.indexOf('radial') > -1) {
3256
3278
  var ast = parseGradient$1(colorStr);
3257
3279
  return ast.map(function (_ref) {
@@ -3401,7 +3423,7 @@ function isPattern(object) {
3401
3423
  /**
3402
3424
  * @see https://github.com/WebKit/WebKit/blob/main/Source/WebCore/css/parser/CSSParser.cpp#L97
3403
3425
  */
3404
- var parseColor = util.memoize(function (colorStr) {
3426
+ var parseColor = memoize(function (colorStr) {
3405
3427
  if (isPattern(colorStr)) {
3406
3428
  return _extends({
3407
3429
  repetition: 'repeat'
@@ -3478,14 +3500,14 @@ function parseDimension(unitRegExp, string) {
3478
3500
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
3479
3501
  * length with only absolute unit, eg. 1px
3480
3502
  */
3481
- var parseLength = util.memoize(function (css) {
3503
+ var parseLength = memoize(function (css) {
3482
3504
  return parseDimension(new RegExp('px', 'g'), css);
3483
3505
  });
3484
3506
  /**
3485
3507
  * <percentage>
3486
3508
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/percentage
3487
3509
  */
3488
- var parserPercentage = util.memoize(function (css) {
3510
+ var parserPercentage = memoize(function (css) {
3489
3511
  return parseDimension(new RegExp('%', 'g'), css);
3490
3512
  });
3491
3513
  /**
@@ -3494,13 +3516,13 @@ var parserPercentage = util.memoize(function (css) {
3494
3516
  *
3495
3517
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length-percentage
3496
3518
  */
3497
- var parseLengthOrPercentage = util.memoize(function (css) {
3519
+ var parseLengthOrPercentage = memoize(function (css) {
3498
3520
  if (util.isNumber(css) || isFinite(Number(css))) {
3499
3521
  return getOrCreateUnitValue(Number(css), 'px');
3500
3522
  }
3501
3523
  return parseDimension(new RegExp('px|%|em|rem', 'g'), css);
3502
3524
  });
3503
- var parseAngle = util.memoize(function (css) {
3525
+ var parseAngle = memoize(function (css) {
3504
3526
  return parseDimension(new RegExp('deg|rad|grad|turn', 'g'), css);
3505
3527
  });
3506
3528
  /**
@@ -3649,7 +3671,7 @@ function numberToString(x) {
3649
3671
  * * 0 -> CSSUnitValue(0)
3650
3672
  * * '2' -> CSSUnitValue(2)
3651
3673
  */
3652
- var parseNumber = util.memoize(function (string) {
3674
+ var parseNumber = memoize(function (string) {
3653
3675
  if (typeof string === 'number') {
3654
3676
  return getOrCreateUnitValue(string);
3655
3677
  }
@@ -3664,7 +3686,7 @@ var parseNumber = util.memoize(function (string) {
3664
3686
  * eg.
3665
3687
  * * [0.5, 0.5] -> [CSSUnitValue, CSSUnitValue]
3666
3688
  */
3667
- var parseNumberList = util.memoize(function (string) {
3689
+ var parseNumberList = memoize(function (string) {
3668
3690
  if (util.isString(string)) {
3669
3691
  return string.split(' ').map(parseNumber);
3670
3692
  } else {
@@ -3745,7 +3767,7 @@ var internalParsePath = function internalParsePath(path) {
3745
3767
  }
3746
3768
  };
3747
3769
  };
3748
- var memoizedParsePath = util.memoize(internalParsePath);
3770
+ var memoizedParsePath = memoize(internalParsePath);
3749
3771
  function parsePath(path, object) {
3750
3772
  var result = util.isString(path) ? memoizedParsePath(path) : internalParsePath(path);
3751
3773
  if (object) {
@@ -4306,7 +4328,7 @@ function mergeTransforms(left, right, target) {
4306
4328
  * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
4307
4329
  * eg. 'center' 'top left' '50px 50px'
4308
4330
  */
4309
- var parseTransformOrigin = util.memoize(function (value) {
4331
+ var parseTransformOrigin = memoize(function (value) {
4310
4332
  if (util.isString(value)) {
4311
4333
  if (value === 'text-anchor') {
4312
4334
  return [getOrCreateUnitValue(0, 'px'), getOrCreateUnitValue(0, 'px')];
@@ -5312,19 +5334,13 @@ var Node = /*#__PURE__*/function (_EventTarget) {
5312
5334
  };
5313
5335
  _proto.hasChildNodes = function hasChildNodes() {
5314
5336
  return this.childNodes.length > 0;
5315
- }
5316
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5317
- ;
5337
+ };
5318
5338
  _proto.isDefaultNamespace = function isDefaultNamespace(namespace) {
5319
5339
  throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
5320
- }
5321
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5322
- ;
5340
+ };
5323
5341
  _proto.lookupNamespaceURI = function lookupNamespaceURI(prefix) {
5324
5342
  throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
5325
- }
5326
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5327
- ;
5343
+ };
5328
5344
  _proto.lookupPrefix = function lookupPrefix(namespace) {
5329
5345
  throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
5330
5346
  };
@@ -5586,15 +5602,17 @@ var Document = /*#__PURE__*/function (_Node) {
5586
5602
  };
5587
5603
  _proto.createElementNS = function createElementNS(namespaceURI, tagName, options) {
5588
5604
  return this.createElement(tagName, options);
5589
- }
5590
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5591
- ;
5605
+ };
5592
5606
  _proto.cloneNode = function cloneNode(deep) {
5593
5607
  throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
5594
5608
  };
5595
5609
  _proto.destroy = function destroy() {
5596
5610
  try {
5597
- this.documentElement.destroy();
5611
+ [].concat(this.documentElement.childNodes).forEach(function (child, i) {
5612
+ child.forEach(function (object) {
5613
+ object.destroy();
5614
+ });
5615
+ });
5598
5616
  this.timeline.destroy();
5599
5617
  } catch (e) {}
5600
5618
  }
@@ -5822,33 +5840,22 @@ var Document = /*#__PURE__*/function (_Node) {
5822
5840
  /**
5823
5841
  * eg. Uncaught DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
5824
5842
  */
5825
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5826
5843
  ;
5827
5844
  _proto.appendChild = function appendChild(newChild, index) {
5828
5845
  throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);
5829
- }
5830
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5831
- ;
5846
+ };
5832
5847
  _proto.insertBefore = function insertBefore(newChild, refChild) {
5833
5848
  throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);
5834
- }
5835
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5836
- ;
5849
+ };
5837
5850
  _proto.removeChild = function removeChild(oldChild, destroy) {
5838
5851
  throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);
5839
- }
5840
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5841
- ;
5852
+ };
5842
5853
  _proto.replaceChild = function replaceChild(newChild, oldChild, destroy) {
5843
5854
  throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);
5844
- }
5845
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5846
- ;
5855
+ };
5847
5856
  _proto.append = function append() {
5848
5857
  throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);
5849
- }
5850
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5851
- ;
5858
+ };
5852
5859
  _proto.prepend = function prepend() {
5853
5860
  throw new Error(ERROR_MSG_USE_DOCUMENT_ELEMENT);
5854
5861
  }
@@ -6113,7 +6120,6 @@ var Element = /*#__PURE__*/function (_Node) {
6113
6120
  * Unique id.
6114
6121
  */;
6115
6122
  var _proto = Element.prototype;
6116
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6117
6123
  _proto.cloneNode = function cloneNode(deep) {
6118
6124
  throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
6119
6125
  };
@@ -6419,9 +6425,7 @@ var Element = /*#__PURE__*/function (_Node) {
6419
6425
  /**
6420
6426
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
6421
6427
  */;
6422
- _proto.setAttribute = function setAttribute(attributeName, value,
6423
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6424
- force) {
6428
+ _proto.setAttribute = function setAttribute(attributeName, value, force) {
6425
6429
  this.attributes[attributeName] = value;
6426
6430
  };
6427
6431
  _proto.getAttributeNS = function getAttributeNS(namespace, localName) {
@@ -6745,7 +6749,8 @@ var DEFAULT_PARSED_STYLE_PROPS = {
6745
6749
  filter: [],
6746
6750
  shadowType: 'outer'
6747
6751
  };
6748
- var INHERITABLE_STYLE_PROPS = ['opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform'];
6752
+ var INHERITABLE_BASE_STYLE_PROPS = ['opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting'];
6753
+ var INHERITABLE_STYLE_PROPS = [].concat(INHERITABLE_BASE_STYLE_PROPS, ['fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform']);
6749
6754
  /**
6750
6755
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
6751
6756
  *
@@ -6852,6 +6857,12 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
6852
6857
  this.getAnimations().forEach(function (animation) {
6853
6858
  animation.cancel();
6854
6859
  });
6860
+ this.renderable = null;
6861
+ this.cullable = null;
6862
+ this.transformable = null;
6863
+ this.rBushNode = null;
6864
+ this.geometry = null;
6865
+ this.sortable = null;
6855
6866
  };
6856
6867
  _proto.cloneNode = function cloneNode(deep, customCloneFunc) {
6857
6868
  var clonedStyle = _extends({}, this.attributes);
@@ -6899,6 +6910,11 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
6899
6910
  runtime.styleValueRegistry.processProperties(this, attributes, {
6900
6911
  forceUpdateGeometry: true,
6901
6912
  usedAttributes: INHERITABLE_STYLE_PROPS
6913
+ // usedAttributes:
6914
+ // // only Group / Text should account for text relative props
6915
+ // this.tagName === Shape.GROUP || this.tagName === Shape.TEXT
6916
+ // ? INHERITABLE_STYLE_PROPS
6917
+ // : INHERITABLE_BASE_STYLE_PROPS,
6902
6918
  });
6903
6919
  // redraw at next frame
6904
6920
  renderable.dirty = true;
@@ -11375,12 +11391,7 @@ var BUILT_IN_PROPERTIES = [{
11375
11391
  }];
11376
11392
  var propertyMetadataCache = {};
11377
11393
  var unresolvedProperties = new WeakMap();
11378
- var priorityMap = {};
11379
- var sortAttributeNames = util.memoize(function (attributeNames) {
11380
- return attributeNames.sort(function (a, b) {
11381
- return priorityMap[a] - priorityMap[b];
11382
- });
11383
- });
11394
+ // const uniqueAttributeSet = new Set<string>();
11384
11395
  var tmpVec3a = glMatrix.vec3.create();
11385
11396
  var tmpVec3b = glMatrix.vec3.create();
11386
11397
  var tmpVec3c = glMatrix.vec3.create();
@@ -11406,7 +11417,6 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
11406
11417
  _proto.registerMetadata = function registerMetadata(metadata) {
11407
11418
  [metadata.n].concat(metadata.a || []).forEach(function (name) {
11408
11419
  propertyMetadataCache[name] = metadata;
11409
- priorityMap[name] = metadata.p || 0;
11410
11420
  });
11411
11421
  };
11412
11422
  _proto.unregisterMetadata = function unregisterMetadata(name) {
@@ -11458,8 +11468,24 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
11458
11468
  }
11459
11469
  // let hasUnresolvedProperties = false;
11460
11470
  // parse according to priority
11461
- attributeNames = sortAttributeNames((usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) ? Array.from(new Set(attributeNames.concat(usedAttributes))) : attributeNames);
11462
- // attributeNames.sort((a, b) => priorityMap[a] - priorityMap[b]);
11471
+ // path 50
11472
+ // points 50
11473
+ // text 50
11474
+ // textTransform 51
11475
+ // anchor 99
11476
+ // transform 100
11477
+ // transformOrigin 100
11478
+ if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
11479
+ // uniqueAttributeSet.clear();
11480
+ attributeNames = Array.from(new Set(attributeNames.concat(usedAttributes)));
11481
+ }
11482
+ ['path', 'points', 'text', 'textTransform', 'anchor', 'transform', 'transformOrigin'].forEach(function (name) {
11483
+ var index = attributeNames.indexOf(name);
11484
+ if (index > -1) {
11485
+ attributeNames.splice(index, 1);
11486
+ attributeNames.push(name);
11487
+ }
11488
+ });
11463
11489
  attributeNames.forEach(function (name) {
11464
11490
  // some style props maybe deleted after parsing such as `anchor` in Text
11465
11491
  if (name in object.computedStyle) {
@@ -13136,6 +13162,12 @@ var EventService = /*#__PURE__*/function () {
13136
13162
  this.addEventMapping('pointerupoutside', this.onPointerUpOutside);
13137
13163
  this.addEventMapping('wheel', this.onWheel);
13138
13164
  };
13165
+ _proto.destroy = function destroy() {
13166
+ this.emitter.removeAllListeners();
13167
+ this.mappingTable = {};
13168
+ this.mappingState = {};
13169
+ this.eventPool.clear();
13170
+ };
13139
13171
  _proto.client2Viewport = function client2Viewport(client) {
13140
13172
  var bbox = this.context.contextService.getBoundingClientRect();
13141
13173
  return new Point(client.x - ((bbox === null || bbox === void 0 ? void 0 : bbox.left) || 0), client.y - ((bbox === null || bbox === void 0 ? void 0 : bbox.top) || 0));
@@ -13975,9 +14007,7 @@ var DefaultSceneGraphSelector = /*#__PURE__*/function () {
13975
14007
  return root !== node && node.nodeName === query;
13976
14008
  });
13977
14009
  }
13978
- }
13979
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13980
- ;
14010
+ };
13981
14011
  _proto.is = function is(query, node) {
13982
14012
  // a simple `matches` implementation
13983
14013
  if (query.startsWith('.')) {
@@ -14925,8 +14955,7 @@ var TextService = /*#__PURE__*/function () {
14925
14955
  // account for textPath
14926
14956
  if (textPath) {
14927
14957
  var totalPathLength = textPath.getTotalLength();
14928
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
14929
- var startingPoint = textPath.getPoint(0);
14958
+ // const startingPoint = textPath.getPoint(0);
14930
14959
  for (var i = 0; i < lines.length; i++) {
14931
14960
  var width = context.measureText(lines[i]).width + (lines[i].length - 1) * letterSpacing;
14932
14961
  // for (
@@ -15137,6 +15166,7 @@ var TextService = /*#__PURE__*/function () {
15137
15166
  return TextService;
15138
15167
  }();
15139
15168
 
15169
+ var _this = undefined;
15140
15170
  var runtime = {};
15141
15171
  /**
15142
15172
  * Replace with IoC container
@@ -15153,6 +15183,15 @@ var CSSPropertySyntaxFactory = function () {
15153
15183
  var length = new CSSPropertyLengthOrPercentage();
15154
15184
  return _ref2 = {}, _ref2[exports.PropertySyntax.PERCENTAGE] = null, _ref2[exports.PropertySyntax.NUMBER] = new CSSPropertyNumber(), _ref2[exports.PropertySyntax.ANGLE] = new CSSPropertyAngle(), _ref2[exports.PropertySyntax.DEFINED_PATH] = new CSSPropertyClipPath(), _ref2[exports.PropertySyntax.PAINT] = color, _ref2[exports.PropertySyntax.COLOR] = color, _ref2[exports.PropertySyntax.FILTER] = new CSSPropertyFilter(), _ref2[exports.PropertySyntax.LENGTH] = length, _ref2[exports.PropertySyntax.LENGTH_PERCENTAGE] = length, _ref2[exports.PropertySyntax.LENGTH_PERCENTAGE_12] = new CSSPropertyLengthOrPercentage12(), _ref2[exports.PropertySyntax.LENGTH_PERCENTAGE_14] = new CSSPropertyLengthOrPercentage14(), _ref2[exports.PropertySyntax.COORDINATE] = new CSSPropertyLocalPosition(), _ref2[exports.PropertySyntax.OFFSET_DISTANCE] = new CSSPropertyOffsetDistance(), _ref2[exports.PropertySyntax.OPACITY_VALUE] = new CSSPropertyOpacity(), _ref2[exports.PropertySyntax.PATH] = new CSSPropertyPath(), _ref2[exports.PropertySyntax.LIST_OF_POINTS] = new CSSPropertyPoints(), _ref2[exports.PropertySyntax.SHADOW_BLUR] = new CSSPropertyShadowBlur(), _ref2[exports.PropertySyntax.TEXT] = new CSSPropertyText(), _ref2[exports.PropertySyntax.TEXT_TRANSFORM] = new CSSPropertyTextTransform(), _ref2[exports.PropertySyntax.TRANSFORM] = new CSSPropertyTransform(), _ref2[exports.PropertySyntax.TRANSFORM_ORIGIN] = new CSSPropertyTransformOrigin(), _ref2[exports.PropertySyntax.Z_INDEX] = new CSSPropertyZIndex(), _ref2[exports.PropertySyntax.MARKER] = new CSSPropertyMarker(), _ref2;
15155
15185
  }();
15186
+ var getGlobalThis = function getGlobalThis() {
15187
+ if (typeof globalThis !== 'undefined') return globalThis;
15188
+ if (typeof self !== 'undefined') return self;
15189
+ if (typeof window !== 'undefined') return window;
15190
+ // @ts-ignore
15191
+ if (typeof global !== 'undefined') return global;
15192
+ if (typeof _this !== 'undefined') return _this;
15193
+ throw new Error('Unable to locate global `this`');
15194
+ };
15156
15195
  /**
15157
15196
  * Camera
15158
15197
  * `g-camera-api` will provide an advanced implementation
@@ -15172,6 +15211,7 @@ runtime.geometryUpdaterFactory = geometryUpdaterFactory;
15172
15211
  runtime.CSSPropertySyntaxFactory = CSSPropertySyntaxFactory;
15173
15212
  runtime.styleValueRegistry = new DefaultStyleValueRegistry();
15174
15213
  runtime.layoutRegistry = null;
15214
+ runtime.globalThis = getGlobalThis();
15175
15215
 
15176
15216
  var AbstractRendererPlugin = /*#__PURE__*/function () {
15177
15217
  function AbstractRendererPlugin() {
@@ -15943,20 +15983,20 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
15943
15983
  * implements `Window` interface
15944
15984
  */
15945
15985
  _this.devicePixelRatio = dpr;
15946
- _this.requestAnimationFrame = requestAnimationFrame !== null && requestAnimationFrame !== void 0 ? requestAnimationFrame : raf.bind(globalThis);
15947
- _this.cancelAnimationFrame = cancelAnimationFrame !== null && cancelAnimationFrame !== void 0 ? cancelAnimationFrame : caf.bind(globalThis);
15986
+ _this.requestAnimationFrame = requestAnimationFrame !== null && requestAnimationFrame !== void 0 ? requestAnimationFrame : raf.bind(runtime.globalThis);
15987
+ _this.cancelAnimationFrame = cancelAnimationFrame !== null && cancelAnimationFrame !== void 0 ? cancelAnimationFrame : caf.bind(runtime.globalThis);
15948
15988
  /**
15949
15989
  * limits query
15950
15990
  */
15951
15991
  // the following feature-detect from hammer.js
15952
15992
  // @see https://github.com/hammerjs/hammer.js/blob/master/src/inputjs/input-consts.js#L5
15953
- _this.supportsTouchEvents = supportsTouchEvents !== null && supportsTouchEvents !== void 0 ? supportsTouchEvents : 'ontouchstart' in globalThis;
15954
- _this.supportsPointerEvents = supportsPointerEvents !== null && supportsPointerEvents !== void 0 ? supportsPointerEvents : !!globalThis.PointerEvent;
15993
+ _this.supportsTouchEvents = supportsTouchEvents !== null && supportsTouchEvents !== void 0 ? supportsTouchEvents : 'ontouchstart' in runtime.globalThis;
15994
+ _this.supportsPointerEvents = supportsPointerEvents !== null && supportsPointerEvents !== void 0 ? supportsPointerEvents : !!runtime.globalThis.PointerEvent;
15955
15995
  _this.isTouchEvent = isTouchEvent !== null && isTouchEvent !== void 0 ? isTouchEvent : function (event) {
15956
- return _this.supportsTouchEvents && event instanceof globalThis.TouchEvent;
15996
+ return _this.supportsTouchEvents && event instanceof runtime.globalThis.TouchEvent;
15957
15997
  };
15958
15998
  _this.isMouseEvent = isMouseEvent !== null && isMouseEvent !== void 0 ? isMouseEvent : function (event) {
15959
- return !globalThis.MouseEvent || event instanceof globalThis.MouseEvent && (!_this.supportsPointerEvents || !(event instanceof globalThis.PointerEvent));
15999
+ return !runtime.globalThis.MouseEvent || event instanceof runtime.globalThis.MouseEvent && (!_this.supportsPointerEvents || !(event instanceof runtime.globalThis.PointerEvent));
15960
16000
  };
15961
16001
  _this.initRenderingContext({
15962
16002
  container: container,
@@ -16085,6 +16125,11 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
16085
16125
  if (destroyScenegraph) {
16086
16126
  // destroy Document
16087
16127
  this.document.destroy();
16128
+ this.getEventService().destroy();
16129
+ // clear rbush
16130
+ this.context.rBushRoot.clear();
16131
+ this.context.rBushRoot = null;
16132
+ this.context.renderingContext.root = null;
16088
16133
  }
16089
16134
  // destroy services
16090
16135
  this.getRenderingService().destroy();