diff --git a/src/Context.ts b/src/Context.ts index 928aaa8b6..ef75ca2ac 100644 --- a/src/Context.ts +++ b/src/Context.ts @@ -58,6 +58,7 @@ var COMMA = ',', 'putImageData', 'quadraticCurveTo', 'rect', + 'roundRect', 'restore', 'rotate', 'save', @@ -586,6 +587,18 @@ export class Context { rect(x: number, y: number, width: number, height: number) { this._context.rect(x, y, width, height); } + /** + * roundRect function. + * @method + * @name Konva.Context#roundRect + */ + roundRect(x: number, y: number, width: number, height: number, radii: number) { + if (this._context.roundRect) { + this._context.roundRect(x, y, width, height, radii); + } else { + this._context.rect(x, y, width, height); + } + } /** * putImageData function. * @method diff --git a/test/unit/Context-test.ts b/test/unit/Context-test.ts index 7d5a256c6..7cf6fc5d8 100644 --- a/test/unit/Context-test.ts +++ b/test/unit/Context-test.ts @@ -22,6 +22,7 @@ describe('Context', function () { 'arc', 'arcTo', 'rect', + 'roundRect', 'ellipse', 'fill', 'stroke',