@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.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';