This commit is contained in:
Preet Shihn
2020-06-22 20:34:40 -07:00
parent 212bfa06bd
commit 2e3d7fd59c

View File

@@ -61,10 +61,10 @@ export function renderAnnotation(svg: SVGSVGElement, rect: Rect, config: RoughAn
const padding = parsePadding(config); const padding = parsePadding(config);
const animate = (config.animate === undefined) ? true : (!!config.animate); const animate = (config.animate === undefined) ? true : (!!config.animate);
const iterations = config.iterations || 2; const iterations = config.iterations || 2;
const o = getOptions('single', seed);
switch (config.type) { switch (config.type) {
case 'underline': { case 'underline': {
const o = getOptions('single', seed);
const y = rect.y + rect.h + padding[2]; const y = rect.y + rect.h + padding[2];
for (let i = 0; i < iterations; i++) { for (let i = 0; i < iterations; i++) {
if (i % 2) { if (i % 2) {
@@ -76,7 +76,6 @@ export function renderAnnotation(svg: SVGSVGElement, rect: Rect, config: RoughAn
break; break;
} }
case 'strike-through': { case 'strike-through': {
const o = getOptions('single', seed);
const y = rect.y + (rect.h / 2); const y = rect.y + (rect.h / 2);
for (let i = 0; i < iterations; i++) { for (let i = 0; i < iterations; i++) {
if (i % 2) { if (i % 2) {
@@ -88,7 +87,6 @@ export function renderAnnotation(svg: SVGSVGElement, rect: Rect, config: RoughAn
break; break;
} }
case 'box': { case 'box': {
const o = getOptions('single', seed);
const x = rect.x - padding[3]; const x = rect.x - padding[3];
const y = rect.y - padding[0]; const y = rect.y - padding[0];
const width = rect.w + (padding[1] + padding[3]); const width = rect.w + (padding[1] + padding[3]);
@@ -99,7 +97,6 @@ export function renderAnnotation(svg: SVGSVGElement, rect: Rect, config: RoughAn
break; break;
} }
case 'bracket': { case 'bracket': {
const o = getOptions('single', seed);
const brackets: BracketType[] = Array.isArray(config.brackets) ? config.brackets : (config.brackets ? [config.brackets] : ['right']); const brackets: BracketType[] = Array.isArray(config.brackets) ? config.brackets : (config.brackets ? [config.brackets] : ['right']);
const lx = rect.x - padding[3] * 2; const lx = rect.x - padding[3] * 2;
const rx = rect.x + rect.w + padding[1] * 2; const rx = rect.x + rect.w + padding[1] * 2;
@@ -148,7 +145,6 @@ export function renderAnnotation(svg: SVGSVGElement, rect: Rect, config: RoughAn
break; break;
} }
case 'crossed-off': { case 'crossed-off': {
const o = getOptions('single', seed);
const x = rect.x; const x = rect.x;
const y = rect.y; const y = rect.y;
const x2 = x + rect.w; const x2 = x + rect.w;
@@ -170,7 +166,6 @@ export function renderAnnotation(svg: SVGSVGElement, rect: Rect, config: RoughAn
break; break;
} }
case 'circle': { case 'circle': {
const singleO = getOptions('single', seed);
const doubleO = getOptions('double', seed); const doubleO = getOptions('double', seed);
const width = rect.w + (padding[1] + padding[3]); const width = rect.w + (padding[1] + padding[3]);
const height = rect.h + (padding[0] + padding[2]); const height = rect.h + (padding[0] + padding[2]);
@@ -182,7 +177,7 @@ export function renderAnnotation(svg: SVGSVGElement, rect: Rect, config: RoughAn
opList.push(ellipse(x, y, width, height, doubleO)); opList.push(ellipse(x, y, width, height, doubleO));
} }
for (let i = 0; i < singleItr; i++) { for (let i = 0; i < singleItr; i++) {
opList.push(ellipse(x, y, width, height, singleO)); opList.push(ellipse(x, y, width, height, o));
} }
break; break;
} }