G6: 自定边的labelAutoRotate属性不生效

Created on 3 Aug 2020  ·  1Comment  ·  Source: antvis/G6

官网的自定义边的第三个例子,文字并没有跟着线自动旋转

Most helpful comment

你的自定义边绘制逻辑中没有控制旋转的逻辑,就不会旋转呀。内置边写好了跟随便旋转的逻辑才可以的。

可以这样写:

const label = group.addShape('text', {...});
label.rotateAtStart(rotate); // rotate 是旋转角度,根据边的斜率确定

>All comments

你的自定义边绘制逻辑中没有控制旋转的逻辑,就不会旋转呀。内置边写好了跟随便旋转的逻辑才可以的。

可以这样写:

const label = group.addShape('text', {...});
label.rotateAtStart(rotate); // rotate 是旋转角度,根据边的斜率确定
Was this page helpful?
0 / 5 - 0 ratings