Closed nicolo-ribaudo closed 1 month ago
In #18098 (comment) you said that you probably do not want
updateScale
, but I still uploaded it since it de-duplicates a significant amount of code. What do you think about it?
Looking at a working patch, written by an actual human, I'm happy to retract that statement since it's clear that it avoids a bunch of code duplication :-)
/botio integrationtest
Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0
Live output at: http://54.241.84.105:8877/41d5c1423b09441/output.txt
Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0
Live output at: http://54.193.163.58:8877/c713b44aab198d2/output.txt
Full output at http://54.241.84.105:8877/41d5c1423b09441/output.txt
Total script time: 7.85 mins
Full output at http://54.193.163.58:8877/c713b44aab198d2/output.txt
Total script time: 16.62 mins
This is the test failing on windows (line 727 is throwing): https://github.com/mozilla/pdf.js/blob/95a7de9f986c449cb949d39af948dbe97f60948e/test/integration/stamp_editor_spec.mjs#L713-L730
It is failing because the .move()
on line 727 is moving to outside of the viewport. It seems unrelated, because that test doesn't change zoom in any way, however looking at recent CI bot I couldn't find any similar failures 🤔
/botio integrationtest
Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0
Live output at: http://54.241.84.105:8877/1a80676073ff22b/output.txt
Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0
Live output at: http://54.193.163.58:8877/aa3933c8fd7da6b/output.txt
Full output at http://54.241.84.105:8877/1a80676073ff22b/output.txt
Total script time: 7.82 mins
Full output at http://54.193.163.58:8877/aa3933c8fd7da6b/output.txt
Total script time: 19.04 mins
/botio-linux preview
Command cmd_preview from @Snuffleupagus received. Current queue size: 0
Live output at: http://54.241.84.105:8877/55892e089776b04/output.txt
Full output at http://54.241.84.105:8877/55892e089776b04/output.txt
Total script time: 1.17 mins
/botio integrationtest
Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0
Live output at: http://54.241.84.105:8877/8b3e402acee8dcf/output.txt
Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0
Live output at: http://54.193.163.58:8877/1724685ff947a26/output.txt
Full output at http://54.241.84.105:8877/8b3e402acee8dcf/output.txt
Total script time: 7.75 mins
Full output at http://54.193.163.58:8877/1724685ff947a26/output.txt
Total script time: 18.98 mins
/botio-linux integrationtest
Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0
Live output at: http://54.241.84.105:8877/d288c01ae5dfbfa/output.txt
Full output at http://54.241.84.105:8877/d288c01ae5dfbfa/output.txt
Total script time: 7.82 mins
Thanks for the quick review!
Closes #18076
This PR extends the zoom/scale API to simplify the logic in custom viewer wrappers:
updateScale
function that does bothincreaseScale
/decreaseScale
. Ad you can see from the commit itself, it significantly reduces code duplication both in embedders (see the changes inweb/app.js
) and inweb/pdf_viewer.js
itselfNote that this PR increases the net number of lines because it adds a test, but ignoring the new test it would be +56 -95.
@Snuffleupagus In https://github.com/mozilla/pdf.js/pull/18098#issuecomment-2112821398 you said that you probably do not want
updateScale
, but I still uploaded it since it de-duplicates a significant amount of code. What do you think about it? (the second commit could be done independently from the first one)Commits: