zrender-nightly 5.4.4-dev.20231220 → 5.4.4-dev.20231221

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/zrender.js CHANGED
@@ -7083,7 +7083,7 @@
7083
7083
  var ssrMode = opts.ssr || painter.ssrOnly;
7084
7084
  this.storage = storage;
7085
7085
  this.painter = painter;
7086
- var handerProxy = (!env.node && !env.worker && !ssrMode)
7086
+ var handlerProxy = (!env.node && !env.worker && !ssrMode)
7087
7087
  ? new HandlerDomProxy(painter.getViewportRoot(), painter.root)
7088
7088
  : null;
7089
7089
  var useCoarsePointer = opts.useCoarsePointer;
@@ -7095,7 +7095,7 @@
7095
7095
  if (usePointerSize) {
7096
7096
  pointerSize = retrieve2(opts.pointerSize, defaultPointerSize);
7097
7097
  }
7098
- this.handler = new Handler(storage, painter, handerProxy, painter.root, pointerSize);
7098
+ this.handler = new Handler(storage, painter, handlerProxy, painter.root, pointerSize);
7099
7099
  this.animation = new Animation({
7100
7100
  stage: {
7101
7101
  update: ssrMode ? null : function () { return _this._flush(true); }
@@ -7106,7 +7106,7 @@
7106
7106
  }
7107
7107
  }
7108
7108
  ZRender.prototype.add = function (el) {
7109
- if (!el) {
7109
+ if (this._disposed || !el) {
7110
7110
  return;
7111
7111
  }
7112
7112
  this.storage.addRoot(el);
@@ -7114,7 +7114,7 @@
7114
7114
  this.refresh();
7115
7115
  };
7116
7116
  ZRender.prototype.remove = function (el) {
7117
- if (!el) {
7117
+ if (this._disposed || !el) {
7118
7118
  return;
7119
7119
  }
7120
7120
  this.storage.delRoot(el);
@@ -7122,12 +7122,18 @@
7122
7122
  this.refresh();
7123
7123
  };
7124
7124
  ZRender.prototype.configLayer = function (zLevel, config) {
7125
+ if (this._disposed) {
7126
+ return;
7127
+ }
7125
7128
  if (this.painter.configLayer) {
7126
7129
  this.painter.configLayer(zLevel, config);
7127
7130
  }
7128
7131
  this.refresh();
7129
7132
  };
7130
7133
  ZRender.prototype.setBackgroundColor = function (backgroundColor) {
7134
+ if (this._disposed) {
7135
+ return;
7136
+ }
7131
7137
  if (this.painter.setBackgroundColor) {
7132
7138
  this.painter.setBackgroundColor(backgroundColor);
7133
7139
  }
@@ -7145,6 +7151,9 @@
7145
7151
  return this._darkMode;
7146
7152
  };
7147
7153
  ZRender.prototype.refreshImmediately = function (fromInside) {
7154
+ if (this._disposed) {
7155
+ return;
7156
+ }
7148
7157
  if (!fromInside) {
7149
7158
  this.animation.update(true);
7150
7159
  }
@@ -7153,10 +7162,16 @@
7153
7162
  this._needsRefresh = false;
7154
7163
  };
7155
7164
  ZRender.prototype.refresh = function () {
7165
+ if (this._disposed) {
7166
+ return;
7167
+ }
7156
7168
  this._needsRefresh = true;
7157
7169
  this.animation.start();
7158
7170
  };
7159
7171
  ZRender.prototype.flush = function () {
7172
+ if (this._disposed) {
7173
+ return;
7174
+ }
7160
7175
  this._flush(false);
7161
7176
  };
7162
7177
  ZRender.prototype._flush = function (fromInside) {
@@ -7188,6 +7203,9 @@
7188
7203
  this._sleepAfterStill = stillFramesCount;
7189
7204
  };
7190
7205
  ZRender.prototype.wakeUp = function () {
7206
+ if (this._disposed) {
7207
+ return;
7208
+ }
7191
7209
  this.animation.start();
7192
7210
  this._stillFrameAccum = 0;
7193
7211
  };
@@ -7195,42 +7213,74 @@
7195
7213
  this._needsRefreshHover = true;
7196
7214
  };
7197
7215
  ZRender.prototype.refreshHoverImmediately = function () {
7216
+ if (this._disposed) {
7217
+ return;
7218
+ }
7198
7219
  this._needsRefreshHover = false;
7199
7220
  if (this.painter.refreshHover && this.painter.getType() === 'canvas') {
7200
7221
  this.painter.refreshHover();
7201
7222
  }
7202
7223
  };
7203
7224
  ZRender.prototype.resize = function (opts) {
7225
+ if (this._disposed) {
7226
+ return;
7227
+ }
7204
7228
  opts = opts || {};
7205
7229
  this.painter.resize(opts.width, opts.height);
7206
7230
  this.handler.resize();
7207
7231
  };
7208
7232
  ZRender.prototype.clearAnimation = function () {
7233
+ if (this._disposed) {
7234
+ return;
7235
+ }
7209
7236
  this.animation.clear();
7210
7237
  };
7211
7238
  ZRender.prototype.getWidth = function () {
7239
+ if (this._disposed) {
7240
+ return;
7241
+ }
7212
7242
  return this.painter.getWidth();
7213
7243
  };
7214
7244
  ZRender.prototype.getHeight = function () {
7245
+ if (this._disposed) {
7246
+ return;
7247
+ }
7215
7248
  return this.painter.getHeight();
7216
7249
  };
7217
7250
  ZRender.prototype.setCursorStyle = function (cursorStyle) {
7251
+ if (this._disposed) {
7252
+ return;
7253
+ }
7218
7254
  this.handler.setCursorStyle(cursorStyle);
7219
7255
  };
7220
7256
  ZRender.prototype.findHover = function (x, y) {
7257
+ if (this._disposed) {
7258
+ return;
7259
+ }
7221
7260
  return this.handler.findHover(x, y);
7222
7261
  };
7223
7262
  ZRender.prototype.on = function (eventName, eventHandler, context) {
7224
- this.handler.on(eventName, eventHandler, context);
7263
+ if (!this._disposed) {
7264
+ this.handler.on(eventName, eventHandler, context);
7265
+ }
7225
7266
  return this;
7226
7267
  };
7227
7268
  ZRender.prototype.off = function (eventName, eventHandler) {
7269
+ if (this._disposed) {
7270
+ return;
7271
+ }
7228
7272
  this.handler.off(eventName, eventHandler);
7229
7273
  };
7230
7274
  ZRender.prototype.trigger = function (eventName, event) {
7275
+ if (this._disposed) {
7276
+ return;
7277
+ }
7231
7278
  this.handler.trigger(eventName, event);
7232
7279
  };
7233
7280
  ZRender.prototype.clear = function () {
7281
+ if (this._disposed) {
7282
+ return;
7283
+ }
7234
7284
  var roots = this.storage.getRoots();
7235
7285
  for (var i = 0; i < roots.length; i++) {
7236
7286
  if (roots[i] instanceof Group) {
@@ -7241,6 +7291,9 @@
7241
7291
  this.painter.clear();
7242
7292
  };
7243
7293
  ZRender.prototype.dispose = function () {
7294
+ if (this._disposed) {
7295
+ return;
7296
+ }
7244
7297
  this.animation.stop();
7245
7298
  this.clear();
7246
7299
  this.storage.dispose();
@@ -7250,6 +7303,7 @@
7250
7303
  this.storage =
7251
7304
  this.painter =
7252
7305
  this.handler = null;
7306
+ this._disposed = true;
7253
7307
  delInstance(this.id);
7254
7308
  };
7255
7309
  return ZRender;
@@ -7287,7 +7341,7 @@
7287
7341
  function registerSSRDataGetter(getter) {
7288
7342
  ssrDataGetter = getter;
7289
7343
  }
7290
- var version = '5.4.4-dev.20231220';
7344
+ var version = '5.4.4-dev.20231221';
7291
7345
 
7292
7346
  var STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));
7293
7347
  var DEFAULT_COMMON_STYLE = {