@@ -5,10 +5,16 @@ import { ComponentTypeEnum } from '../interface/type';
55import type { AxisCurrentValueMap , IPolarCrosshairInfo , IPolarCrosshairSpec } from './interface' ;
66import { isDiscrete } from '@visactor/vscale' ;
77import { Tag } from '@visactor/vrender-components' ;
8- import { LineCrosshair , SectorCrosshair , CircleCrosshair , PolygonCrosshair } from '@visactor/vrender-components' ;
8+ import {
9+ LineCrosshair ,
10+ SectorCrosshair ,
11+ CircleCrosshair ,
12+ PolygonCrosshair ,
13+ PolygonSectorCrosshair
14+ } from '@visactor/vrender-components' ;
915import type { IPolarAxis } from '../axis/polar/interface' ;
1016import type { IPoint , StringOrNumber , TooltipActiveType , TooltipData } from '../../typings' ;
11- import type { IAxisInfo , IHair , IHairRadius } from './base' ;
17+ import type { IAxisInfo , IHair , IPolarHair } from './base' ;
1218import { BaseCrossHair } from './base' ;
1319import type { Maybe } from '@visactor/vutils' ;
1420import { polarToCartesian , PointService , isArray , isNil } from '@visactor/vutils' ;
@@ -32,8 +38,8 @@ export class PolarCrossHair<T extends IPolarCrosshairSpec = IPolarCrosshairSpec>
3238 private _currValueAngle : AxisCurrentValueMap ;
3339 private _currValueRadius : AxisCurrentValueMap ;
3440
35- private _angleHair : IHair | undefined ;
36- private _radiusHair : IHairRadius | undefined ;
41+ private _angleHair : IPolarHair | undefined ;
42+ private _radiusHair : IPolarHair | undefined ;
3743
3844 private _cacheAngleCrossHairInfo : IPolarCrosshairInfo | undefined ;
3945 private _cacheRadiusCrossHairInfo : IPolarCrosshairInfo | undefined ;
@@ -267,9 +273,11 @@ export class PolarCrossHair<T extends IPolarCrosshairSpec = IPolarCrosshairSpec>
267273 }
268274
269275 const container = this . getContainer ( ) ;
270- const { angle, radius, label, center, visible } = crosshairInfo ;
276+ const { angle, radius, label, center, visible, axis } = crosshairInfo ;
271277 if ( visible ) {
272- const crosshairType = this . _angleHair . type === 'rect' ? 'sector' : 'line' ;
278+ const isSmooth = this . _angleHair . smooth === true ;
279+ const crosshairType = this . _angleHair . type === 'rect' ? ( isSmooth ? 'sector' : 'polygon-sector' ) : 'line' ;
280+
273281 const positionAttrs = layoutAngleCrosshair ( this . _angleHair , crosshairInfo ) ;
274282
275283 if ( this . _angleCrosshair ) {
@@ -297,6 +305,20 @@ export class PolarCrossHair<T extends IPolarCrosshairSpec = IPolarCrosshairSpec>
297305 zIndex : this . gridZIndex ,
298306 pickable : false
299307 } ) ;
308+ } else if ( crosshairType === 'polygon-sector' ) {
309+ crosshair = new PolygonSectorCrosshair ( {
310+ ...( positionAttrs as {
311+ center : IPoint ;
312+ innerRadius : number ;
313+ radius : number ;
314+ startAngle : number ;
315+ endAngle : number ;
316+ } ) ,
317+ offset : axis . getSpec ( ) ?. offset ?? 0.5 ,
318+ polygonSectorStyle : this . _angleHair . style ,
319+ zIndex : this . gridZIndex ,
320+ pickable : false
321+ } ) ;
300322 }
301323 this . _angleCrosshair = crosshair as unknown as IGroup ;
302324 // 添加至场景树
@@ -389,6 +411,7 @@ export class PolarCrossHair<T extends IPolarCrosshairSpec = IPolarCrosshairSpec>
389411 const { categoryField, valueField } = this . _spec as IPolarCrosshairSpec ;
390412 if ( categoryField && categoryField . visible ) {
391413 this . _angleHair = this . _parseField ( categoryField , 'categoryField' ) ;
414+ this . _angleHair . smooth = categoryField ?. line ?. smooth ;
392415 }
393416 if ( valueField && valueField . visible ) {
394417 this . _radiusHair = this . _parseField ( valueField , 'valueField' ) ;
0 commit comments