zoukankan      html  css  js  c++  java
  • go.js remove 特定part

    我想删除一个实际上是背景的部分。

    假设这是我添加part的方式

    myDiagram.add(
      scope.gj(go.Part,//此Part未绑定到任何模型数据
    { 
      layerName:“Background”,position:new go.Point(0,0),
      selectable:false,pickable:false ,name:'特定name'
    } ,
    scope.gj(go.Picture,{ 
    source:img.src,
    // width:scope.totalDiagramWidth,
    // height:scope.totalDiagramHeight 
    },
    new go.Binding(“width”,“widthOfCanvas”),
    new go。绑定(“height”,“heightOfCanvas”)
    )
    ))

    现在我想删除它

    在添加时,加上特定name,然后根据name查找到改part

    function findPart(name) {
      var it = myDiagram.parts;
      while (it.next()) {
        if (it.value.name === name) return it.value;
      }
      return null;
    }
    let part = findPart('Background1')
    if(part){
    myDiagram.remove(part)
    }
     
  • 相关阅读:
    通过索引优化sql
    索引概述
    Spring整合Mybatis
    Mybatis逆向工程
    Mybatis级联
    Mybatis动态语句
    Mybatis—curd
    (转)最大似然估计&贝叶斯估计
    筛法求质——poj2262&2909
    (转)poj1182食物链
  • 原文地址:https://www.cnblogs.com/gxp69/p/10414228.html
Copyright © 2011-2022 走看看