Re: locator snap
- To: mathgroup at smc.vnet.net
- Subject: [mg88257] Re: locator snap
- From: Albert Retey <awnl at arcor.net>
- Date: Wed, 30 Apr 2008 04:22:17 -0400 (EDT)
- References: <fv6ukg$rmt$1@smc.vnet.net>
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}]
>
> Thanks for your help.
>
> Maarten
This is almost literaly from the documentation of Locator -> Scope ->
Locator Control, I just changed the constrain:
Deploy[DynamicModule[{p = {1, 0}},
Graphics[{Red, Disk[],
Locator[Dynamic[p, (p = Round[#*10]/10.) &]]}, PlotRange -> 1.5,
PlotLabel -> Dynamic[p]]]]
hth,
albert