!!!###!!!title=自定义交互组件——VisActor/VTable 教程文档!!!###!!!!!!###!!!description=自定义渲染和自定义布局中的自定义图元,可以使用`VRender`提供的组件,目前支持的有以下组件:!!!###!!!

自定义交互组件

自定义渲染和自定义布局中的自定义图元,可以使用VRender提供的组件,目前支持的有以下组件:

TextAutoPoptip

TextAutoPoptip组件是VRender提供的一个交互组件,它的功能是在文本过长被省略时,hover到文本上,会自动弹出一个poptip,展示文本的全部内容。

使用TextAutoPoptip组件需要把相应的text图元配置pickable: true,开启交互,此时TextAutoPoptip组件在text图元被maxLineWidth属性省略时自动启动。如果想禁用组件保留交互,需要在text图元上配置disableAutoClipedPoptip属性为true

TextAutoPoptip组件弹出的poptip样式,可以在theme.textPopTipStyle中配置,部分常用属性如下:

NameTypeDescription
position'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb'poptip显示在相对于图元的位置
titlestring | string[] | number | number[]poptiptitle内容
titleStylePartial<ITextGraphicAttribute>poptiptitle内容的样式
titleFormatMethod(t: string | string[] | number | number[]) => string | string[] | number | number[]poptiptitle内容的format方法
contentstring | string[] | number | number[]poptipcontent内容,默认是完整字符串
contentStylePartialpoptipcontent内容的样式
contentFormatMethod(t: string | string[] | number | number[]) => string | string[] | number | number[]poptipcontent内容的format方法
spacenumbertitlecontent距离
paddingPaddingpoptip中的padding
panelBackgroundAttributes & ISymbolGraphicAttribute & {space?:number;}poptip中的背景样式
minWidthnumberpoptip中的最大宽度
maxWidthnumberpoptip中的最小宽度
maxWidthPercentnumberpoptip中的最大宽度百分比
visiblebooleanpoptip是否可见
visibleFunc(graphic: IGraphic) => booleanpoptip是否可见函数
dxnumberpoptipx方向偏移
dynumberpoptipy方向偏移