-
Notifications
You must be signed in to change notification settings - Fork 116
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: Ensure that annotation scale is never being set to auto #208
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1030,7 +1030,7 @@ const MOBILE_MAX_CANVAS_SIZE = 2949120; // ~3MP 1920x1536 | |
|
||
// Set scale to current numerical scale & rendered page number | ||
this.emit('scale', { | ||
scale: this.pdfViewer.currentScaleValue, | ||
scale: this.pdfViewer.currentScale, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In BaseViewer.scaleAnnotations, the line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting the data-scale automatically triggers a bunch of annotations methods to get called. I'm not sure it makes sense to trigger those (even if there's not much it ends up doing when there are 0 annotations). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with Minh, but I think the change will have to happen when we have some refactor time. My assumption is that a bunch of events are fired off inside of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It ends up triggering a few other methods which don't quite make sense to trigger unless the annotations have already been fetched. It might end up becoming a part of our larger refactor :-/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What should happen when you open a preview when your browser size is half the screen? The scaling will not be auto (the actual value will be something fractional) but the data-scale field will still be auto. Shouldn't methods listening to scale be dependent on scale? Then the annotation methods that get triggered should do nothing when it is determined that there is nothing relevant for the method to do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested this to make sure just now and it seems like it's being set as 1 at the start and when you resize it from there, this change forces it to a numerical value so it should never be set as "auto" |
||
pageNum: pageNumber | ||
}); | ||
|
||
|
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.
This would cause the annotation scale to be set as "auto" until the document is zoomed in/out for the first time.
this.pdfViewer.currentScale
is a usable value for annotator scaleThere 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.
This was actually what was being set before. It got swapped in a previous change
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.
Is the difference that
currentScaleValue
is always a number?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.
Yup. currentScaleValue is usually just "auto" until the file is zoomed in/out at least once