mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 13:27:33 +08:00
Add support for ctx.roundRect
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/roundRect
This commit is contained in:
parent
a8efcd554a
commit
467147b4c7
@ -58,6 +58,7 @@ var COMMA = ',',
|
|||||||
'putImageData',
|
'putImageData',
|
||||||
'quadraticCurveTo',
|
'quadraticCurveTo',
|
||||||
'rect',
|
'rect',
|
||||||
|
'roundRect',
|
||||||
'restore',
|
'restore',
|
||||||
'rotate',
|
'rotate',
|
||||||
'save',
|
'save',
|
||||||
@ -586,6 +587,18 @@ export class Context {
|
|||||||
rect(x: number, y: number, width: number, height: number) {
|
rect(x: number, y: number, width: number, height: number) {
|
||||||
this._context.rect(x, y, width, height);
|
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.
|
* putImageData function.
|
||||||
* @method
|
* @method
|
||||||
|
@ -22,6 +22,7 @@ describe('Context', function () {
|
|||||||
'arc',
|
'arc',
|
||||||
'arcTo',
|
'arcTo',
|
||||||
'rect',
|
'rect',
|
||||||
|
'roundRect',
|
||||||
'ellipse',
|
'ellipse',
|
||||||
'fill',
|
'fill',
|
||||||
'stroke',
|
'stroke',
|
||||||
|
Loading…
Reference in New Issue
Block a user