-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(clip): add an extra space to the clip-path width to prevent unexpected clip. close #19051 #19056
Conversation
Thanks for your contribution! |
@Ovilia Done; please take a look and notify me if there are other suggestions :) |
How about triggering the workflow? I'll quickly fix the raised issue if there is one :) |
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19056@a57202d |
It looks good :) |
Hi, I checked the demo with 5.4.3 and it seems not to be clipped. Did I miss anything here? |
Slightly resize the page to a specific width (e.g. The correct behaviour should be: |
Oh, it seems that using I'll change my code and see if it works well. |
Hi @Ovilia, I've made changes to my code and the content of this PR. Please have a look, it should be a lot simpler than the previous version~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. Please don't use force push in your next PR because we'd like to record every commit changes. Don't worry if there are too many commits. The reviewer will use squash push when necessary.
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
Brief Information
This pull request is in the type of:
What does this PR do?
Add an extra space to the clip-path
width
. This will prevent the unexpected clip.Fixed issues
Details
Before: What was the problem?
As the example https://codepen.io/rexskz/pen/WNLweyw shows, the rightmost position of the line that has
cap: 'round'
is clipped incorrectly, while the leftmost part is okay.This issue only happens on the device with
devicePixelRatio >= 3
, and the chart canvas must have a special width.After: How does it behave after the fixing?
The rightmost position of the line should not be clipped.
This is caused by a round-off error.
Let's see if the rect is:
Browsers will render the clip-path using
rect
but handle the value as integers, so the original code convertsx
andwidth
to integers:The result is 1.2 less, meaning the graph's rightmost
1.2px
will be clipped.To make sure the clip-path wraps the whole graph, the
x
should keep floored, but thewidth
should be ceiled (not rounded), and ifx
is floored,width
should be add an extra1px
.P.S. During the visual test, I found that some cases may also be clipped incorrectly before, and will be corrected in this PR, for example:
Document Info
One of the following should be checked.
Misc
ZRender Changes
Related test cases or examples to use the new APIs
N.A.
Others
Merging options
Other information