An old question on locators
- To: mathgroup at smc.vnet.net
- Subject: [mg79588] An old question on locators
- From: Fred Simons <f.h.simons at tue.nl>
- Date: Mon, 30 Jul 2007 06:45:12 -0400 (EDT)
Some time ago, David Park observed that when we manipulate a graph with
some locators as a controller type, and when we specify the appearance
for only one of the locators, all locators show up with this appearance.
However, when we specify the appearances of ALL locators, the
manipulation behaves as expected, as can be seen in the following
simplified example:
Manipulate[
Graphics[{Line[{p1, p2, p3, p1}]}, ImageSize -> 150,
PlotRange -> 1.1],
{{p1, {-1, -1}}, Locator, Appearance -> "A"},
{{p2, { 1, -1}}, Locator, Appearance -> "B"},
{{p3, {0, 1}}, Locator, Appearance -> Automatic}]
When we drop only one of the options Appearance, all three locators turn
up with the appearance of the first option. This seems to me as a minor
bug in Manipulate.
Another workaround is not to use Manipulate at all and use the second
argument of Locator. Without the second argument a locator shows as the
circles with the hair crosses. Here is an example:
DynamicModule[{p1 = {-1, -1}, p2 = {1, -1}, p3 = {0, 1}},
Deploy[Graphics[{Line[Dynamic[{p1, p2, p3, p1}]],
Locator[Dynamic[p1], "A"],
Locator[Dynamic[p2]],
Locator[Dynamic[p3]]},
ImageSize -> 150, PlotRange -> 1.1]]]
In contrast with Manipulate, a locator now can only be dragged by
clicking on its appearance.
Fred Simons
Eindhoven University of Technology