admin管理员组文章数量:1317915
I am pushing edges in my react-flow setup. Suppose the edges are crossing each other; currently my edge labels render at the midpoint of an edge, so if the edges cross each other they render on top of each other. The user is not able to see the labels as they are stacked on-top of each other.
setEdges((eds) =>
eds.map((edge) => {
const tranformation_logic_from_data =
data[edge.target].columns[edge["targetHandle"].split("-")[1]];
if (tranformation_logic_from_data) {
logic = tranformation_logic_from_data.transformation_logic;
} else {
logic = "";
}
return {
...edge,
style: {
...edge.style,
/* stroke:
lineageType === "Variable"
? "#ccc"
: connectorColortoggle
? operationColorMap[
data[edge.target].table_transformation_logic
] || "#000"
: "#aaa", */
stroke: "#ccc",
strokeWidth:
lineageType === "Variable" ? 4 / zoomLevel : 4 / zoomLevel,
strokeDasharray: lineageType === "Variable" ? "" : "1, 8",
},
label: variableConnectorTextToggle ? logic : "",
labelStyle: {
fill: "#000",
fontWeight: 500,
fontSize: 20,
},
labelBgPadding: [30, 10],
labelBgStyle: { fill: "white", stroke: "#ccc", strokeWidth: 1 },
labelShowBg: true,
labelBgBorderRadius: 8,
};
})
);
If I remove the background of a label from the code: "labelShowBg: false"
Now we see how some labels have other labels stacked under them
Is there any solution to this problem, I have tried figuring out edge length and setting label location based on that, but if edge lengths are same, it creates an issue there
If label background is on, the lower-level edge labels are not visible
Edit: I have also tried using EdgeLabelRenderer , to try to make a sort of collision detection system, but no luck using that also
本文标签: reactjsWhy Are Edge Labels Overlapping in ReactflowStack Overflow
版权声明:本文标题:reactjs - Why Are Edge Labels Overlapping in React-flow? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742023459a2415110.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论