Skip to content

Commit

Permalink
Support for rounded rectangles
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Aug 1, 2023
1 parent b59c528 commit cefbc3c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
[attr.stroke-dasharray]="stroke_dasharray"
[attr.width]="rect.width"
[attr.height]="rect.height"
[attr.rx]="rect.rx"
[attr.ry]="rect.ry"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ export class RectConverter implements SvgConverter {
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;
}
}
2 changes: 2 additions & 0 deletions src/app/cartography/models/drawings/rect-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export class RectElement implements DrawingElement {
stroke: string;
stroke_width: number;
stroke_dasharray: string;
rx: number;
ry: number;
}
4 changes: 3 additions & 1 deletion src/app/cartography/widgets/drawings/rect-drawing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class RectDrawingWidget implements DrawingShapeWidget {
.attr('stroke-width', (rect) => rect.stroke_width)
.attr('stroke-dasharray', (rect) => this.qtDasharrayFixer.fix(rect.stroke_dasharray))
.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();
}
Expand Down

0 comments on commit cefbc3c

Please sign in to comment.