gpt4 book ai didi

javascript - 如何在 mxgraph 中插入没有背景的图像

转载 作者:行者123 更新时间:2023-12-02 22:40:33 25 4
gpt4 key购买 nike

只是试图将图像插入到我的图表中,但它给了我图像以及带有黑色边框的白色背景。我尝试过设置不透明度、图像背景等。我不确定这是从哪里来的,因为我插入的背景有透明背景。

enter image description here

    let parent = graph.getDefaultParent();
graph.getModel().beginUpdate();
try
{
let v2 = graph.insertVertex(parent, null, '', 0,0,40,40, 'image=images/help.png;selectable=0;connectable=0;editable=0;movable=0;');
}
finally
{
graph.getModel().endUpdate();
}

最佳答案

您可以创建自定义样式,如本示例 https://jgraph.github.io/mxgraph/javascript/examples/images.html 。在你的情况下足够设置风格图像。图像样式没有边框。 graph.insertVertex(parent, null, '', 0,0,40,40,'image;image=images/help.png;selectable=0;connectable=0;editable=0;movable=0;');

关于javascript - 如何在 mxgraph 中插入没有背景的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58607730/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com