Add source
parameters to all remaining EventBus.dispatch
calls that are currently missing those
This is necessary for subsequent patches, and will help avoid unnecessary event re-dispatching in cases where the event source is `window`.
This commit is contained in:
parent
283f2dfcc3
commit
486c843215
@ -160,7 +160,7 @@ let PDFViewerApplication = {
|
|||||||
this.l10n.translate(appContainer).then(() => {
|
this.l10n.translate(appContainer).then(() => {
|
||||||
// Dispatch the 'localized' event on the `eventBus` once the viewer
|
// Dispatch the 'localized' event on the `eventBus` once the viewer
|
||||||
// has been fully initialized and translated.
|
// has been fully initialized and translated.
|
||||||
this.eventBus.dispatch('localized');
|
this.eventBus.dispatch('localized', { source: this, });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
@ -1371,14 +1371,15 @@ let PDFViewerApplication = {
|
|||||||
};
|
};
|
||||||
_boundEvents.windowHashChange = () => {
|
_boundEvents.windowHashChange = () => {
|
||||||
eventBus.dispatch('hashchange', {
|
eventBus.dispatch('hashchange', {
|
||||||
|
source: window,
|
||||||
hash: document.location.hash.substring(1),
|
hash: document.location.hash.substring(1),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
_boundEvents.windowBeforePrint = () => {
|
_boundEvents.windowBeforePrint = () => {
|
||||||
eventBus.dispatch('beforeprint');
|
eventBus.dispatch('beforeprint', { source: window, });
|
||||||
};
|
};
|
||||||
_boundEvents.windowAfterPrint = () => {
|
_boundEvents.windowAfterPrint = () => {
|
||||||
eventBus.dispatch('afterprint');
|
eventBus.dispatch('afterprint', { source: window, });
|
||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener('wheel', webViewerWheel);
|
window.addEventListener('wheel', webViewerWheel);
|
||||||
@ -1560,6 +1561,7 @@ function webViewerInitialized() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PDFViewerApplication.eventBus.dispatch('fileinputchange', {
|
PDFViewerApplication.eventBus.dispatch('fileinputchange', {
|
||||||
|
source: this,
|
||||||
fileInput: evt.target,
|
fileInput: evt.target,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1578,6 +1580,7 @@ function webViewerInitialized() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PDFViewerApplication.eventBus.dispatch('fileinputchange', {
|
PDFViewerApplication.eventBus.dispatch('fileinputchange', {
|
||||||
|
source: this,
|
||||||
fileInput: evt.dataTransfer,
|
fileInput: evt.dataTransfer,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -60,19 +60,19 @@ class PDFPresentationMode {
|
|||||||
if (contextMenuItems) {
|
if (contextMenuItems) {
|
||||||
contextMenuItems.contextFirstPage.addEventListener('click', () => {
|
contextMenuItems.contextFirstPage.addEventListener('click', () => {
|
||||||
this.contextMenuOpen = false;
|
this.contextMenuOpen = false;
|
||||||
this.eventBus.dispatch('firstpage');
|
this.eventBus.dispatch('firstpage', { source: this, });
|
||||||
});
|
});
|
||||||
contextMenuItems.contextLastPage.addEventListener('click', () => {
|
contextMenuItems.contextLastPage.addEventListener('click', () => {
|
||||||
this.contextMenuOpen = false;
|
this.contextMenuOpen = false;
|
||||||
this.eventBus.dispatch('lastpage');
|
this.eventBus.dispatch('lastpage', { source: this, });
|
||||||
});
|
});
|
||||||
contextMenuItems.contextPageRotateCw.addEventListener('click', () => {
|
contextMenuItems.contextPageRotateCw.addEventListener('click', () => {
|
||||||
this.contextMenuOpen = false;
|
this.contextMenuOpen = false;
|
||||||
this.eventBus.dispatch('rotatecw');
|
this.eventBus.dispatch('rotatecw', { source: this, });
|
||||||
});
|
});
|
||||||
contextMenuItems.contextPageRotateCcw.addEventListener('click', () => {
|
contextMenuItems.contextPageRotateCcw.addEventListener('click', () => {
|
||||||
this.contextMenuOpen = false;
|
this.contextMenuOpen = false;
|
||||||
this.eventBus.dispatch('rotateccw');
|
this.eventBus.dispatch('rotateccw', { source: this, });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,19 +100,19 @@ class Toolbar {
|
|||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
items.previous.addEventListener('click', function() {
|
items.previous.addEventListener('click', function() {
|
||||||
eventBus.dispatch('previouspage');
|
eventBus.dispatch('previouspage', { source: self, });
|
||||||
});
|
});
|
||||||
|
|
||||||
items.next.addEventListener('click', function() {
|
items.next.addEventListener('click', function() {
|
||||||
eventBus.dispatch('nextpage');
|
eventBus.dispatch('nextpage', { source: self, });
|
||||||
});
|
});
|
||||||
|
|
||||||
items.zoomIn.addEventListener('click', function() {
|
items.zoomIn.addEventListener('click', function() {
|
||||||
eventBus.dispatch('zoomin');
|
eventBus.dispatch('zoomin', { source: self, });
|
||||||
});
|
});
|
||||||
|
|
||||||
items.zoomOut.addEventListener('click', function() {
|
items.zoomOut.addEventListener('click', function() {
|
||||||
eventBus.dispatch('zoomout');
|
eventBus.dispatch('zoomout', { source: self, });
|
||||||
});
|
});
|
||||||
|
|
||||||
items.pageNumber.addEventListener('click', function() {
|
items.pageNumber.addEventListener('click', function() {
|
||||||
@ -137,19 +137,19 @@ class Toolbar {
|
|||||||
});
|
});
|
||||||
|
|
||||||
items.presentationModeButton.addEventListener('click', function() {
|
items.presentationModeButton.addEventListener('click', function() {
|
||||||
eventBus.dispatch('presentationmode');
|
eventBus.dispatch('presentationmode', { source: self, });
|
||||||
});
|
});
|
||||||
|
|
||||||
items.openFile.addEventListener('click', function() {
|
items.openFile.addEventListener('click', function() {
|
||||||
eventBus.dispatch('openfile');
|
eventBus.dispatch('openfile', { source: self, });
|
||||||
});
|
});
|
||||||
|
|
||||||
items.print.addEventListener('click', function() {
|
items.print.addEventListener('click', function() {
|
||||||
eventBus.dispatch('print');
|
eventBus.dispatch('print', { source: self, });
|
||||||
});
|
});
|
||||||
|
|
||||||
items.download.addEventListener('click', function() {
|
items.download.addEventListener('click', function() {
|
||||||
eventBus.dispatch('download');
|
eventBus.dispatch('download', { source: self, });
|
||||||
});
|
});
|
||||||
|
|
||||||
// Suppress context menus for some controls.
|
// Suppress context menus for some controls.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user