vis.js 网络:节点 z-index
vis.js network: nodes z-index
是否有 vis.js 个节点的 CSS z-index 的等价物?
假设我有两种节点(在禁用物理的图形中):圆形和矩形。我希望矩形在重叠时始终显示在圆上。
回复有点晚,但简短的回答是:否
根据 mentioned issue, a more precise answer would be: there's no documented way to set z-index (and there's no such concept), but what you can use (with a risk of getting this broken at some update) is nodes are drawn in the same order they are defined. From comment 判断:
I used the following test nodes:
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'}
];
When not selected, these will draw in the node order:
Now, let's change the order:
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'}
];
是否有 vis.js 个节点的 CSS z-index 的等价物?
假设我有两种节点(在禁用物理的图形中):圆形和矩形。我希望矩形在重叠时始终显示在圆上。
回复有点晚,但简短的回答是:否
根据 mentioned issue, a more precise answer would be: there's no documented way to set z-index (and there's no such concept), but what you can use (with a risk of getting this broken at some update) is nodes are drawn in the same order they are defined. From comment 判断:
I used the following test nodes:
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'} ];
When not selected, these will draw in the node order:
Now, let's change the order:
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'} ];