File tree Expand file tree Collapse file tree 2 files changed +26
-13
lines changed
Expand file tree Collapse file tree 2 files changed +26
-13
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import { StepsConfiguration } from '../designer-configuration';
55export class ToolboxItemView {
66 public static create ( parent : HTMLElement , step : Step , configuration : StepsConfiguration ) : ToolboxItemView {
77 const root = Dom . element ( 'div' , {
8- class : 'sqd-toolbox-item'
8+ class : 'sqd-toolbox-item' ,
9+ title : step . name
910 } ) ;
1011
1112 const iconUrl = configuration . iconUrlProvider ? configuration . iconUrlProvider ( step . componentType , step . type ) : null ;
Original file line number Diff line number Diff line change @@ -3,19 +3,31 @@ import { Vector } from '../../core/vector';
33
44export class RegionView {
55 public static create ( parent : SVGElement , widths : number [ ] , height : number ) : RegionView {
6- let offsetX = 0 ;
7- const regions = widths . map ( width => {
8- const region = Dom . svg ( 'rect' , {
9- class : 'sqd-region ' ,
10- width,
11- height,
12- x : offsetX ,
13- fill : 'transparent'
14- } ) ;
15- parent . insertBefore ( region , parent . firstChild ) ;
16- offsetX += width ;
17- return region ;
6+ const totalWidth = widths . reduce ( ( c , v ) => c + v , 0 ) ;
7+
8+ const mainRegion = Dom . svg ( 'rect' , {
9+ class : 'sqd-region' ,
10+ width : totalWidth ,
11+ height,
12+ fill : 'transparent'
1813 } ) ;
14+ const regions : SVGElement [ ] = [ mainRegion ] ;
15+ parent . insertBefore ( mainRegion , parent . firstChild ) ;
16+
17+ let offsetX = widths [ 0 ] ;
18+ for ( let i = 1 ; i < widths . length ; i ++ ) {
19+ const line = Dom . svg ( 'line' , {
20+ class : 'sqd-region' ,
21+ x1 : offsetX ,
22+ y1 : 0 ,
23+ x2 : offsetX ,
24+ y2 : height
25+ } ) ;
26+ regions . push ( line ) ;
27+ parent . insertBefore ( line , parent . firstChild ) ;
28+ offsetX += widths [ i ] ;
29+ }
30+
1931 return new RegionView ( regions ) ;
2032 }
2133
You can’t perform that action at this time.
0 commit comments