| | |
| | | name: "textDiagram", |
| | | data(){ |
| | | return{ |
| | | graph:null, |
| | | textGraph:null, |
| | | } |
| | | }, |
| | | methods:{ |
| | | init() { |
| | | console.log(document.documentElement.clientWidth, 'document.documentElement.clientWidth') |
| | | console.log(document.documentElement.clientHeight, 'document.documentElement.clientHeight') |
| | | this.graph = new Graph({ |
| | | this.textGraph = new Graph({ |
| | | container: document.getElementById('textDiagram'), |
| | | // width:250, |
| | | height: document.documentElement.clientHeight - 440, |
| | |
| | | }, |
| | | keyboard: true, |
| | | }) |
| | | this.graph.centerContent() |
| | | this.textGraph.centerContent() |
| | | |
| | | Graph.registerNode( |
| | | 'custom-rect', |
| | |
| | | ) |
| | | }, |
| | | getTextDiagram(diagramJson){ |
| | | this.graph.unfreeze() |
| | | this.graph.fromJSON(diagramJson) |
| | | this.graph.positionContent('left',{ padding: { left: 0 }}) |
| | | this.graph.freeze() |
| | | // this.graph.centerContent() |
| | | // this.graph.zoomToFit() |
| | | this.textGraph.unfreeze() |
| | | this.textGraph.fromJSON(diagramJson) |
| | | this.textGraph.positionContent('left',{ padding: { left: 0 }}) |
| | | this.textGraph.freeze() |
| | | // this.textGraph.centerContent() |
| | | // this.textGraph.zoomToFit() |
| | | }, |
| | | setScroll(top){ |
| | | this.graph.setScrollbarPosition(null, top) |
| | | this.textGraph.setScrollbarPosition(null, top) |
| | | } |
| | | }, |
| | | } |