From 3dfb9e7adc071703be2c04221902f065f6a74554 Mon Sep 17 00:00:00 2001 From: Frank William <65594180+ai-qing-hai@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:46:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(pointmove):=20=E4=BF=AE=E5=A4=8D=20pointmov?= =?UTF-8?q?e=20=E4=BA=8B=E4=BB=B6=E7=9A=84=E4=B8=A4=E4=B8=AA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#6136)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: wb-xcf804241 --- src/interaction/elementPointMove.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/interaction/elementPointMove.ts b/src/interaction/elementPointMove.ts index 8aa76470a5..89fb5ffda3 100644 --- a/src/interaction/elementPointMove.ts +++ b/src/interaction/elementPointMove.ts @@ -272,12 +272,12 @@ export function ElementPointMove( const createPoints = (element) => { const { attributes, markType, __data__: data } = element; const { stroke: fill } = attributes; - const { points, seriesTitle, color, title, seriesX } = data; + const { points, seriesTitle, color, title, seriesX, y1 } = data; // Transpose Currently only do mark interval; if (isTranspose && markType !== 'interval') return; const { scale, coordinate } = newState?.view || view; - const { color: scaleColor, y: scaleY } = scale; + const { color: scaleColor, y: scaleY, x: scaleX } = scale; const center = coordinate.getCenter(); pointsGroup.removeChildren(); @@ -324,7 +324,8 @@ export function ElementPointMove( if (['line', 'area'].includes(markType)) { points.forEach((p, index) => { - const title = seriesTitle[index]; + const title = scaleX.invert(seriesX[index]); + // Area points have bottom point. if (!title) return; @@ -545,8 +546,8 @@ export function ElementPointMove( points[1], ); const lastPercent = coordinate.invert([newXOut, newYOut])[1]; - const nextPercent = coordinate.invert(points[3])[1]; - const percent = nextPercent - lastPercent; + const percent = y1 - lastPercent; + if (percent < 0) return; const newPath = getThetaPath( center,