-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
Issue #223 PR #445
Issue #223 PR #445
Conversation
This change also moves the scroll container of the underlying viewer inside the |
when to release @ColinT |
@jiangyh1024 Sorry, I'm not a project collaborator. It will probably be released when the review is complete. |
My biggest concern is that this introduces scrollbar for the pdf-viwer, i don't think having two scrollbars on the same page is a good idea. |
I think pdfjs can't emit a pagechange event without having the container itself be scrollable. If you look at the official mozilla implementation for example, they also use a scrollable container for their pdf. |
@VadimDez Thanks for the review. You raise a valid point and I think there is a solution. It requires passing the scrolling element and viewer element to @Input() container;
/* ... */
const pdfOptions: PDFViewerParams | any = {
container: this.container || this.element.nativeElement.querySelector('div'),
viewer: this.element.nativeElement.querySelector('div').firstElementChild,
/* ... other options */
};
this.pdfMultiPageViewer = new PDFJSViewer.PDFViewer(pdfOptions); I got this working but it has one complication:
ugly code
// app.component.ts
constructor(@Inject(DOCUMENT) public document: Document) {
window.onscroll = (_ev) => {
const newEvent = new UIEvent('scroll');
document.body.dispatchEvent(newEvent); // Tell pdfjs that there is a scroll event happening
};
} <!-- app.component.html -->
<pdf-viewer [container]="document.body"></pdf-viewer> Please see the following forked branch for a working demo: Feel free to incorporate those changes into this PR or otherwise. |
@VadimDez When will we have this release? |
Based on changes made by @ColinT (see ColinT@5cf6bb0)
Scrolling now updates the page binding and doesn't cause a jump to the top of the page when triggered.
Also fixed a bug where the updateSize calculation would compare pdfjs units to css px.