Skip to content

Commit

Permalink
Merge pull request #19056 from RexSkz/fix-19051
Browse files Browse the repository at this point in the history
fix(clip): add an extra space to the clip-path width to prevent unexpected clip. close #19051
  • Loading branch information
Ovilia authored Sep 19, 2023
2 parents b37d67c + a57202d commit fa231d3
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/chart/helper/createClipPathFromCoordSys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ function createGridClipPath(
height += lineWidth;

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

const clipPath = new graphic.Rect({
shape: {
Expand Down Expand Up @@ -165,4 +169,4 @@ export {
createGridClipPath,
createPolarClipPath,
createClipPath
};
};
93 changes: 93 additions & 0 deletions test/clip-line-cap.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fa231d3

Please sign in to comment.