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

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.esm.js CHANGED
@@ -7480,20 +7480,19 @@ var CSSPropertyTextTransform = /** @class */ (function () {
7480
7480
  return CSSPropertyTextTransform;
7481
7481
  }());
7482
7482
 
7483
- var canvasMap = {};
7484
- var defaultCanvasIdCounter = 0;
7483
+ var CANVAS_Map = new WeakMap();
7485
7484
  /**
7486
7485
  * destroy existed canvas with the same id
7487
7486
  */
7488
7487
  function cleanExistedCanvas(container, canvas, fast) {
7489
7488
  if (container) {
7490
- var id = typeof container === 'string'
7491
- ? container
7492
- : container.id || defaultCanvasIdCounter++;
7493
- if (canvasMap[id]) {
7494
- canvasMap[id].destroy(true, !!fast);
7495
- }
7496
- canvasMap[id] = canvas;
7489
+ var $dom = typeof container === 'string'
7490
+ ? document.getElementById(container)
7491
+ : container;
7492
+ if (CANVAS_Map.has($dom))
7493
+ CANVAS_Map.get($dom).destroy(true, !!fast);
7494
+ else
7495
+ CANVAS_Map.set($dom, canvas);
7497
7496
  }
7498
7497
  }
7499
7498
  var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';