-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add position reset button and update zoom interaction. (#292) (#345) #372
base: dev
Are you sure you want to change the base?
Add position reset button and update zoom interaction. (#292) (#345) #372
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
@kosamari @mustafa-x @developit @surma what do you think about this? Clicking zoom buttons centers image. I think we debated this at some point, but I think it might make sense, especially if the image at the destination zoom can be contained within the view. Maybe not when it covers the view. The zoom seems to have a minimum of 25% which seems too high. Also, it feels like the steps should be more exponential. Reset button. I expected it to also reset zoom to 100%. I'm not sure if this is useful. I haven't really looked at the code yet, so I'm just looking at the interactions. |
@jakearchibald thanks a lot for the initial reviews, |
Ping @kosamari @mustafa-x @developit @surma. Curious to know your thoughts on this feature. |
Thanks @alisaitbilgi for working on this! Here’s my feedback:
|
The rotate glitch is unrelated to this PR. I think that happened once we started debouncing encoding. |
@jakearchibald , @surma and @mustafa-x thanks a lot for the reviews. Here are my ideas:
What do you think? |
That sounds reasonable! I’d have to actually play with it to see if it makes sense, but it sounds good on paper! |
Thanks a lot @surma , I'm planning to use Intersection Observer API but, haven't decided the threshold value yet, I think it is better to see then decide. |
Here is the implementation @surma , @jakearchibald , @mustafa-x. The thing that I'm not sure about the intersection observation behavior is that, I'm not tracking the next position after zoom out/in buttons are triggered. Actually after target element has lost its visibility 50%, next zoom out/in button interaction will cause the image to reset its position. |
By the way, sorry about forgotten intersection observer polyfill. I don't know the right way is whether to install polyfill or just feature detect the API? |
Thank you @surma :)
What do you think? |
Related issue: w3c/IntersectionObserver#345 |
Here is the implementation @surma , I've just added a ( weird :) ) checkbox on top-right corner, so that we can see the difference between controlling 'wheel event' or not. |
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. Googlers can find more info about SignCLA and this PR by following this link. |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the Googlers can find more info about SignCLA and this PR by following this link. |
Hey @surma , I think I made things more complicated while fixing my 'commit author' mistake. :) I was using my brother's computer and his name has appeared as commit author for my 2 commits. (1dceeae and 868e8bb I've tried to update them but since one of them (1dceeae) is a merge commit, the situation got complicated. What do you think? |
Uh, this looks a bit messy, doesn’t it 😂 I’d say we just squash them and go from there. You comfortable doing that? Otherwise, with your permission, I can do it for you. |
Thanks a lot for the help :) , do you mean to squash my latest (messy) commits? |
Yeah, basically turn this PR into a single commit based on current master, and then we can go from there :) |
Sorry for late response, @surma. I am not sure about squashing merge commits and re-writing their history. I hope, didn't make things much more complicated. |
1c5510f
to
9c81312
Compare
@alisaitbilgi I fixed it for you :) Please make sure you reset your local branch appropriately. In case you don’t know how that works, here is a step-by-step:
(You might have to replace |
Thanks a lot and done :) What about the PR then? |
Right! So this looks good to me! Imma hand the final LGTM to @jakearchibald for a sanity check. Thanks so much @alisaitbilgi |
Can someone write a summary of what the intended changes are from a user perspective? Right now, if I open the image of the red panda, position its eye in the centre, and start pressing +, at some point the image jumps so I'm no longer zooming into the eye. It isn't clear if this is an error or intended behaviour. Also, if I double click the % value, I get "Processing error". I'm assuming that isn't intended behaviour 😄. |
We decided to make 2 things:
Yeah, I was looking at that error. I was using '360' for rotation value and now updating as '0'. (this will fix) On the other hand, found one more error for development mode and investigating to fix it. HMR cannot dynamically import 'intersection-observer-polyfill' and throws an error. |
9c81312
to
04846ae
Compare
Here are the updates @surma.
I thought, writing a dev-only code is really a bad idea. So, only swap lines as a workaround.
|
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.
-
Double-clicking the percentage to reset works for me without a processing error. @jakearchibald can you confirm?
-
The +/- buttons are still confusing. I don’t the the position should reset when I zoom into a part of a picture. It should only reset once the image is completely invisible in my opinion.
src/lib/offliner.ts
Outdated
@@ -49,6 +49,8 @@ export async function offliner(showSnack: SnackBarElement['showSnackbar']) { | |||
navigator.serviceWorker.register('../sw'); | |||
} | |||
|
|||
if (!('serviceWorker' in navigator)) return; |
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.
This should happen before the register
call.
04846ae
to
a52ad38
Compare
Fix set-rotation and HMR issues Fix offliner.ts dev env issue. GoogleChromeLabs#342 Reset position only if image gets totally lost from the viewport Migrate service worker existenceny check before its register call Fix re-compression issue ocurring after double click
a52ad38
to
c8ba364
Compare
There are two things that I am not sure about. First one is reset button's icon. I left it as "reset" but i think, it is better to replace it with a meaningful icon :) and secondly, I just thought that for each zoom interaction triggered by zoom-in / zoom-out buttons, we should center the image in order not to loose it. When image is close to corners, if zoom-in / zoom-out buttons are pressed, it is getting disappeared. Other than those, I hope I could be useful :)