Support for rounded rectangles

This commit is contained in:
grossmj 2023-08-01 15:54:47 +10:00
parent b59c528ece
commit cefbc3c9be
4 changed files with 17 additions and 1 deletions

View File

@ -7,4 +7,6 @@
[attr.stroke-dasharray]="stroke_dasharray" [attr.stroke-dasharray]="stroke_dasharray"
[attr.width]="rect.width" [attr.width]="rect.width"
[attr.height]="rect.height" [attr.height]="rect.height"
[attr.rx]="rect.rx"
[attr.ry]="rect.ry"
/> />

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 322 B

View File

@ -40,6 +40,16 @@ export class RectConverter implements SvgConverter {
drawing.height = parseInt(height.value, 10); drawing.height = parseInt(height.value, 10);
} }
const rx = element.attributes.getNamedItem('rx');
if (rx) {
drawing.rx = parseInt(rx.value, 0);
}
const ry = element.attributes.getNamedItem('ry');
if (ry) {
drawing.ry = parseInt(ry.value, 0);
}
return drawing; return drawing;
} }
} }

View File

@ -8,4 +8,6 @@ export class RectElement implements DrawingElement {
stroke: string; stroke: string;
stroke_width: number; stroke_width: number;
stroke_dasharray: string; stroke_dasharray: string;
rx: number;
ry: number;
} }

View File

@ -33,7 +33,9 @@ export class RectDrawingWidget implements DrawingShapeWidget {
.attr('stroke-width', (rect) => rect.stroke_width) .attr('stroke-width', (rect) => rect.stroke_width)
.attr('stroke-dasharray', (rect) => this.qtDasharrayFixer.fix(rect.stroke_dasharray)) .attr('stroke-dasharray', (rect) => this.qtDasharrayFixer.fix(rect.stroke_dasharray))
.attr('width', (rect) => rect.width) .attr('width', (rect) => rect.width)
.attr('height', (rect) => rect.height); .attr('height', (rect) => rect.height)
.attr('rx', (rect) => rect.rx)
.attr('ry', (rect) => rect.ry);
drawing.exit().remove(); drawing.exit().remove();
} }