Message Boards Message Boards

0
|
8234 Views
|
7 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Does Locator Have an Option to Constrain its Movement

Posted 10 years ago
POSTED BY: Gregory Lypny
7 Replies
POSTED BY: Rafael Rodriguez
Posted 2 years ago

A Manipulate example:

Manipulate[
    p = Round[p];
    Graphics[PlotRange -> 10, Axes -> True, PlotLabel -> p],
    {p, ContinuousAction -> False, Locator}
 ]
POSTED BY: Hans Milton

Thank you so much.

POSTED BY: Rafael Rodriguez

A special feature of Round is that the second argument can also be a list. This makes it easy to round a 2D-point with different granularity along the first and second dimensions. For example, Round[{3.1, 6.5}, {2, 1}] gives {4,6}.

POSTED BY: Szabolcs Horvát
Posted 10 years ago

I didn't know that. Excellent. Thanks!

Gregory

POSTED BY: Gregory Lypny

I think you have to use the method relying on re-setting the position (using Round), as in the example under Applications in the documentation page of Locator.

POSTED BY: Szabolcs Horvát
Posted 10 years ago

Much obliged, Szabolcs.

Gregory

POSTED BY: Gregory Lypny
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract