1

I have found several solutions for linking locators (using the second argument for Dynamic) but they have the following problem:

How do I keep the locators from resetting, when I choose something from the setterbar in the example below? I would like the position of the arrow to be unchanged after moving the locators and clicking on the setterbar.

I am thinking, that somehow moving the to dynamic locators into control definitions in the Manipulate, but I can't figure out how to specify the second argument of Dynamic inside a control definition (i.e. of the form Control[{x, , }] at the end of Manipulate).

I had a fix in MM9 using a temporary "old" value of the positions, but it stopped working in MM10. (Suddenly the end locator started moving weirdly).

Manipulate[
 DynamicModule[{start, end, v},
  start = {0, 0};
  end = {1, 1};
  v = end - start;

  Deploy@Graphics[{
     Locator@
      Dynamic[start, {(v = end - start;) &, (start = #; 
          end = start + v;) &, None}],
     Locator@Dynamic[end],
     Dynamic@Arrow[{start, end}],
     Switch[operation,
      "1", Point[start],
      "2", Point[end]]
     }, PlotRange -> 3]],

 {{operation, "1"}, {"1", "2"}}
 ]
Sofic
  • 673
  • 3
  • 8

0 Answers0