Commit 658170e4 authored by Kai Willadsen's avatar Kai Willadsen

linkmap: Simplify our bezier drawing

parent 3bb8bf79
......@@ -75,9 +75,8 @@ class LinkMap(Gtk.DrawingArea):
self.views[1].get_line_num_for_y(pix_start[1] + height),
]
wtotal = allocation.width
# For bezier control points
x_steps = [-0.5, wtotal / 2, wtotal / 2, wtotal + 0.5]
x_steps = [-0.5, allocation.width / 2, allocation.width + 0.5]
q_rad = math.pi / 2
left, right = self.view_indices
......@@ -98,24 +97,24 @@ class LinkMap(Gtk.DrawingArea):
if (t0 < 0 and t1 < 0) or (t0 > height and t1 > height):
if f0 == f1:
continue
context.arc(x_steps[0], f0 - 0.5 + RADIUS, RADIUS, -q_rad, 0)
context.arc(x_steps[0], f0 - 0.5 + RADIUS, RADIUS, q_rad * 3, 0)
context.arc(x_steps[0], f1 - 0.5 - RADIUS, RADIUS, 0, q_rad)
context.close_path()
elif (f0 < 0 and f1 < 0) or (f0 > height and f1 > height):
if t0 == t1:
continue
context.arc_negative(x_steps[3], t0 - 0.5 + RADIUS, RADIUS,
-q_rad, q_rad * 2)
context.arc_negative(x_steps[3], t1 - 0.5 - RADIUS, RADIUS,
context.arc_negative(x_steps[2], t0 - 0.5 + RADIUS, RADIUS,
q_rad * 3, q_rad * 2)
context.arc_negative(x_steps[2], t1 - 0.5 - RADIUS, RADIUS,
q_rad * 2, q_rad)
context.close_path()
else:
context.move_to(x_steps[0], f0 - 0.5)
context.curve_to(x_steps[1], f0 - 0.5,
x_steps[2], t0 - 0.5,
x_steps[3], t0 - 0.5)
context.line_to(x_steps[3], t1 - 0.5)
context.curve_to(x_steps[2], t1 - 0.5,
x_steps[1], t0 - 0.5,
x_steps[2], t0 - 0.5)
context.line_to(x_steps[2], t1 - 0.5)
context.curve_to(x_steps[1], t1 - 0.5,
x_steps[1], f1 - 0.5,
x_steps[0], f1 - 0.5)
context.close_path()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment