App icon indicating copy to clipboard operation
App copied to clipboard

[Hold for Payment - Sep 7th] Web - Attachments Preview - Zooming in the edges of an image will lead to white spaces

Open kavimuru opened this issue 5 years ago • 71 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Open any chat
  2. Send an image as attachment
  3. Click on it in order to have larger preview
  4. Click on any edges in order to zoom it

Expected Result:

Picture is zoomed and picture fills whole preview dialogue

Actual Result:

Picture is zoomed, but there is a lot of white spaces

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platform:

Where is this issue occurring?

Web ✔️ iOS Android Desktop App Mobile Web

Version Number: 1.0.75-5 Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos:

https://user-images.githubusercontent.com/43996225/124826208-9379ca00-df42-11eb-9566-11d31750b082.mp4

Bug5142406_actual_result

Expensify/Expensify Issue URL: https://github.com/Expensify/Expensify/issues/170015

Upwork job posting: Posted to Upwork: https://www.upwork.com/jobs/~014d8cadbc82d362b0

View all open jobs on Upwork

kavimuru avatar Jul 07 '21 20:07 kavimuru

Triggered auto assignment to @francoisl (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Jul 07 '21 20:07 MelvinBot

Looks like this can be external

francoisl avatar Jul 07 '21 22:07 francoisl

Triggered auto assignment to @NicMendonca (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Jul 07 '21 22:07 MelvinBot

What's the expected behavior here? Looks like the app kinda centers the image on the point where we're zooming in. https://github.com/Expensify/Expensify.cash/blob/f11d808f6358ba57ae02a1d392229dbd38491afd/src/components/ImageView/index.js#L95-L104 I feel like this is the correct behavior, but it also means that if we zoom on the edge there will be blank spots.

rdjuric avatar Jul 07 '21 22:07 rdjuric

@rdjuric that question might be better suited for #expensify-open-source.

NicMendonca avatar Jul 08 '21 14:07 NicMendonca

Triggered auto assignment to @roryabraham (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

MelvinBot avatar Jul 08 '21 14:07 MelvinBot

What's the expected behavior here

My thinking here is that we should center the image on the point we're zooming in on, but if we're within a specific distance of any edge, then we'd shift the zoomed-in section accordingly. Something like this:

Untitled Diagram (1)

So if the point where we've clicked (the center of the zoom) is in any of the "gutters", then we'll shift the image horizontally and/or vertically as needed so that the zoomed-in size will fit within the bounds of the image.

roryabraham avatar Jul 08 '21 23:07 roryabraham

Issue reproducible during KI retests

isagoico avatar Jul 12 '21 14:07 isagoico

Hi @rdjuric! Based off @roryabraham's comment, are you keen to submit a proposal for this?

NicMendonca avatar Jul 12 '21 15:07 NicMendonca

@NicMendonca Still researching this one 😅

Thanks for the picture, @roryabraham. So I think the behavior we want is what we have in the video below?

https://user-images.githubusercontent.com/53711423/125832688-777fcb5c-916b-4aff-9de5-7c274ad0c898.mov

rdjuric avatar Jul 15 '21 17:07 rdjuric

It looks to me like it might not be working perfectly in the y-axis, but yeah that's prettymuch what I had in mind.

roryabraham avatar Jul 15 '21 22:07 roryabraham

I have to reassign this to someone else while I'm OOO

roryabraham avatar Jul 16 '21 22:07 roryabraham

Triggered auto assignment to @tgolen (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

MelvinBot avatar Jul 16 '21 22:07 MelvinBot

Issue reproducible during KI retests

isagoico avatar Jul 19 '21 09:07 isagoico

@rdjuric Could you submit a proposal for this, please? It looks like the behavior in the video is pretty close to what's desired.

tgolen avatar Jul 19 '21 16:07 tgolen

@rdjuric bump! Please let us know if you are still interested in submitting a proposal.

NicMendonca avatar Jul 23 '21 12:07 NicMendonca

Issue reproducible during KI retests

isagoico avatar Jul 26 '21 01:07 isagoico

@tgolen I'm back from OOO, so I can take this back now.

roryabraham avatar Jul 26 '21 22:07 roryabraham

New Upwork job posting. Doubled the price since there hasn't been any proposals in a week: https://www.upwork.com/jobs/~0134dee8788c30ccc5

NicMendonca avatar Jul 27 '21 16:07 NicMendonca

@roryabraham I looked at this a bit more and looks like there're more issues at play:

  1. An image that is smaller than the size of the viewport isn't being zoomed
  2. The zoom is done on the View that surrounds the image, so it doesn't correctly give a point in the image to zoom in.

Point (1) happens because we're "zooming" by increasing the height/width of our Image component to 250% while using resizeMode="center", this will only increase the size of the image if it was being scaled down by the resize - i.e, only when the image isn't bigger than the Image component.

Assuming that we fix (1), I don't think it's possible to "not show any blank spaces around the image" if our zoom is constant (like the 2.5x we use here) and our AttachmentModal is bigger than the image. Imagine that we have an image with size 100px x 100px, we zoom it so it's 250px x 250px. If our AttachmentModal (which has a size based on the window dimension) is bigger than 250px x 250px we're necessarily going to have white spaces around the image after zooming.

If we really don't want white spaces around the image, I think we must either:

  • Make the size of our AttachmentModal equal to the size of the attachment it's rendering
  • Change our zoom to always make the image fill the viewport. This would lead to different levels of zoom depending on the original size of the image.

rdjuric avatar Jul 27 '21 18:07 rdjuric