@@ -9,12 +9,6 @@ export function deleteAllBorders() {
9
9
document . querySelectorAll ( ".border" ) . forEach ( ( el ) => el . remove ( ) ) ;
10
10
}
11
11
12
- function makeAllBordersTransparent ( ) {
13
- document
14
- . querySelectorAll ( ".border" )
15
- . forEach ( ( el ) => ( el . style . borderColor = "transparent" ) ) ;
16
- }
17
-
18
12
// @ts -ignore
19
13
const iconMap = window . iconMap ;
20
14
@@ -35,67 +29,9 @@ function drawNodeIcon(fontSize, color, label) {
35
29
return icon ;
36
30
}
37
31
38
- function isOverlappingWithTopRightCorner ( bordersTopRightPosition , topLeft ) {
39
- const marginOfError = 8 ;
40
- return bordersTopRightPosition . some ( ( [ x , y ] ) => {
41
- if ( y === topLeft . y ) {
42
- return x + marginOfError >= topLeft . x ;
43
- }
44
- } ) ;
45
- }
46
-
47
- function isEnoughAreaForBorders (
48
- cy ,
49
- paddingX ,
50
- paddingY ,
51
- iconSize ,
52
- iconGap ,
53
- windowPadding
54
- ) {
55
- const windowWidth = window . innerWidth ;
56
- const windowHeight = window . innerHeight ;
57
-
58
- let areaNeededForAllNodes = 0 ;
59
- let maxHeightNeededForBorder = 0 ;
60
- let maxWidthNeededForBorder = 0 ;
61
-
62
- cy . nodes ( ) . forEach ( ( node ) => {
63
- const nodeW = node . renderedWidth ( ) ;
64
- const nodeH = node . renderedHeight ( ) ;
65
- const dimensions = getBorderWidthAndHeight (
66
- paddingX ,
67
- nodeW ,
68
- paddingY ,
69
- nodeH ,
70
- iconSize ,
71
- iconGap
72
- ) ;
73
- areaNeededForAllNodes += dimensions . width * dimensions . height ;
74
- maxHeightNeededForBorder = Math . max (
75
- maxHeightNeededForBorder ,
76
- dimensions . height
77
- ) ;
78
- maxWidthNeededForBorder = Math . max (
79
- maxWidthNeededForBorder ,
80
- dimensions . width
81
- ) ;
82
- } ) ;
83
-
84
- const usableWidth = windowWidth - 2 * windowPadding ;
85
- const usableHeight = windowHeight - 2 * windowPadding ;
86
-
87
- const maxCols = Math . floor ( usableWidth / maxWidthNeededForBorder ) ;
88
- const maxRows = Math . floor ( usableHeight / maxHeightNeededForBorder ) ;
89
-
90
- const maxNodesThatCanFit = maxCols * maxRows ;
91
-
92
- return cy . nodes ( ) . length <= maxNodesThatCanFit ;
93
- }
94
-
95
32
export function drawBorderAndIconForEachExplainNode (
96
33
cy ,
97
- windowPadding ,
98
- isVisible
34
+ windowPadding
99
35
) {
100
36
const paddingX = 30 ;
101
37
const paddingY = 10 ;
@@ -110,15 +46,6 @@ export function drawBorderAndIconForEachExplainNode(
110
46
minIconSize = Math . min ( minIconSize , iconSize ) ;
111
47
} ) ;
112
48
113
- let shouldDrawBorders = isEnoughAreaForBorders (
114
- cy ,
115
- paddingX ,
116
- paddingY ,
117
- minIconSize ,
118
- iconGap ,
119
- windowPadding
120
- ) ;
121
- const bordersTopRightPosition = [ ] ;
122
49
123
50
cy . nodes ( ) . forEach ( ( node ) => {
124
51
const nodeW = node . renderedWidth ( ) ;
@@ -156,22 +83,9 @@ export function drawBorderAndIconForEachExplainNode(
156
83
justifyContent : "center" ,
157
84
paddingTop : `${ paddingY } px` ,
158
85
borderRadius : `${ borderRadius } px` ,
86
+ borderColor : "transparent"
159
87
} ) ;
160
88
161
- const overlappingWithTopRightCorner = isOverlappingWithTopRightCorner (
162
- bordersTopRightPosition ,
163
- topLeft
164
- ) ;
165
- if ( overlappingWithTopRightCorner ) {
166
- shouldDrawBorders = false ;
167
- makeAllBordersTransparent ( ) ;
168
- }
169
- bordersTopRightPosition . push ( [ topLeft . x + dimensions . width , topLeft . y ] ) ;
170
-
171
- if ( ! shouldDrawBorders || ! isVisible ) {
172
- border . style . borderColor = "transparent" ;
173
- }
174
-
175
89
border . appendChild ( drawNodeIcon ( minIconSize , iconColor , node . data ( ) . label ) ) ;
176
90
document . body . appendChild ( border ) ;
177
91
} ) ;
0 commit comments