Skip to content

Commit 86a1bf8

Browse files
authored
Merge pull request #2 from Submitty/multiple-graders
Multiple graders
2 parents 5b58611 + 0333b74 commit 86a1bf8

20 files changed

+166
-119
lines changed

dist/pdf-annotate.js

Lines changed: 89 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pdf-annotate.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pdf-annotate.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pdf-annotate.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/PDFJSAnnotate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default {
7878
* @param {String} pageNumber The page number
7979
* @return {Promise}
8080
*/
81-
getAnnotations(documentId, pageNumber) {
81+
getAnnotations(documentId, userId, pageNumber) {
8282
return this.getStoreAdapter().getAnnotations(...arguments);
8383
},
8484

src/UI/arrow.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ function handleDocumentMousedown(e) {
3333
}
3434

3535
let svg = findSVGContainer(target);
36-
let { documentId } = getMetadata(svg);
36+
let { documentId, userId } = getMetadata(svg);
3737
let annotationId = target.getAttribute('data-pdf-annotate-id');
3838

3939
let event = e;
40-
PDFJSAnnotate.getStoreAdapter().getAnnotation(documentId, annotationId).then((annotation) => {
40+
PDFJSAnnotate.getStoreAdapter().getAnnotation(documentId, userId, annotationId).then((annotation) => {
4141
if (annotation) {
4242
path = null;
4343
lines = [];

src/UI/circle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ function saveCircle(svg, type, pt, radius, color) {
5959
r: radius
6060
};
6161

62-
let { documentId, pageNumber } = getMetadata(svg);
62+
let { documentId, userId, pageNumber } = getMetadata(svg);
6363

6464
// Add the annotation
65-
PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation)
65+
PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, annotation)
6666
.then((annotation) => {
6767
appendChild(svg, annotation);
6868
});

src/UI/edit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ function handleDocumentMouseup(e) {
225225
let target = document.querySelectorAll(`[data-pdf-annotate-id="${annotationId}"]`);
226226
let type = target[0].getAttribute('data-pdf-annotate-type');
227227
let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());
228-
let { documentId } = getMetadata(svg);
228+
let { documentId, userId } = getMetadata(svg);
229229

230230
overlay.querySelector('a').style.display = '';
231231

232-
PDFJSAnnotate.getStoreAdapter().getAnnotation(documentId, annotationId).then((annotation) => {
232+
PDFJSAnnotate.getStoreAdapter().getAnnotation(documentId, userId, annotationId).then((annotation) => {
233233
let attribX = 'x';
234234
let attribY = 'y';
235235
if (['circle', 'fillcircle', 'emptycircle'].indexOf(type) > -1) {

src/UI/eraser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function handleDocumentMouseMove(e){
1919
let target = findAnnotationAtPoint(e.clientX, e.clientY);
2020
if(target){
2121
console.log(target);
22-
let annotationId = target.getAttribute('data-pdf-annotate-id');
22+
// let annotationId = target.getAttribute('data-pdf-annotate-id');
2323
// let nodes = document.querySelectorAll(`[data-pdf-annotate-id="${annotationId}"]`);
2424
// let svg = overlay.parentNode.querySelector(config.annotationSvgQuery());
2525
// let { documentId } = getMetadata(svg);

src/UI/page.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export function createPage(pageNumber) {
4848
export function renderPage(pageNumber, renderOptions) {
4949
let {
5050
documentId,
51+
userId,
5152
pdfDocument,
5253
scale,
5354
rotate
@@ -56,7 +57,7 @@ export function renderPage(pageNumber, renderOptions) {
5657
// Load the page and annotations
5758
return Promise.all([
5859
pdfDocument.getPage(pageNumber),
59-
PDFJSAnnotate.getAnnotations(documentId, pageNumber)
60+
PDFJSAnnotate.getAnnotations(documentId, userId, pageNumber)
6061
]).then(([pdfPage, annotations]) => {
6162
let page = document.getElementById(`pageContainer${pageNumber}`);
6263
let svg = page.querySelector(config.annotationClassQuery());

0 commit comments

Comments
 (0)