From c671a2aabb6447318654bb408fe3f1bd8681cfa2 Mon Sep 17 00:00:00 2001 From: xiaoluoHe Date: Tue, 24 Dec 2024 16:11:17 +0800 Subject: [PATCH] refactor: reuse util function --- .../vrender-components/src/crosshair/polygon-sector.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/vrender-components/src/crosshair/polygon-sector.ts b/packages/vrender-components/src/crosshair/polygon-sector.ts index fbefdacc5..5aad7e924 100644 --- a/packages/vrender-components/src/crosshair/polygon-sector.ts +++ b/packages/vrender-components/src/crosshair/polygon-sector.ts @@ -9,6 +9,7 @@ import { CrosshairBase } from './base'; import type { PolygonSectorCrosshairAttrs } from './type'; import type { ComponentOptions } from '../interface'; import { loadPolygonSectorCrosshairComponent } from './register'; +import { getPolygonPath } from '../axis'; loadPolygonSectorCrosshairComponent(); export class PolygonSectorCrosshair extends CrosshairBase { @@ -32,17 +33,11 @@ export class PolygonSectorCrosshair extends CrosshairBase { - if (index === 0) { - return `M${cur.x},${cur.y}`; - } - return acc + `L${cur.x},${cur.y}`; - }, ''); const polygon = container.createOrUpdateChild( 'crosshair-polygon-sector', { - path, + path: getPolygonPath(points, true), ...polygonSectorStyle }, 'path'