diff --git a/nezha-fronted/src/components/common/@topology/core/src/core.js b/nezha-fronted/src/components/common/@topology/core/src/core.js index 51f20fc39..317fc41c1 100644 --- a/nezha-fronted/src/components/common/@topology/core/src/core.js +++ b/nezha-fronted/src/components/common/@topology/core/src/core.js @@ -2959,12 +2959,6 @@ const Topology = /** @class */ (function () { this.subcribeAnimateMoved.unsubscribe() this.subcribeMediaEnd.unsubscribe() this.subcribeEmit.unsubscribe() - this.animateLayer.destroy() - this.divLayer.destroy() - this.canvas.destroy() - this.activeLayer.destroy() - this.hoverLayer.destroy() - this.offscreen.destroy() // document.body.removeChild(this.tipMarkdown) window.removeEventListener('resize', this.winResize) this.parentElem.removeEventListener('scroll', this.onScroll) @@ -2975,9 +2969,15 @@ const Topology = /** @class */ (function () { document.removeEventListener('keydown', this.onkeydown) break case KeydownType.Canvas: - this.divLayer.canvas.removeEventListener('keydown', this.onkeydown) + this.divLayer.canvas && this.divLayer.canvas.removeEventListener('keydown', this.onkeydown) break } + this.animateLayer.destroy() + this.divLayer.destroy() + this.canvas.destroy() + this.activeLayer.destroy() + this.hoverLayer.destroy() + this.offscreen.destroy() this.closeSocket() this.closeMqtt() if (this.socketFn) { @@ -2987,6 +2987,7 @@ const Topology = /** @class */ (function () { this.cache = null this.data = null console.log(this.options) + this.options.on = null window.topology = null this.activeLayer = null this.hoverLayer = null diff --git a/nezha-fronted/src/components/common/@topology/core/src/divLayer.js b/nezha-fronted/src/components/common/@topology/core/src/divLayer.js index 1f4b52e02..71ce29648 100644 --- a/nezha-fronted/src/components/common/@topology/core/src/divLayer.js +++ b/nezha-fronted/src/components/common/@topology/core/src/divLayer.js @@ -82,7 +82,7 @@ const DivLayer = /** @class */ (function (_super) { _this.setElemPosition(node, _this.gifs[node.id]) } else { _this.addGif(node) - _this.setElemPosition(node, node.id) + _this.setElemPosition(node, node.img) } } } diff --git a/nezha-fronted/src/components/common/@topology/core/src/renderLayer.js b/nezha-fronted/src/components/common/@topology/core/src/renderLayer.js index a59d4ea06..901fc9cf0 100644 --- a/nezha-fronted/src/components/common/@topology/core/src/renderLayer.js +++ b/nezha-fronted/src/components/common/@topology/core/src/renderLayer.js @@ -24,7 +24,7 @@ const RenderLayer = /** @class */ (function (_super) { _this.options = options _this.render = function () { if (_this.data && _this.data.bkImage && !_this.bkImg) { - _this.loadBkImg(_this) + _this.loadBkImg(_this.render) return } if (!_this.width || !_this.height || !_this.offscreen) { @@ -46,6 +46,7 @@ const RenderLayer = /** @class */ (function (_super) { _this.rule() } ctx.drawImage(_this.offscreen, 0, 0, _this.width, _this.height) + return _this } _this.offscreen = Store.get(_this.generateStoreKey('LT:offscreen')) _this.parentElem.appendChild(_this.canvas) diff --git a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue index 41eed90e5..1561ed59b 100644 --- a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue +++ b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue @@ -312,8 +312,8 @@ diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index 540fae5da..d2db69bcd 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -354,6 +354,7 @@ import { myCubeAnchors } from './L5/services/canvas.js' import { getTopology, setTopology, dealImg, topologyImg } from '../js/common' + import CanvasProps from './L5/CanvasProps' import topologyTopTool from './L5//topologyTopTool' import CanvasContextMenu from './L5/CanvasContextMenu' @@ -782,7 +783,7 @@ export default { return } if (!getTopology(this.topologyIndex)) { - let canvas = new Topology('topology-canvas' + this.topologyIndexF) + let canvas = new Topology('topology-canvas' + this.topologyIndexF, canvasOptions) // canvas.open(data) setTopology(this.topologyIndex, canvas) canvas = null