【问题标题】:vis.js network: nodes z-indexvis.js 网络:节点 z-index
【发布时间】:2017-05-31 10:48:48
【问题描述】:

vis.js 节点是否有等效的 CSS z-index?

假设我有 2 种节点(在禁用物理的图中):圆形和矩形。我希望矩形在重叠时始终显示在圆圈上。

【问题讨论】:

    标签: vis.js vis.js-network


    【解决方案1】:

    回复有点晚,但简短的回答是:不

    看到这个问题:https://github.com/almende/vis/issues/3146

    【讨论】:

      【解决方案2】:

      根据mentioned issue 判断,更准确的答案是:没有记录在案的方法来设置 z-index(也没有这样的概念),但是您可以使用什么(在某些更新时可能会被破坏) ) 是节点的绘制顺序与它们定义的顺序相同。来自comment

      我使用了以下测试节点:

      var nodes = [
          {id: 'a', label: 'a', shape: 'dot'},
          {id: 'b', label: 'b', shape: 'dot'},
          {id: 'c', label: 'c', shape: 'dot'},
          {id: 'd', label: 'd', shape: 'dot'}
      ];
      

      未选中时,这些将按节点顺序绘制:

      现在,让我们改变一下顺序:

      var nodes = [
          {id: 'c', label: 'c', shape: 'dot'},
          {id: 'b', label: 'b', shape: 'dot'},
          {id: 'd', label: 'd', shape: 'dot'},
          {id: 'a', label: 'a', shape: 'dot'}
      ];
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-03-24
        • 1970-01-01
        • 1970-01-01
        • 2020-05-21
        • 1970-01-01
        相关资源
        最近更新 更多