-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Calculating the devicePixelRatio for the pdf to display with less pixels than the limit of the platform #25721
Calculating the devicePixelRatio for the pdf to display with less pixels than the limit of the platform #25721
Conversation
…els than the limit of the platform Signed-off-by: Pierre Michel <pmiche04@gmail.com>
@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] |
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
Hello @eVoloshchak This works but I have some problems:
|
This comment was marked as resolved.
This comment was marked as resolved.
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
…pass the prop Signed-off-by: Pierre Michel <pmiche04@gmail.com>
Weird behaviour on ios and android (see videos), I am checking tomorrow |
Yes, we can absolutely store it on onyx. Also, have you tried if |
|
This comment was marked as resolved.
This comment was marked as resolved.
… state Signed-off-by: Pierre Michel <pmiche04@gmail.com>
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
I still have to do this:
|
…ime we open a pdf Signed-off-by: Pierre Michel <pmiche04@gmail.com>
…Size Signed-off-by: Pierre Michel <pmiche04@gmail.com> # Conflicts: # src/ONYXKEYS.ts
So yes the zoom in problem is also on main 2023-08-25.10-49-30.mp4 |
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
455650f
to
5fedae8
Compare
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
Ready for review |
…avoind calculating it every time we render, for example when we scroll Signed-off-by: Pierre Michel <pmiche04@gmail.com>
Co-authored-by: Eugene Voloshchak <copyreading@gmail.com>
Co-authored-by: Eugene Voloshchak <copyreading@gmail.com>
Co-authored-by: Eugene Voloshchak <copyreading@gmail.com>
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
@ShogunFire, lint test is failing |
…fixPdfBrokenMaxCanvasSize
21ece13
to
b80abb3
Compare
@ShogunFire, could you also verify if this works on native platforms? Screen.Recording.2023-08-28.at.20.04.06.movScreen.Recording.2023-08-28.at.20.06.40.mov |
Signed-off-by: Pierre Michel <pmiche04@gmail.com>
|
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-08-28.at.21.06.31.movMobile Web - Chromescreen-20230828-210449.mp4Mobile Web - SafariScreen.Recording.2023-08-28.at.20.01.13.movDesktopScreen.Recording.2023-08-28.at.21.05.09.moviOSScreen.Recording.2023-08-28.at.21.13.37.movAndroidScreen.Recording.2023-08-28.at.21.02.31.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.
Looks good and tests well
const ratioWidth = this.props.maxCanvasWidth / width; | ||
const ratioArea = Math.sqrt(this.props.maxCanvasArea / nbPixels); | ||
const ratio = Math.min(ratioHeight, ratioArea, ratioWidth); | ||
return ratio > window.devicePixelRatio ? undefined : ratio; |
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.
What would happen if we pass undefined to the page here?
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.
What would happen if we pass undefined to the page here?
@pecanoro, the default devicePixelRatio
would be used, same as before
By default, it matches screen device pixel ratio, so for example 3 on most iPhones, 1 on standard resolution office monitor
This does return undefined
for most PDFs, only the ones that won't fit require a custom devicePixelRatio
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.
Thanks for the explanation, just making sure I understand the code properly 😄
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/pecanoro in version: 1.3.59-0 🚀
|
🚀 Deployed to staging by https://github.com/pecanoro in version: 1.3.60-0 🚀
|
🚀 Deployed to staging by https://github.com/pecanoro in version: 1.3.60-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.59-5 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.60-3 🚀
|
Details
Each platform has a different max canvas size that can change without notice, we use canvas-size library to calculate that limit. Then we calculate the devicePixelRatio that allows the pdf to be displayed with less pixels than this limit
Fixed Issues
$ #23327
PROPOSAL: #23327 (comment)
Tests
Offline tests
Same tests
QA Steps
Same tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
web-pdf.mp4
Mobile Web - Chrome
mweb-pdf.mp4
Mobile Web - Safari
safari-pdf.mp4
Desktop
desktop-pdf.mp4
iOS
ios-pdf.mp4
Android
android-pdf.mp4