Skip to content

Commit

Permalink
refactor: review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen committed Feb 2, 2023
1 parent c09417b commit 19d0050
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/helpers/helpers.canvas.ts
Expand Up @@ -10,7 +10,8 @@ import type {
import type {
TRBL,
SplinePoint,
RoundedRect
RoundedRect,
TRBLCorners
} from '../types/geometric.js';
import {isArray, isNullOrUndef} from './helpers.core.js';
import {PI, TAU, HALF_PI, QUARTER_PI, TWO_THIRDS_PI, RAD_PER_DEG} from './helpers.math.js';
Expand Down Expand Up @@ -490,13 +491,12 @@ export function renderText(
* @param ctx - Context
* @param rect - Bounding rect
*/
export function addRoundedRectPath(ctx: CanvasRenderingContext2D, rect: RoundedRect) {
export function addRoundedRectPath(
ctx: CanvasRenderingContext2D,
rect: RoundedRect & { radius: TRBLCorners }
) {
const {x, y, w, h, radius} = rect;

if (!radius || typeof radius === 'number') {
return;
}

// top left arc
ctx.arc(x + radius.topLeft, y + radius.topLeft, radius.topLeft, -HALF_PI, PI, true);

Expand Down

0 comments on commit 19d0050

Please sign in to comment.