@antv/g-lite 2.0.11-alpha.4 → 2.0.11-alpha.6

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
@@ -7501,20 +7501,19 @@ var CSSPropertyTextTransform = /** @class */ (function () {
7501
7501
  return CSSPropertyTextTransform;
7502
7502
  }());
7503
7503
 
7504
- var canvasMap = {};
7505
- var defaultCanvasIdCounter = 0;
7504
+ var CANVAS_Map = new WeakMap();
7506
7505
  /**
7507
7506
  * destroy existed canvas with the same id
7508
7507
  */
7509
7508
  function cleanExistedCanvas(container, canvas, fast) {
7510
7509
  if (container) {
7511
- var id = typeof container === 'string'
7512
- ? container
7513
- : container.id || defaultCanvasIdCounter++;
7514
- if (canvasMap[id]) {
7515
- canvasMap[id].destroy(true, !!fast);
7516
- }
7517
- canvasMap[id] = canvas;
7510
+ var $dom = typeof container === 'string'
7511
+ ? document.getElementById(container)
7512
+ : container;
7513
+ if (CANVAS_Map.has($dom))
7514
+ CANVAS_Map.get($dom).destroy(true, !!fast);
7515
+ else
7516
+ CANVAS_Map.set($dom, canvas);
7518
7517
  }
7519
7518
  }
7520
7519
  var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
@@ -15104,9 +15103,10 @@ var Canvas = /** @class */ (function (_super) {
15104
15103
  // unmount all children
15105
15104
  var root = this.getRoot();
15106
15105
  this.unmountChildren(root);
15107
- if (cleanUp && !fastCleanExistingCanvas) {
15106
+ if (cleanUp) {
15108
15107
  // destroy Document
15109
- this.document.destroy();
15108
+ if (!fastCleanExistingCanvas)
15109
+ this.document.destroy();
15110
15110
  this.getEventService().destroy();
15111
15111
  }
15112
15112
  // destroy services