@flexem/fc-gui 3.0.0-alpha.122 → 3.0.0-alpha.123

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.
@@ -42,12 +42,19 @@ export class GraphStateElement {
42
42
  }
43
43
  }
44
44
  changeGraph(stateId, graphResult) {
45
+ // 检查元素是否已被销毁
46
+ if (!this._element) {
47
+ return;
48
+ }
45
49
  if (!graphResult.failed) {
46
50
  const graph = graphResult.graph;
47
51
  switch (graph.graphType) {
48
52
  case GraphType.Image:
49
53
  case GraphType.SVG:
50
54
  const imageElement = this.getImageElement();
55
+ if (!imageElement) {
56
+ return;
57
+ }
51
58
  imageElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', graph.source);
52
59
  this.doFaultFlicker(imageElement, stateId);
53
60
  break;
@@ -63,6 +70,10 @@ export class GraphStateElement {
63
70
  }
64
71
  getImageElement() {
65
72
  if (!this.imageElement) {
73
+ // 检查 _element 是否已被销毁
74
+ if (!this._element) {
75
+ return null;
76
+ }
66
77
  this.imageElement = document.createElementNS('http://www.w3.org/2000/svg', 'image');
67
78
  this.imageElement.setAttribute('width', this.width + '');
68
79
  this.imageElement.setAttribute('height', this.height + '');
@@ -74,7 +85,7 @@ export class GraphStateElement {
74
85
  return this.imageElement;
75
86
  }
76
87
  removeImageElement() {
77
- if (this.imageElement) {
88
+ if (this.imageElement && this._element) {
78
89
  this._element.removeChild(this.imageElement);
79
90
  delete this.imageElement;
80
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "main": "bundles/fc-gui.umd.js",
3
- "version": "3.0.0-alpha.122",
3
+ "version": "3.0.0-alpha.123",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",