Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Cytoscape.js:节点背景图像问题_Javascript_Svg_Background_Cytoscape - Fatal编程技术网

Javascript Cytoscape.js:节点背景图像问题

Javascript Cytoscape.js:节点背景图像问题,javascript,svg,background,cytoscape,Javascript,Svg,Background,Cytoscape,我无法将svg图像设置为节点的背景。 当我开始拖动它时,它总是在Chrome中重新缩放图像(即使背景高度固定),firefox甚至不会显示它 我已经测试了很多属性来解决它,但没有得到它 var cy = cytoscape({ container: document.getElementById('cy'), style: [{ selector: "node", style: { 'background-image': 'https://cdn.rawgi

我无法将svg图像设置为节点的背景。 当我开始拖动它时,它总是在Chrome中重新缩放图像(即使背景高度固定),firefox甚至不会显示它

我已经测试了很多属性来解决它,但没有得到它

var cy = cytoscape({
  container: document.getElementById('cy'),
  style: [{
    selector: "node",
    style: {
       'background-image': 'https://cdn.rawgit.com/energiekollektiv/saiv/dev/images/icons/demand.svg',
       'background-width-relative-to': 'inner',
       'background-height-relative-to': 'inner',
       'background-width': '20px',
       'background-height': '20px'
    }
  }]
})

data.forEach(function(node) {
   cy.add({
     group: "nodes"
   })
})
cy.makeLayout({name: "circle"}).run()
您可以在此处查看:


我真的不明白这个问题,似乎可以正常工作这里有两个问题的图像:没有单击和背景图像缩放的位置更改
'background-image':'https://cdn.rawgit.com/energiekollektiv/saiv/dev/images/icons/demand_test.png“,
(img到png)修复了所有问题。甚至尝试用lnkscape重新创建svg。没有成功我看到完全相同的问题,使用png解决了这个问题