Add enableWebGL to the preferences

This commit is contained in:
Yury Delendik 2014-04-03 12:20:53 -05:00
parent f57c6935d7
commit 30ab878835
2 changed files with 16 additions and 3 deletions

View File

@ -22,5 +22,6 @@ var DEFAULT_PREFERENCES = {
showPreviousViewOnLoad: true, showPreviousViewOnLoad: true,
defaultZoomValue: '', defaultZoomValue: '',
ifAvailableShowOutlineOnLoad: false, ifAvailableShowOutlineOnLoad: false,
enableHandToolOnLoad: false enableHandToolOnLoad: false,
enableWebGL: false
}; };

View File

@ -216,10 +216,20 @@ var PDFView = {
pageCountField: document.getElementById('pageCountField') pageCountField: document.getElementById('pageCountField')
}); });
this.initialized = true;
container.addEventListener('scroll', function() { container.addEventListener('scroll', function() {
self.lastScroll = Date.now(); self.lastScroll = Date.now();
}, false); }, false);
var initializedPromise = Promise.all([
Preferences.get('enableWebGL').then(function (value) {
PDFJS.disableWebGL = !value;
})
// TODO move more preferences and other async stuff here
]);
return initializedPromise.then(function () {
PDFView.initialized = true;
});
}, },
getPage: function pdfViewGetPage(n) { getPage: function pdfViewGetPage(n) {
@ -1652,8 +1662,10 @@ var DocumentOutlineView = function documentOutlineView(outline) {
//#endif //#endif
function webViewerLoad(evt) { function webViewerLoad(evt) {
PDFView.initialize(); PDFView.initialize().then(webViewerInitialized);
}
function webViewerInitialized() {
//#if (GENERIC || B2G) //#if (GENERIC || B2G)
var params = PDFView.parseQueryString(document.location.search.substring(1)); var params = PDFView.parseQueryString(document.location.search.substring(1));
var file = 'file' in params ? params.file : DEFAULT_URL; var file = 'file' in params ? params.file : DEFAULT_URL;