Skip to content

Commit

Permalink
Update: move rbush from static to npm module (#275)
Browse files Browse the repository at this point in the history
* Update: move rbush from static to npm module
* Fix: do not include drawing
  • Loading branch information
Minh-Ng committed Aug 4, 2017
1 parent 6f319f6 commit cec5410
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"prettier-eslint-cli": "^4.1.1",
"rangy": "^1.3.0",
"raw-loader": "^0.5.1",
"rbush": "^2.0.1",
"react": "^15.6.1",
"react-addons-shallow-compare": "^15.6.0",
"react-dom": "^15.6.1",
Expand Down
10 changes: 6 additions & 4 deletions src/lib/annotations/drawing/DrawingThread.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global Rbush */
import rbush from 'rbush';
import AnnotationThread from '../AnnotationThread';
import { STATES_DRAW, DRAW_RENDER_THRESHOLD } from '../annotationConstants';

Expand All @@ -9,8 +9,10 @@ class DrawingThread extends AnnotationThread {
/** @property {number} - Drawing state */
drawingFlag = STATES_DRAW.idle;

/** @property {Rbush} - Rtree path container */
pathContainer = new Rbush(RTREE_WIDTH);
/** @property {rbush} - Rtree path container */
/* eslint-disable new-cap */
pathContainer = new rbush(RTREE_WIDTH);
/* eslint-enable new-cap */

/** @property {CanvasContext} - A canvas for drawing new strokes */
memoryCanvas;
Expand Down Expand Up @@ -143,7 +145,7 @@ class DrawingThread extends AnnotationThread {
drawings.forEach((drawing) => drawing.drawPath(this.drawingContext));

if (this.pendingPath) {
this.pendingPath.drawPath(context);
this.pendingPath.drawPath(this.drawingContext);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/lib/viewers/doc/docAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const JS = [
`${STATIC_URI}pdf.min.js`,
`${STATIC_URI}pdf_viewer.min.js`,
`${STATIC_URI}pdf.worker.min.js`,
`${STATIC_URI}exif.min.js`,
`${STATIC_URI}rbush.min.js`
`${STATIC_URI}exif.min.js`
];
export const CSS = [`${STATIC_URI}pdf_viewer.min.css`];
2 changes: 0 additions & 2 deletions src/third-party/doc/0.130.0/rbush.min.js

This file was deleted.

10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5556,6 +5556,10 @@ quick-lru@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.0.0.tgz#7fa80304ab72c1f81cef738739cd47d7cc0c8bff"

quickselect@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/quickselect/-/quickselect-1.0.0.tgz#02630818f9aae4ecab26f0103f98d061c17c58f3"

randomatic@^1.1.3:
version "1.1.7"
resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c"
Expand Down Expand Up @@ -5589,6 +5593,12 @@ raw-loader@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa"

rbush@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/rbush/-/rbush-2.0.1.tgz#4cfaca28c3064bc0ee75431a1b79990e875eefa9"
dependencies:
quickselect "^1.0.0"

rc@1.1.7, rc@^1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.7.tgz#c5ea564bb07aff9fd3a5b32e906c1d3a65940fea"
Expand Down

0 comments on commit cec5410

Please sign in to comment.