3

1

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?**

This snippet does not run, but I get your point. – nilo de roock – 2012-05-23T14:59:26.757

broken code: brackets do not match – Mr.Wizard – 2012-05-23T14:59:36.770

Yes, this is an accurate reflection of the question. Is this expected behavior? How can a removal of points best be trapped? – nilo de roock – 2012-05-23T15:03:03.273

1@ndroock1 I've fixed the code now. – Heike – 2012-05-23T15:08:19.380

Please see my previous comment ( if you haven't done so already. ) – nilo de roock – 2012-05-23T15:17:09.650

@ndroock1 I have no idea whether this is known behaviour or not. To trap the removal of points, you could compare the lengths of

`locpts`

and`pts`

just before`Graphics...`

. If`Length[locpts]<Length[pts]`

, then a points was removed, and you should take appropriate action. – Heike – 2012-05-25T12:55:46.580Sorry, for the late accept. – nilo de roock – 2012-06-04T08:21:52.260