Re: Locator in Manipulate's graphic.
- To: mathgroup at smc.vnet.net
- Subject: [mg82195] Re: [mg82142] Locator in Manipulate's graphic.
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Sun, 14 Oct 2007 06:16:33 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200710130750.DAA17285@smc.vnet.net>
- Reply-to: murray at math.umass.edu
I believe this is the same issue I once had that was answered in this
group by John Fultz [mg8009]. I don't have his direct reply, but here's
a response I sent [mg80037] that includes his explanation:
I'm still not sure I completely understand....
OK, as I can see, the locator is a large, framed, red rectangle when I use
dot=Graphics[{PointSize[Medium],Point[{0,0}]},Background->Red,
Frame->True]
but why, given the option LocatorAutoCreate->All, don't I then see a
bunch of large, framed, red rectangles when I click to create new
points? Is it just that the new "points" are really there but I cannot
see them, that I can only see the one "point" that's on top because I
created it last?
John Fultz wrote:
> On Fri, 10 Aug 2007 01:45:30 -0400 (EDT), Murray Eisenberg wrote:
>> Here's a LocatorPane inside a DynamicModule with a Locator initialized
>>
>> at the origin and where additional Locator points will be created at
>> mouse clicks:
>>
>> dot=Automatic;
>>
>> DynamicModule[{pts = {{0, 0}}},
>> LocatorPane[Dynamic[pts],
>> Graphics[Point /@ pts],
>> Appearance -> dot,
>> LocatorAutoCreate -> All]
>> ]
>>
>> This works as expected. (The setting Automatic for Appearance is the
>> default.)
>>
>> Now change the definition of dot to:
>>
>> dot=Graphics[Disk[],ImageSize->5]
>>
>> Still OK. But, finally, change the defintion of dot to:
>>
>> Graphics[{PointSize[Medium],Point[{0,0}]}]
>>
>> Now it does NOT work as expected: Although the initialized points do
>> appear correctly, and a new dot appears at the first click in the
>> output, upon each additional click a new dot does not appear but,
>> instead, that one new dot moves to the location of the click.
>>
>> Diagnosis? Cure?
>
> This is correct behavior. If you change dot to be...
>
> dot = Graphics[{PointSize[Medium], Point[{0, 0}]}, Background -> Red,
> Frame -> True]
>
> ...and play around with the result, the reason for the behavior
should start to
> be come obvious. The default size of a Graphics[] object is the size
of the
> graphic. And the entire graphics object represents the Locator, so
all you're
> doing is moving the existing Locator (as you should correctly do when
clicking
> directly on a Locator), rather than creating a new one. The only
reason the
> Disk[] example worked as you expected is because you set the
ImageSize to be so
> small, which affected the size of not just the disk, but the Locator
itself.
W. Craig Carter wrote:
> Can anyone see a way to change the Locator's appearance in
> Manipulate.
>
> i.e., from the documentation:
>
> Manipulate[
> Graphics[Line[{{0, 0}, p}], PlotRange -> 2], {{p, {1, 1}},
> Locator}]
>
> I've tried the "obvious generalization":
>
> Manipulate[
> Line[{{0, 0}, p}], PlotRange -> 2], {{p, {1, 1}},
> (Locator[#,Appearance->Graphics[Circle[#,2]])&}]
>
> without success. Any ideas?
>
>
> W. Craig Carter
>
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
- References:
- Locator in Manipulate's graphic.
- From: "W. Craig Carter" <ccarter@mit.edu>
- Locator in Manipulate's graphic.