1
|
|
|
import { select } from 'd3-selection'; |
2
|
|
|
import { LabelColors, ElementIds } from '../AppConsts'; |
3
|
|
|
import { DependencyLink, DependencyNode } from '../../components/types'; |
4
|
|
|
import { BaseType } from 'd3-selection'; |
5
|
|
|
|
6
|
|
|
export function selectHighLightedNodes() { |
7
|
|
|
return selectAllNodes().filter(function(this: SVGGElement) { |
8
|
|
|
return this.firstElementChild ? this.firstElementChild.getAttribute('fill') !== LabelColors.DEFAULT : false; |
9
|
|
|
}); |
10
|
|
|
} |
11
|
|
|
|
12
|
|
|
export function selectAllNodes() { |
13
|
|
|
return selectById(ElementIds.LABELS).selectAll<SVGGElement, DependencyNode>('g'); |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
export function selectAllLinks() { |
17
|
|
|
return selectById(ElementIds.LINKS).selectAll<SVGPathElement, DependencyLink>('path'); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
export function selectHighlightBackground() { |
21
|
|
|
return selectById(ElementIds.HIGHLIGHT_BACKGROUND); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
export function selectDetailsButtonWrapper() { |
25
|
|
|
return selectById(ElementIds.DETAILS_BUTTON); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
export function selectDetailsExitButtonWrapper() { |
29
|
|
|
return selectById(ElementIds.DETAILS_EXIT_BUTTON); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
export function selectDetailsButtonRect() { |
33
|
|
|
return selectDetailsButtonWrapper().select('rect'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
export function selectDetailsButtonText() { |
37
|
|
|
return selectDetailsButtonWrapper().select('text'); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
export function selectDetailsViewContainer() { |
41
|
|
|
return selectById(ElementIds.DETAILS_VIEW_CONTAINER); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
export function selectDetailsContainerDiv() { |
45
|
|
|
return selectById(ElementIds.DETAILS_CONTAINER_DIV); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
export function selectDetailsZoom() { |
49
|
|
|
return selectById(ElementIds.ZOOM_DETAILS); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
export function selectContainer() { |
53
|
|
|
return selectById(ElementIds.CONTAINER); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
export function selectById<Data = unknown>(selector: ElementIds) { |
57
|
|
|
return select<BaseType, Data>(`#${selector}`); |
58
|
|
|
} |
59
|
|
|
|