-
Notifications
You must be signed in to change notification settings - Fork 113
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
Fix: Presentation preloading scales without max #487
Conversation
* @param {number} pdfHeight - Height of PDF in pixels | ||
* @return {Object} Width and height in pixels | ||
*/ | ||
getScaledDimensions(pdfWidth, pdfHeight) { |
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.
If this is identical to DocPreloader's, can you move it to util.js
, with an additional parameter for wrapperEl
OR clientWidth
and clientHeight
?
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 guess there's a slight difference. Is there anything you can abstract to remove duplicated code?
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.
Hmm yeah, can probably make max scale an optional property and keep it in docpreloader. Good point, thanks.
0a3ba29
to
79ea7eb
Compare
src/lib/viewers/doc/DocPreloader.js
Outdated
@@ -33,6 +32,9 @@ class DocPreloader extends EventEmitter { | |||
/** @property {HTMLElement} - Preload image element */ | |||
imageEl; | |||
|
|||
/** @property {HTMLElement} - Maximum auto-zoom scale - set to 0 for no limit */ | |||
maxZoomScale; |
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.
Instead of setting in the constructor, you could set it here!
@@ -3,6 +3,9 @@ import { CLASS_INVISIBLE, CLASS_BOX_PREVIEW_PRELOAD_WRAPPER_PRESENTATION } from | |||
import { setDimensions } from '../../util'; | |||
|
|||
class PresentationPreloader extends DocPreloader { | |||
/** @property {HTMLELement} - Maximum auto-zoom scale - set to 0 for no limit */ | |||
maxZoomScale; |
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.
AFAIK setting to 0 here will override the default, if set in the parent class in the same manner. See above comment. This cleans up the constructor quite a bit.
This now matches the behavior of the presentation viewer, which doesn't have a max zoom scale.
79ea7eb
to
74bdf5f
Compare
This now matches the behavior of the presentation viewer, which doesn't have a max zoom scale.