Browse Source

UI fix bug that cannot get parameters when the page is initialized

pull/1309/head
WeiFeng-mindinsight 4 years ago
parent
commit
c6bbdfbc0a
1 changed files with 10 additions and 5 deletions
  1. +10
    -5
      mindinsight/ui/src/views/debugger/debugger.vue

+ 10
- 5
mindinsight/ui/src/views/debugger/debugger.vue View File

@@ -1212,7 +1212,7 @@ export default {
* Initialization method executed after the graph rendering is complete * Initialization method executed after the graph rendering is complete
*/ */
startApp() { startApp() {
this.initSvgSize();
this.initSvgSize(true);
this.graph.dom = document.querySelector(`#graph #graph0`); this.graph.dom = document.querySelector(`#graph #graph0`);
const graphBox = this.graph.dom.getBBox(); const graphBox = this.graph.dom.getBBox();
this.graph.size = {width: graphBox.width, height: graphBox.height}; this.graph.size = {width: graphBox.width, height: graphBox.height};
@@ -1789,13 +1789,18 @@ export default {
this.collapseTable = !this.collapseTable; this.collapseTable = !this.collapseTable;
this.initSvgSize(); this.initSvgSize();
}, },
initSvgSize() {
if (this.resizeTimer) clearTimeout(this.resizeTimer);
this.resizeTimer = setTimeout(() => {
initSvgSize(immediate = false) {
const setData = () => {
const svgRect = document.querySelector('#graph svg').getBoundingClientRect(); const svgRect = document.querySelector('#graph svg').getBoundingClientRect();
this.svg.size = {width: svgRect.width, height: svgRect.height, left: svgRect.left, top: svgRect.top}; this.svg.size = {width: svgRect.width, height: svgRect.height, left: svgRect.left, top: svgRect.top};
this.resizeTimer = null; this.resizeTimer = null;
}, this.resizeDelay);
};
if (!immediate) {
if (this.resizeTimer) clearTimeout(this.resizeTimer);
this.resizeTimer = setTimeout(setData, this.resizeDelay);
} else {
setData();
}
}, },
}, },
destroyed() { destroyed() {


Loading…
Cancel
Save