【问题标题】:Dynamically setting the model of a paper动态设置纸张模型
【发布时间】:2021-01-27 12:11:29
【问题描述】:

有没有一种方法可以动态设置论文的模型(也许,稍后,将其更改为另一层)?

或者是 JointJS / Rappid 仅限于(1 个模型:1 个论文)?

基本上,我希望能够在多个模型之间动态切换,并在一张纸上画出所有这些开关。

【问题讨论】:

    标签: jointjs


    【解决方案1】:

    只需更改模型并重新渲染您的论文

    const graph1 = new joint.dia.Graph();
    const graph2 = new joint.dia.Graph();
    const paper = new joint.dia.Paper({
                el: document.getElementById('paper'),
                height: '100%',
                width: '100%'
                });
                
    function setPapaerModel(paper, model) {
      paper.model = model; //set model
      paper.render();
    }
    
    //Then you can change as you wish
    setPaperModel(paper, graph2);

    【讨论】:

      猜你喜欢
      • 2016-04-14
      • 2010-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-15
      • 2015-09-09
      • 1970-01-01
      相关资源
      最近更新 更多