wente
2024-10-14 7917c76b02b213a5fa805a6e2c9936167fae5cc8
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,
@@ -75,7 +73,7 @@
          },
          keyboard: true,
        })
        this.graph.centerContent()
        this.textGraph.centerContent()
        Graph.registerNode(
          'custom-rect',
@@ -276,15 +274,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)
      }
    },
  }