f[x_] := Sin[x];
tran[v_] := {Identity@First@v, f@First@v};
{A, B} = {Dynamic[p, (p = tran[#]) &], Dynamic[q, (q = tran[#]) &]};
DynamicModule[{p = {1, f[1]}, q = {2, f[2]}},
Show[Plot[f[x], {x, -5, 5}, AspectRatio -> Full],
Graphics[{Locator[A], Locator[B]}],
(*Graphics[InfiniteLine[{A,B}]],*)
Graphics[Line[{A, B}]]
]
]
一旦用 InfiniteLine 总是报错