Commit 62ef763a80271b58e0c0f6e51891828f22689daa
1 parent
6e152848
Exists in
master
and in
4 other branches
Refector: clean up code.
Showing
1 changed file
with
9 additions
and
13 deletions
Show diff stats
app/assets/javascripts/branch-graph.js.coffee
... | ... | @@ -131,7 +131,7 @@ class BranchGraph |
131 | 131 | shortrefs = refs |
132 | 132 | # Truncate if longer than 15 chars |
133 | 133 | shortrefs = shortrefs.substr(0, 15) + "…" if shortrefs.length > 17 |
134 | - text = r.text(x + 8, y, shortrefs).attr( | |
134 | + text = r.text(x + 4, y, shortrefs).attr( | |
135 | 135 | "text-anchor": "start" |
136 | 136 | font: "10px Monaco, monospace" |
137 | 137 | fill: "#FFF" |
... | ... | @@ -139,7 +139,7 @@ class BranchGraph |
139 | 139 | ) |
140 | 140 | textbox = text.getBBox() |
141 | 141 | # Create rectangle based on the size of the textbox |
142 | - rect = r.rect(x, y - 7, textbox.width + 15, textbox.height + 5, 4).attr( | |
142 | + rect = r.rect(x, y - 7, textbox.width + 5, textbox.height + 5, 4).attr( | |
143 | 143 | fill: "#000" |
144 | 144 | "fill-opacity": .5 |
145 | 145 | stroke: "none" |
... | ... | @@ -206,22 +206,19 @@ class BranchGraph |
206 | 206 | |
207 | 207 | # Build line shape |
208 | 208 | if parent[1] is commit.space |
209 | - d1 = [0, 5] | |
210 | - d2 = [0, 10] | |
211 | - arrow = "l-2,5,4,0,-2,-5" | |
209 | + offset = [0, 5] | |
210 | + arrow = "l-2,5,4,0,-2,-5,0,5" | |
212 | 211 | |
213 | 212 | else if parent[1] < commit.space |
214 | - d1 = [3, 3] | |
215 | - d2 = [7, 5] | |
216 | - arrow = "l5,0,-2,4,-3,-4" | |
213 | + offset = [3, 3] | |
214 | + arrow = "l5,0,-2,4,-3,-4,4,2" | |
217 | 215 | |
218 | 216 | else |
219 | - d1 = [-3, 3] | |
220 | - d2 = [-7, 5] | |
221 | - arrow = "l-5,0,2,4,3,-4" | |
217 | + offset = [-3, 3] | |
218 | + arrow = "l-5,0,2,4,3,-4,-4,2" | |
222 | 219 | |
223 | 220 | # Start point |
224 | - route = ["M", x + d1[0], y + d1[1]] | |
221 | + route = ["M", x + offset[0], y + offset[1]] | |
225 | 222 | |
226 | 223 | # Add arrow if not first parent |
227 | 224 | if i > 0 |
... | ... | @@ -230,7 +227,6 @@ class BranchGraph |
230 | 227 | # Circumvent if overlap |
231 | 228 | if commit.space isnt parentCommit.space or commit.space isnt parent[1] |
232 | 229 | route.push( |
233 | - "L", x + d2[0], y + d2[1], | |
234 | 230 | "L", parentX2, y + 10, |
235 | 231 | "L", parentX2, parentY - 5, |
236 | 232 | ) | ... | ... |