Compare the following two code snippets :
Version 1
pts = {{1, 1}, {0.2, 0.3}, {0.5, .3}}
locpts = pts;
Panel[
LocatorPane[
Dynamic[locpts,
{(locpts = #; pts = #
) &}],
Dynamic@
Graphics[{Point[locpts], Dynamic[Polygon[locpts]]},
PlotRange -> {{0, 1}, {0, 1}}],
LocatorAutoCreate -> All]]
Version 2
pts = {{1, 1}, {0.2, 0.3}, {0.5, .3}}
locpts = pts;
Panel[
LocatorPane[
Dynamic[locpts,
{(locpts = #; pts = #
) &}],
Dynamic@
Graphics[{Point[locpts], Dynamic[Polygon[pts]]},
PlotRange -> {{0, 1}, {0, 1}}],
LocatorAutoCreate -> All]]
Both versions are the same except for the third line from below where Polygon[locpts] was changed to Polygon[pts].
In the first version a delete of a locator is immediately propagated in the graphic while this is not the case in the second version. I would expect no difference since I set both pts and locpts to #.
Question: what is the explanation of this behavior?
locptsandptsjust beforeGraphics.... IfLength[locpts]<Length[pts], then a points was removed, and you should take appropriate action. – Heike May 25 '12 at 12:55