Skip to content
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

optimize fillcropscpace imagefit #45

Merged
merged 5 commits into from
Oct 26, 2023
Merged

Conversation

YumengNevix
Copy link
Contributor

  1. ensure crop area will not move out image
  2. ensure croped image has no white border

@ikbendewilliam
Copy link
Collaborator

Works pretty good, one issue I see is that if you zoom out and then in, its not allowed.

@YumengNevix
Copy link
Contributor Author

Works pretty good, one issue I see is that if you zoom out and then in, its not allowed.

Pre implementation only support angle which is integer multiple of pi/2, latest commit supports any angle, so this issue should be fixed.

@ikbendewilliam
Copy link
Collaborator

Some great work already!
The angle wasn't the issue, previously if I zoomed out using the buttons everything was good, then zooming in with the buttons would result in a zoom level of 0,9975 which didn't work (1.33 x 0.75), I guess that was on the numbers I used, if we used 1.34 it would have worked.
That being said, the zoom buttons now don't work at all now when this is enabled (unless I first zoom out with gestures), which is a bigger issue.
Also if I turn left once, then turn right once (using the buttons), the image is zoomed out.

@YumengNevix
Copy link
Contributor Author

Some great work already! The angle wasn't the issue, previously if I zoomed out using the buttons everything was good, then zooming in with the buttons would result in a zoom level of 0,9975 which didn't work (1.33 x 0.75), I guess that was on the numbers I used, if we used 1.34 it would have worked. That being said, the zoom buttons now don't work at all now when this is enabled (unless I first zoom out with gestures), which is a bigger issue. Also if I turn left once, then turn right once (using the buttons), the image is zoomed out.

  1. The zoom out bug is caused by _getDistanceBetweenPointAndLine, it may result in NaN,so I prevent the scale op.
  2. The zoom in bug is caused by _calculateScaleAfterRotate, when data.scale is less than 1.0, startScale is 1.33, endScale is 1.4, binary search range should be [data.scale, endScale] rather than [startScale, endScale], after modify implementation, it will result in 1.0 rather than 1.33.
  3. When user rotate, scale will change automatically to ensure fully cover path, it's by design, not bug.

@ikbendewilliam
Copy link
Collaborator

Works great! Thank you!

@ikbendewilliam ikbendewilliam merged commit ec342f6 into icapps:main Oct 26, 2023
3 checks passed
@ikbendewilliam
Copy link
Collaborator

released in 0.0.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants