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

update page number upon page changing event #499

Merged
merged 1 commit into from
Jul 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/app/pdf-viewer/pdf-viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ export class PdfViewerComponent

const eventBus = createEventBus(PDFJSViewer);

eventBus.on('pagechanging', e => {
VadimDez marked this conversation as resolved.
Show resolved Hide resolved
if (e.pageNumber != this._page) {
this.page = e.pageNumber;
}
});

eventBus.on('pagerendered', e => {
this.pageRendered.emit(e);
});
Expand Down
4 changes: 2 additions & 2 deletions src/app/utils/event-bus-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ function attachDOMEventsToEventBus(eventBus: any) {
});
evt.source.textLayerDiv.dispatchEvent(event);
});
eventBus.on('pagechange', function(evt) {
eventBus.on('pagechanging', function(evt) {
const event = document.createEvent('UIEvents');
event.initUIEvent('pagechange', true, true, window, 0);
event.initUIEvent('pagechanging', true, true, window, 0);
event['pageNumber'] = evt.pageNumber;
evt.source.container.dispatchEvent(event);
});
Expand Down