Skip to content

Commit a7cb859

Browse files
author
Victor Nazzaro
committed
Merge branch 'master' into multiple-graders-redo
2 parents f214cf9 + 0589639 commit a7cb859

File tree

17 files changed

+89
-64
lines changed

17 files changed

+89
-64
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
language: node_js
2+
dist: trusty
3+
sudo: true
4+
node_js:
5+
- '8'
6+
- '9'
7+
- '10'
28
addons:
39
firefox: latest
410
before_script:

dist/pdf-annotate.js

Lines changed: 41 additions & 28 deletions
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/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());

src/UI/pen.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ function saveToStorage(x, y){
4444
_candraw = false;
4545
let svg;
4646
if (lines.length > 1 && (svg = findSVGAtPoint(x, y))) {
47-
let { documentId, pageNumber } = getMetadata(svg);
48-
49-
PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, {
47+
let { documentId, userId, pageNumber } = getMetadata(svg);
48+
PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, {
5049
type: 'drawing',
5150
width: _penSize,
5251
color: _penColor,

src/UI/point.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function savePoint() {
7070
}
7171

7272
let rect = svg.getBoundingClientRect();
73-
let { documentId, pageNumber } = getMetadata(svg);
73+
let { documentId, userId, pageNumber } = getMetadata(svg);
7474
let annotation = Object.assign({
7575
type: 'point'
7676
}, scaleDown(svg, {
@@ -79,7 +79,7 @@ function savePoint() {
7979
})
8080
);
8181

82-
PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, pageNumber, annotation)
82+
PDFJSAnnotate.getStoreAdapter().addAnnotation(documentId, userId, pageNumber, annotation)
8383
.then((annotation) => {
8484
PDFJSAnnotate.getStoreAdapter().addComment(
8585
documentId,

0 commit comments

Comments
 (0)