MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: locator snap

Maarten van der Burgt wrote:
> Dear all,
> In the example below the locator can be moved to any position in the graphic.
> Can the locator be made to snap to multiples of say 0.1?
>  Manipulate[Column@{Graphics[{}, Axes -> True], p}, {{p, {0, 0}}, Locator}]

Hi Maarten,

I am not aware of any way to do this directly with Manipulate. (Of 
course this does not mean that there doesn't exist a way!)

Here is an example of doing it directly with Dynamic:

  Locator[Dynamic[{x, y}, ({x, y} = Round[#, 0.1]) &]],
  PlotRange -> 1, Frame -> True,
  GridLines -> {#, #} & @
   Table[{x, If[Mod[x, 1/2] == 0, Black, Gray]}, {x, -1, 1, 1/10}]


P.S.  Sorry for the convoluted grid line construction

  • Prev by Date: Re: 3D Arrows
  • Next by Date: Re: Does Mathematica really need more printed, introductory documentation?
  • Previous by thread: Re: locator snap
  • Next by thread: Re: locator snap