Skip to content
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

Merged
merged 1 commit into from
Nov 17, 2017

Conversation

tonyjin
Copy link
Contributor

@tonyjin tonyjin commented Nov 15, 2017

This now matches the behavior of the presentation viewer, which doesn't have a max zoom scale.

* @param {number} pdfHeight - Height of PDF in pixels
* @return {Object} Width and height in pixels
*/
getScaledDimensions(pdfWidth, pdfHeight) {
Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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.

@tonyjin tonyjin force-pushed the fix-preloading-presentations branch 2 times, most recently from 0a3ba29 to 79ea7eb Compare November 15, 2017 19:19
@@ -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;
Copy link
Contributor

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;
Copy link
Contributor

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.
@tonyjin tonyjin merged commit 11b2277 into box:master Nov 17, 2017
@tonyjin tonyjin deleted the fix-preloading-presentations branch November 17, 2017 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants