xyc
2025-02-21 664db98c9e8595ce4dd636a27f480e3a08b81ff5
web/src/views/modules/taskReliability/textDiagram.vue
@@ -9,14 +9,12 @@
    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,
@@ -63,8 +61,7 @@
                line: {
                  stroke: '#A2B1C3',
                  strokeWidth: 2,
                  sourceMarker: 'none',
                  targetMarker: 'none'
                  targetMarker: null,
                }
              },
              tools: {
@@ -75,7 +72,7 @@
          },
          keyboard: true,
        })
        this.graph.centerContent()
        this.textGraph.centerContent()
        Graph.registerNode(
          'custom-rect',
@@ -276,15 +273,15 @@
        )
      },
      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)
      }
    },
  }