I'm not good with a mouse, so I found it hard to edit animation lines.
The mouse position has to be quite precise, with only a small threshold.
Looking at the code, AutomationLine sets the threshold for the PolyLine
to 4.0 . That seems to be a distance, and better for me than what I
experience.
The actual code in PolyLine is however comparing it directly to the
squared distance, making it more sensitive than expected.
Fixed by computing the squared threshold - also including the line
width.
This fixes the following problem:
When automation lines with significant change are zoomed in time, the
slope gets smaller (towards horizontal) as the control points moves
further away from the visible area. That was rendered correctly, but the
corresponding mouse events happened as if the line had a steeper slope.
The problem was caused by the X value being clamped to the visible area,
without scaling the Y value correspondingly. It has apparently been like
that for a decode, since introduced in c4f0063a68.
The problem is fixed by introducing a clamp2 function that scales the Y
value if clamping the X value.
Note: An old comment says that math goes wrong unless clamping below
COORD_MAX. It is not clear to me what math it refers to, and especially
why we don't need similar clamping on the lower bounds.
And while rarely a real problem, I guess it would be more correct and a
slight optimization to skip all lines where both ends are outside the
same bound. In theory, as it is now, the mouse could catch an invisible
line close to the border.
Items no longer need a parent group (they require a Canvas pointer instead), so all constructors have been rationalized
and have two variants, one with a parent and one with a canvas.
All Items now inherit from Fill and Outline, to banish diagonal inheritance and virtual base classes and all that.
There were zero changes to the Ardour GUI arising from these changes.