Browse Source

Don't show first page initially if not presenter.

pull/70/head
Joachim Bauch 11 years ago committed by Joachim Bauch
parent
commit
f8a9c78d14
  1. 21
      static/js/directives/pdfviewer.js

21
static/js/directives/pdfviewer.js

@ -127,10 +127,7 @@ define(['require', 'jquery', 'underscore', 'text!partials/pdfviewer.html', 'pdf'
// ...and flip the buffers... // ...and flip the buffers...
scope.canvasIndex = 1 - scope.canvasIndex; scope.canvasIndex = 1 - scope.canvasIndex;
console.log("Done"); console.log("Done");
if (scope.pendingPageNumber !== null) { scope.showQueuedPage();
scope.showPage(scope.pendingPageNumber);
scope.pendingPageNumber = null;
}
}); });
}); });
}); });
@ -156,13 +153,25 @@ define(['require', 'jquery', 'underscore', 'text!partials/pdfviewer.html', 'pdf'
} }
}; };
$scope.showQueuedPage = function() {
if ($scope.pendingPageNumber !== null) {
$scope.showPage($scope.pendingPageNumber);
$scope.pendingPageNumber = null;
}
};
$scope.doOpenFile = function(source) { $scope.doOpenFile = function(source) {
pdf.getDocument(source).then(function(doc) { pdf.getDocument(source).then(function(doc) {
$scope.$apply(function(scope) { $scope.$apply(function(scope) {
scope.doc = doc; scope.doc = doc;
scope.maxPageNumber = doc.numPages; scope.maxPageNumber = doc.numPages;
scope.currentPageNumber = -1;
console.log("PDF loaded", doc); console.log("PDF loaded", doc);
scope.$emit("queuePageRendering", 1); if ($scope.isPresenter) {
scope.$emit("queuePageRendering", 1);
} else {
scope.showQueuedPage();
}
}); });
}); });
}; };
@ -301,8 +310,8 @@ define(['require', 'jquery', 'underscore', 'text!partials/pdfviewer.html', 'pdf'
//console.log("PdfViewer token request", currenttoken, data, type); //console.log("PdfViewer token request", currenttoken, data, type);
session.handleRequest(subscope, xfer, data); session.handleRequest(subscope, xfer, data);
}, "xfer"); }, "xfer");
$scope.openFile(f);
$scope.isPresenter = true; $scope.isPresenter = true;
$scope.openFile(f);
}, this)); }, this));
}, this)); }, this));
binder.namespace = function() { binder.namespace = function() {

Loading…
Cancel
Save