-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Receipts are displayed in the full size of canvas when not needed #42174
Receipts are displayed in the full size of canvas when not needed #42174
Conversation
@eVoloshchak Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
const getCanvasFitScale: GetCanvasFitScale = ({canvasSize, contentSize}) => { | ||
const shouldResize = shouldResizeToFit(canvasSize, contentSize); | ||
|
||
const scaleX = canvasSize.width / contentSize.width; | ||
const scaleY = canvasSize.height / contentSize.height; | ||
|
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.
I think we can get rid of shouldResizeToFit
altogether
const trueScaleX = canvasSize.width / contentSize.width;
const trueScaleY = canvasSize.height / contentSize.height;
const scaleX = trueScaleX > 1 ? 1 : trueScaleX;
const scaleY = trueScaleY > 1 ? 1 : trueScaleY;
@samilabud, could you please test if this works?
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.
Even simpler, we can use an already existing NumberUtils.clamp
instead of the ternary
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.
Oh that makes a lot of sense thank you!, it seems to be working:
receipt.resize.clamp.test.mp4
|
||
const scaleX = clamp(trueScaleX, 0, 1); |
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.
const scaleX = clamp(trueScaleX, 0, 1); | |
const scaleX = clamp(canvasSize.width / contentSize.width, 0, 1); |
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.
Done
|
||
const scaleX = clamp(trueScaleX, 0, 1); | ||
const scaleY = clamp(trueScaleY, 0, 1); |
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.
const scaleY = clamp(trueScaleY, 0, 1); | |
const scaleY = clamp(canvasSize.height / contentSize.height, 0, 1); |
Looks like the back end is having some problems, for me it's completely down, will resume testing when possible |
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.
- Go to home url / open the app
- Tap on Workspace chat
- Tap plus icon -- submit expense
- Submit an expense with below receipt attached
- Open the expense and tap on the receipt
@samilabud, the testing steps can be improved. It's better to overexplain, so the QA team can test this properly
- the test image isn't attached
- include the last step to actually check if the image is displayed correctly, zoom-in out work correctly, etc
Done, please double check 🙏🏼 |
Reviewer Checklist
Screenshots/VideosAndroid: Nativescreen-20240517-153701.1.mp4Android: mWeb ChromeScreen.Recording.2024-05-17.at.16.28.31.moviOS: NativeScreen.Recording.2024-05-17.at.16.16.28.moviOS: mWeb SafariScreen.Recording.2024-05-17.at.16.18.18.movMacOS: Chrome / SafariScreen.Recording.2024-05-17.at.16.14.26.movMacOS: DesktopScreen.Recording.2024-05-17.at.16.15.00.mov |
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.
LGTM!
@samilabud you should be able to merge |
Thanks. I'll merge when the merge freeze is over. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
looks like this might have caused this deploy blocker, can you please take a look #43050? |
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.79-11 🚀
|
Details
We are using the MultigestureCanvas to display the image/receipt, this component always try to fit the image to the content, this works perfectly for image that are bigger than the canvas size but when the image is lower than the canvas we can notice this issue.
We should verify if we need to use the scale to fit the canvas size before we try to fit the image in getCanvasFitScale, and if the image not need to be resized we should use the same image size
Fixed Issues
$ #40788
PROPOSAL: #40788 (comment)
Tests
Offline tests
QA Steps
Test image:
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android.-.Receipt.inconsistent.test.mov
Android: mWeb Chrome
Android.Chrome.-.Receipt.inconsistent.test.mp4
iOS: Native
IPhone.-.Receipt.inconsistent.test.mp4
iOS: mWeb Safari
IPhone.Safari.-.Receipt.inconsistent.test.mp4
MacOS: Chrome / Safari
MAC.Chrome.-.Receipt.inconsistent.test.mp4
MacOS: Desktop
MAC.Desktop.-.Receipt.inconsistent.test.mov