Skip to content

[Bug]: edge key showing behind edge label background #7341

@curious-broccoli

Description

@curious-broccoli

Describe the bug / 问题描述

problem

the edge key shows through a label text background, even with the default opacity of 1

Image

expected

the edge key should be invisible behind the background (when opacity is 1)

Image

this was the case in 4.x with the following config

defaultEdge: {
    labelCfg: {
        style: {
            opacity: 0.8,
            fill: "#111111",
            background: {
                fill: "#ffffff",
                padding: [2, 2, 2, 2], // necessary for background
            },
        },
    },
},

Reproduction link / 复现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

import { Graph } from '@antv/g6';

const data = {
  nodes: [
    {
      id: 'node-1',
      style: { x: 100, y: 150, labelText: 'Hover me!' },
    },
    {
      id: 'node-2',
      style: { x: 300, y: 150, labelText: 'Hover me!' },
    },
  ],
  edges: [{ source: 'node-1', target: 'node-2', style: { labelText: 'Hover me!' } }],
};

const graph = new Graph({
  container: 'container',
  data,
  behaviors: ['drag-element'],
  edge: {
    style: {
      labelBackgroundFill: "#ffffff",
      labelPadding: [2, 2, 2, 2],
      labelBackground: true,
      labelBackgroundFillOpacity: 1,
    }
  },
  behaviors: ["zoom-canvas", "drag-canvas"]
});

graph.render();

Version / 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他

Metadata

Metadata

Assignees

No one assigned

    Labels

    question 💬This issue is just a question. It will be converted into discussion automatically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions