@@ -6,17 +6,15 @@ import { ComponentContext } from '../../component-context';
6
6
import { DefaultSequenceComponent } from '../sequence/default-sequence-component' ;
7
7
import { SequencePlaceIndicator } from '../../designer-extension' ;
8
8
import { Badges } from '../badges/badges' ;
9
-
10
- const SIZE = 30 ;
11
- const DEFAULT_ICON_SIZE = 22 ;
12
- const FOLDER_ICON_SIZE = 18 ;
9
+ import { StartStopRootComponentViewConfiguration } from './start-stop-root-component-view-configuration' ;
13
10
14
11
export class StartStopRootComponentView implements ComponentView {
15
12
public static create (
16
13
parent : SVGElement ,
17
14
sequence : Sequence ,
18
15
parentPlaceIndicator : SequencePlaceIndicator | null ,
19
- context : ComponentContext
16
+ context : ComponentContext ,
17
+ cfg : StartStopRootComponentViewConfiguration
20
18
) : StartStopRootComponentView {
21
19
const g = Dom . svg ( 'g' , {
22
20
class : 'sqd-root-start-stop'
@@ -36,24 +34,24 @@ export class StartStopRootComponentView implements ComponentView {
36
34
) ;
37
35
const view = sequenceComponent . view ;
38
36
39
- const x = view . joinX - SIZE / 2 ;
40
- const endY = SIZE + view . height ;
37
+ const x = view . joinX - cfg . size / 2 ;
38
+ const endY = cfg . size + view . height ;
41
39
42
- const iconSize = parentPlaceIndicator ? FOLDER_ICON_SIZE : DEFAULT_ICON_SIZE ;
43
- const startCircle = createCircle ( parentPlaceIndicator ? Icons . folder : Icons . play , iconSize ) ;
40
+ const iconSize = parentPlaceIndicator ? cfg . folderIconSize : cfg . defaultIconSize ;
41
+ const startCircle = createCircle ( parentPlaceIndicator ? cfg . folderIconD : cfg . startIconD , cfg . size , iconSize ) ;
44
42
Dom . translate ( startCircle , x , 0 ) ;
45
43
g . appendChild ( startCircle ) ;
46
44
47
- Dom . translate ( view . g , 0 , SIZE ) ;
45
+ Dom . translate ( view . g , 0 , cfg . size ) ;
48
46
49
- const endCircle = createCircle ( parentPlaceIndicator ? Icons . folder : Icons . stop , iconSize ) ;
47
+ const endCircle = createCircle ( parentPlaceIndicator ? cfg . folderIconD : cfg . stopIconD , cfg . size , iconSize ) ;
50
48
Dom . translate ( endCircle , x , endY ) ;
51
49
g . appendChild ( endCircle ) ;
52
50
53
51
let startPlaceholder : Placeholder | null = null ;
54
52
let endPlaceholder : Placeholder | null = null ;
55
53
if ( parentPlaceIndicator ) {
56
- const size = new Vector ( SIZE , SIZE ) ;
54
+ const size = new Vector ( cfg . size , cfg . size ) ;
57
55
startPlaceholder = context . services . placeholder . createForArea (
58
56
g ,
59
57
size ,
@@ -73,12 +71,12 @@ export class StartStopRootComponentView implements ComponentView {
73
71
Dom . translate ( endPlaceholder . view . g , x , endY ) ;
74
72
}
75
73
76
- const badges = Badges . createForRoot ( g , new Vector ( x + SIZE , 0 ) , context ) ;
74
+ const badges = Badges . createForRoot ( g , new Vector ( x + cfg . size , 0 ) , context ) ;
77
75
78
76
return new StartStopRootComponentView (
79
77
g ,
80
78
view . width ,
81
- view . height + SIZE * 2 ,
79
+ view . height + cfg . size * 2 ,
82
80
view . joinX ,
83
81
sequenceComponent ,
84
82
startPlaceholder ,
@@ -103,8 +101,8 @@ export class StartStopRootComponentView implements ComponentView {
103
101
}
104
102
}
105
103
106
- function createCircle ( d : string , iconSize : number ) : SVGGElement {
107
- const r = SIZE / 2 ;
104
+ function createCircle ( d : string , size : number , iconSize : number ) : SVGGElement {
105
+ const r = size / 2 ;
108
106
const circle = Dom . svg ( 'circle' , {
109
107
class : 'sqd-root-start-stop-circle' ,
110
108
cx : r ,
@@ -115,7 +113,7 @@ function createCircle(d: string, iconSize: number): SVGGElement {
115
113
const g = Dom . svg ( 'g' ) ;
116
114
g . appendChild ( circle ) ;
117
115
118
- const offset = ( SIZE - iconSize ) / 2 ;
116
+ const offset = ( size - iconSize ) / 2 ;
119
117
const icon = Icons . appendPath ( g , 'sqd-root-start-stop-icon' , d , iconSize ) ;
120
118
Dom . translate ( icon , offset , offset ) ;
121
119
return g ;
0 commit comments