-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add a new 'precisePreview' option #300
Conversation
Canvas context is translated by width/2, height/2 before applying transformations and should be translated back by the same values, not the rounded ones.
When true it takes rounding errors into account and makes the preview exactly match the cropped result
…recise-preview-option
Codecov Report
@@ Coverage Diff @@
## master #300 +/- ##
==========================================
- Coverage 72.63% 72.27% -0.36%
==========================================
Files 9 9
Lines 1535 1544 +9
==========================================
+ Hits 1115 1116 +1
- Misses 420 428 +8
Continue to review full report at Codecov.
|
@daiyam I resolved the conflicts but this PR was there for more than 3 years now w/o any attention. So I'm not sure if it's worth investing more time into adding tests as it looks like it may never be merged. |
@lexiv0re Thank you for the PR and the update :) |
Will some version of a fix like this be merged? It seems like it solves some important bugs (e.g. #551). |
cb5ac44
to
aa96a51
Compare
a367d75
to
3375ce0
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #300 +/- ##
==========================================
- Coverage 72.63% 72.27% -0.36%
==========================================
Files 9 9
Lines 1535 1544 +9
==========================================
+ Hits 1115 1116 +1
- Misses 420 428 +8 ☔ View full report in Codecov by Sentry. |
V2 has implemented this feature. |
An attempt to implement a workaround for fengyuanchen/cropper#969.
A new option is proposed to control the desired behavior. Due to the default value compatible with the existing behavior, it does not introduce any breaking changes.
With this option enabled it applies rounding in the calculation of the preview size and position similar to what being applied during the crop process.
Also, fixes inaccuracy (for images with odd height/width) in source canvas transformations (scale/rotate).