|
1 | 1 | import { Length, PercentLength, zeroLength } from '@nativescript/core/ui/styling/style-properties';
|
2 | 2 | import { layout } from '@nativescript/core/utils/utils';
|
3 | 3 | import { Canvas, Rect, RectF, createRectF } from '../canvas';
|
4 |
| -import Shape, { lengthProperty, percentLengthProperty } from './shape'; |
| 4 | +import Shape, { lengthProperty, numberProperty, percentLengthProperty } from './shape'; |
5 | 5 |
|
6 | 6 | export { Rect, RectF };
|
7 | 7 | export default class Rectangle extends Shape {
|
8 | 8 | drawOnCanvas(canvas: Canvas) {
|
9 | 9 | // console.log('Rectangle', 'drawOnCanvas');
|
10 |
| - canvas.drawRect(this.getRect(canvas), this.paint); |
| 10 | + if (this.borderRadius) { |
| 11 | + canvas.drawRoundRect(this.getRect(canvas), this.borderRadius, this.borderRadius, this.paint); |
| 12 | + } else { |
| 13 | + canvas.drawRect(this.getRect(canvas), this.paint); |
| 14 | + } |
11 | 15 | }
|
12 | 16 | @percentLengthProperty width: PercentLength;
|
13 | 17 | @percentLengthProperty height: PercentLength;
|
14 | 18 | @lengthProperty left: Length = zeroLength;
|
15 | 19 | @lengthProperty top: Length = zeroLength;
|
| 20 | + @numberProperty borderRadius: number; |
16 | 21 |
|
17 | 22 | // getRect(canvas: Canvas) {
|
18 | 23 | // const availableWidth = layout.toDevicePixels(canvas.getWidth());
|
|
0 commit comments