We can restrict the movement of locators in a LocatorPane
as follows:
In the following example, the first locator's movement is confined to the x-axis and the second locator's movement is confined to the y-axis.
Manipulate[LocatorPane[Dynamic[pts],
Graphics[{}, PlotRange -> max, Axes -> True, ImageSize -> 350],
{{{-max, 0}, {max, 0}},
{{0, -max}, {0, max}}}],
{{pts, {{9, 0}, {0, 11}}}, ControlType -> None}, Initialization :> {max = 25}]
However, a locator can be dragged without necessarily being selected. You can begin dragging a locator by clicking down on just about any point in the four quadrants and dragging from there.
I would like to have the locator respond only to drags that are initiated by "mousedown"ing on the locator itself.
Any ideas as to how I might achieve this?
Addendum In my the more complicated example I've been working with, I've made use of jump parameters to confine locators to integer values:
{{{-maxX, 0}, {maxX, 0}, {1, 0}},
{{0, -maxY}, {0, maxY}, {0, 1}}}
I'm not sure whether such constraints (to integers) can be imposed on locators outside of LocatorPane
s.