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

Feature/alignment #76

Merged
merged 12 commits into from
Jan 23, 2019
Merged

Feature/alignment #76

merged 12 commits into from
Jan 23, 2019

Conversation

natario1
Copy link
Owner

@natario1 natario1 commented Jan 12, 2019

Fixes #75

@natario1 natario1 requested a review from markusressel January 12, 2019 15:47
Copy link
Collaborator

@markusressel markusressel left a comment

Choose a reason for hiding this comment

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

Great work!
Again just fyi: I did not test this in any way.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
|`fromTransformation`|The content will respect the gravity parameter of the transformation (which defaults to `Gravity.CENTER` as well).|
|`none`|The content is free to be moved around inside the container bounds.|
**Note: alignment does not make sense when content is larger than the container, because forcing an
alignment (e.g. left) would mean making part of the content unreachable (e.g. the right part).**
Copy link
Collaborator

Choose a reason for hiding this comment

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

[...] so it is only applied when the content is smaller than the container (e.g. zoom < 1)

Copy link
Owner Author

Choose a reason for hiding this comment

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

I will address all these in a while. But wanted to say that zoom < 1 does not necessarily mean that content is smaller than container. It does only with CENTER_CROP or CENTER_INSIDE transformations and even then, it depends on the axis.

Just saying because I have seen this check (zoom < 1F) in the pivot function, and I don't know if it's correct or not. I'm tempted to say that it's not, and I also wonder if that should be changed according to the alignment? Not sure.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm yes that makes sense. I guess I was lucky in my testing.

Yes I think so too. As i mentioned in the comment there I initially wanted to base it on the transformationGravity but as the alignment will be the new thing after this PR it should be based on it instead.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Can you explain what that function should return? It's not 100% clear to me, I didn't investigate, but I can try to update

Copy link
Collaborator

@markusressel markusressel Jan 14, 2019

Choose a reason for hiding this comment

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

Well the function decides what pivot point should be used for the zoom animation based on what corner of the screen is currently overscrolled (or will be, with the target zoom applied). I did this because applying the pan fix and the zoom fix at the same time in an animation when overscrolled while zoomed in a bit (specifically overpinching and overscrolling at the same time in a single pinch gesture) didn't result in the expected target position and/or a funky animation. Implementing this was a bit of trial and error tbh and I think this method is only applicable when the content is zoomed in meaning that at most two sides of the content are overscrolled/have visible gray areas. Because of that I added the zoom < 1 condition which just takes the center of the screen as the pivot point when the view has more than two gray areas around it (which doesn't seem to be the correct way of figuring that out). My current guess would be that this should be based on the alignment instead of just using the center when there are more than two gray areas but this whole method (and it's purpose) may require a complete rethinking.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I understand. Looks like it might take some time, I think I will merge this now and we'll fix later.

README.md Show resolved Hide resolved
library/src/main/java/com/otaliastudios/zoom/ZoomEngine.kt Outdated Show resolved Hide resolved
library/src/main/java/com/otaliastudios/zoom/ZoomEngine.kt Outdated Show resolved Hide resolved
library/src/main/java/com/otaliastudios/zoom/ZoomEngine.kt Outdated Show resolved Hide resolved
library/src/main/java/com/otaliastudios/zoom/ZoomEngine.kt Outdated Show resolved Hide resolved
@natario1 natario1 merged commit fc08082 into master Jan 23, 2019
@natario1 natario1 deleted the feature/alignment branch January 23, 2019 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants