Sometimes ClickPane does not seem to work. Here we see the correct operation - mouse clicks create points on the output row:
AnImg[p_] := Framed@Graphics[Point[p]];
DynamicModule[
{pts = {}},(* some points to plot - starts empty *)
ClickPane[
AnImg[Dynamic[pts]], (* Plot the points in a Frame *)
AppendTo[pts, #] & (* add clicks to the list of points *)
]
]
(A rather neat Mathematica snippet) So far so good, but what if I alter AnImg[] to overlay the points on an image? First altering AnImg[]:
AnImg[p_] := ImageCompose[ (* two images combined into one output image*)
Graphics[{Blue , Opacity[0.5], Rectangle[]}],
Graphics[{PointSize[0.05], Red, Opacity[0.5], Point[p]}]
];
AnImg[{{-20, -20}, {0, 0}, {20, 20}}] (* Just to show that the altered function works *)
But ... our original ClickPane no long seems to work ...
DynamicModule[
{pts = {{-20, -20}, {0, 0}, {20, 20}}}, (* some points to plot - starts empty *)
ClickPane[
AnImg[Dynamic[pts]], (* Plot the points in a Frame *)
AppendTo[pts, #] &
]
]
It displays the first calculation of the AnImg[] but mouse-clicks are no longer detected.
I have attached my file and would welcome any comments; I must have missed something.
Attachments: