antvis/G6

Do you want to work on this issue?

You can request for a bounty in order to promote it!

[Bug]: The tooltip plugin can display a single line label when clicking, but it does not display when clicking a multi-line label #6707

ShichuanZhang posted onGitHub

Describe the bug / 问题描述

demo如下

<template>
    <div style="height: 100vh;">
        <div id="mountNode"></div>
    </div>
</template>
<script>
import { Graph } from '@antv/g6';
import { Renderer as SVGRenderer } from '@antv/g-svg';

export default {
    mounted() {
        const graph = new Graph({
            container: document.getElementById('mountNode'),
            width: 1000,
            height: 1000,
            renderer: () => new SVGRenderer(),
            node: {
                style: {
                    labelWordWrap: true,
                    labelWordWrapWidth: 80,
                    labelMaxLines: 4,
                }
            },
            plugins: [
                {
                    type: 'tooltip',
                    trigger: 'click',
                    getContent: (event, items) => {
                        return "123"
                    },
                },
            ],
        });
        graph.addData({
            nodes: [{
                id: "node1",
                style: {
                    x: 100,
                    y: 100,
                    labelText: "这是一个很长的label这是一个很长的label"
                }
            },
            {
                id: "node2",
                style: {
                    x: 200,
                    y: 100,
                    labelText: "这是一个label"
                }
            }]
        })
        graph.render()
    }
}
</script>
<style scoped>
.mountNode {
    height: 100vh;
}
</style>

No response

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

No response

G6 Version / G6 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

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

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests