Skip to content

Commit 413afe1

Browse files
committed
line overlap fixed for regions.
1 parent cf43bcb commit 413afe1

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

src/toolbox/toolbox-item-view.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { StepsConfiguration } from '../designer-configuration';
55
export 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;

src/workspace/common-views/region-view.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,31 @@ import { Vector } from '../../core/vector';
33

44
export 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

0 commit comments

Comments
 (0)