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 scaleX = canvasSize.width / contentSize.width; | ||
| const scaleY = canvasSize.height / contentSize.height; | ||
|
|
There was a problem hiding this comment.
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.
Even simpler, we can use an already existing NumberUtils.clamp instead of the ternary
There was a problem hiding this comment.
Oh that makes a lot of sense thank you!, it seems to be working:
receipt.resize.clamp.test.mp4
| const trueScaleX = canvasSize.width / contentSize.width; | ||
| const trueScaleY = canvasSize.height / contentSize.height; | ||
|
|
||
| const scaleX = clamp(trueScaleX, 0, 1); |
There was a problem hiding this comment.
| const scaleX = clamp(trueScaleX, 0, 1); | |
| const scaleX = clamp(canvasSize.width / contentSize.width, 0, 1); |
| const trueScaleY = canvasSize.height / contentSize.height; | ||
|
|
||
| const scaleX = clamp(trueScaleX, 0, 1); | ||
| const scaleY = clamp(trueScaleY, 0, 1); |
There was a problem hiding this comment.
| 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
|
eVoloshchak
left a comment
There was a problem hiding this comment.
- 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 |
|
@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 Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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