@@ -5,7 +5,7 @@ import { TemplateTranslateService } from "../../services/template-translate.serv
5
5
6
6
interface IProgressPathParams {
7
7
/** TEMPLATE_PARAMETER: "variant". Default "wavy" */
8
- variant : "basic" | "wavy" ;
8
+ variant : "basic" | "wavy" | "curved" ;
9
9
}
10
10
11
11
// HACK - hardcoded sizing values to make content fit reasonably well
@@ -27,7 +27,7 @@ const SIZING = {
27
27
} )
28
28
export class TmplProgressPathComponent extends TemplateBaseComponent implements OnInit {
29
29
private params : Partial < IProgressPathParams > = { } ;
30
- private pathVariant : "basic" | "wavy" ;
30
+ private pathVariant : "basic" | "wavy" | "curved" ;
31
31
32
32
public svgPath : string ;
33
33
public svgViewBox : string ;
@@ -47,14 +47,14 @@ export class TmplProgressPathComponent extends TemplateBaseComponent implements
47
47
this . params . variant = getStringParamFromTemplateRow ( this . _row , "variant" , "wavy" )
48
48
. split ( "," )
49
49
. join ( " " ) as IProgressPathParams [ "variant" ] ;
50
- this . pathVariant = this . params . variant . includes ( "basic" ) ? "basic" : "wavy" ;
50
+ this . pathVariant = this . params . variant ;
51
51
}
52
52
53
53
/**
54
54
* Generate a base SVG segment used to connect 2 progress items together
55
55
* Roughly a horizontal line and smooth bend, adjusted for sizing
56
56
*/
57
- private generateSVGPath ( variant : "basic" | "wavy" = "wavy" ) {
57
+ private generateSVGPath ( variant : "basic" | "curved" | " wavy" = "wavy" ) {
58
58
// arbitrary values used to make base width/height fit
59
59
const { widthPx, xOffset, yOffset, textContentHeight } = SIZING ;
60
60
@@ -87,7 +87,23 @@ export class TmplProgressPathComponent extends TemplateBaseComponent implements
87
87
c 48,0 72,64 48,${ viewboxHeight - yOffset - 4 }
88
88
` . trim ( ) ;
89
89
90
- this . svgPath = variant === "basic" ? basic ( ) : wavy ( ) ;
90
+ const curved = ( ) =>
91
+ `
92
+ M ${ xOffset } ,${ yOffset }
93
+ c 0,140 280,-80 252,160 1
94
+ v 80
95
+ ` . trim ( ) ;
96
+
97
+ switch ( variant ) {
98
+ case "basic" :
99
+ this . svgPath = basic ( ) ;
100
+ break ;
101
+ case "curved" :
102
+ this . svgPath = curved ( ) ;
103
+ break ;
104
+ default :
105
+ this . svgPath = wavy ( ) ;
106
+ }
91
107
this . svgViewBox = `0 0 ${ widthPx } ${ viewboxHeight } ` ;
92
108
this . contentHeight = `${ textContentHeight } px` ;
93
109
}
0 commit comments