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

If onlySquare is enabled, execute fitImage on display. #777

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hanawat
Copy link

@hanawat hanawat commented Dec 15, 2022

#776

To fix above issue.

If onlySquare is enabled when displaying an Asset, call fitImage to crop it to a square.

You can see how it works in the sample apps in the feature/demo branch.
https://github.com/hanawat/YPImagePicker/tree/feature/demo

Before After
スクリーンショット 2022-12-15 21 33 07 スクリーンショット 2022-12-15 21 33 21

keremcesme

This comment was marked as outdated.

Copy link

@keremcesme keremcesme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same code needs to be added for setImage() function as well.

@ramboli1986
Copy link

With this fix, the selected image view can't be moved up when scrolling. Can you take a look?

@hanawat
Copy link
Author

hanawat commented Feb 17, 2023

@keremcesme Thank you for your review. Videos in the library also used fitImage.

@hanawat
Copy link
Author

hanawat commented Feb 17, 2023

@ramboli1986 Did you run that in the sample app? I checked and it works fine in the sample app.

@ramboli1986
Copy link

ramboli1986 commented Feb 22, 2023

@ramboli1986 Did you run that in the sample app? I checked and it works fine in the sample app.

Nvm, I can't repo it any more. Thanks for the fix.

Comment on lines 79 to 82
strongSelf.squaredZoomScale = strongSelf.calculateSquaredZoomScale()
if YPConfig.library.onlySquare {
strongSelf.fitImage(true)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can replace it with

strongSelf.fitImage(YPConfig.library.onlySquare || YPConfig.library.isSquareByDefault)

squaredZoomScale is calculated in fitImage()

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.

4 participants