Skip to content

Commit 90727f5

Browse files
committed
Set default radius of circles to 10. Also added an exported function setCircle() to let the client control the radius.
1 parent 45a0aa4 commit 90727f5

File tree

7 files changed

+39
-8
lines changed

7 files changed

+39
-8
lines changed

dist/pdf-annotate.js

Lines changed: 19 additions & 2 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: 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.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/UI/circle.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ import {
99

1010
let _enabled = false;
1111
let _type;
12+
let _circleRadius = 10;
13+
let _circleColor = '0000FF';
14+
15+
/**
16+
* Set the attributes of the pen.
17+
*
18+
* @param {Number} circleRadius The radius of the circle
19+
* @param {String} circleColor The color of the circle
20+
*/
21+
export function setCircle(circleRadius = 10, circleColor = '0000FF') {
22+
_circleRadius = parseInt(circleRadius, 10);
23+
_circleColor = circleColor;
24+
}
1225

1326
/**
1427
* Handle document.mouseup event
@@ -24,7 +37,7 @@ function handleDocumentMouseup(e) {
2437
saveCircle(svg, _type, {
2538
x: e.clientX - rect.left,
2639
y: e.clientY - rect.top
27-
}, 15, "0000FF"
40+
}, _circleRadius, _circleColor
2841
);
2942
}
3043

src/UI/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { disablePen, enablePen, setPen } from './pen';
44
import { disableArrow, enableArrow, setArrow } from './arrow';
55
import { disablePoint, enablePoint } from './point';
66
import { disableRect, enableRect } from './rect';
7-
import { disableCircle, enableCircle } from './circle';
7+
import { disableCircle, enableCircle, setCircle } from './circle';
88
import { disableText, enableText, setText } from './text';
99
import { createPage, renderPage } from './page';
1010

@@ -14,7 +14,7 @@ export default {
1414
disablePen, enablePen, setPen,
1515
disablePoint, enablePoint,
1616
disableRect, enableRect,
17-
disableCircle, enableCircle,
17+
disableCircle, enableCircle, setCircle,
1818
disableArrow, enableArrow, setArrow,
1919
disableText, enableText, setText,
2020
createPage, renderPage

web/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,5 +369,6 @@ render();
369369
UI.addEventListener('annotation:blur', handleAnnotationBlur);
370370

371371
UI.setArrow(10, '#0000FF');
372+
UI.setCircle(10, '#0000FF')
372373

373374
})(window, document);

0 commit comments

Comments
 (0)