Skip to content

Commit a57202d

Browse files
committed
fix(clip): add extra clip to prevent unexpected clip on certain scenario. close #19051
1 parent b37d67c commit a57202d

File tree

2 files changed

+100
-3
lines changed

2 files changed

+100
-3
lines changed

src/chart/helper/createClipPathFromCoordSys.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ function createGridClipPath(
5151
height += lineWidth;
5252

5353
// fix: https://github.com/apache/incubator-echarts/issues/11369
54-
x = Math.floor(x);
55-
width = Math.round(width);
54+
width = Math.ceil(width);
55+
if (x !== Math.floor(x)) {
56+
x = Math.floor(x);
57+
// if no extra 1px on `width`, it will still be clipped since `x` is floored
58+
width++;
59+
}
5660

5761
const clipPath = new graphic.Rect({
5862
shape: {
@@ -165,4 +169,4 @@ export {
165169
createGridClipPath,
166170
createPolarClipPath,
167171
createClipPath
168-
};
172+
};

test/clip-line-cap.html

Lines changed: 93 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)