LocatorPane

LocatorPane[{x,y},back]

represents a pane with a locator at position {x,y} and background back.

LocatorPane[Dynamic[pt],back]

takes the locator position to be the dynamically updated current value of pt, with the value of pt being reset if the locator is moved.

LocatorPane[{pt1,pt2,},back]

sets up multiple locators at positions pt1, pt2, .

LocatorPane[Dynamic[{pt1,pt2,}],back]

takes the locator positions to be dynamically updated current values of the pti.

LocatorPane[pts,back,{{xmin,ymin},{xmax,ymax}}]

specifies the range of coordinates for the locator.

LocatorPane[pts,back,{{xmin,ymin},{xmax,ymax},{dx,dy}}]

uses jumps dx, dy.

Details and Options

  • The background in a locator pane can be a graphic or any other expression.
  • For a Graphics object g, LocatorPane[pt,g] by default takes the range of coordinates for pt to be the range of graphics coordinates corresponding to PlotRange in g.
  • For a general expression, LocatorPane[pt,expr] takes the range of coordinates for pt to be 0 to 1 in each direction.
  • The following options can be given:
  • Appearance Automaticthe appearance of locators
    AutoAction Falsewhether to move the locator automatically when the mouse is over it
    BaselinePositionAutomatichow to align with a surrounding text baseline
    BaseStyle{}base style specifications for the locator pane
    ContinuousAction Truewhether to update continuously when locators are moved
    Enabled Automaticwhether the locator pane is enabled, or its locators are grayed out
    Exclusions{}specific points to exclude
    LocatorAutoCreate Falsewhether to allow clicks to create new locators
    TouchscreenAutoZoomFalse
  • whether to zoom to fullscreen when activated on a touchscreen
  • With the setting Appearance->g, all locators in the locator pane are displayed as g, where g is any graphic or other expression. »
  • With Appearance->{g1,g2,}, the i^(th) locator is displayed as gi. »
  • LocatorPane[{pt1,pt2,},back,{range1,range2,}] specifies different ranges for different locators.
  • LocatorPane[pts,back,range] by default directs any click to the nearest locator.
  • The settings for BaseStyle are appended to the default style typically given by the "LocatorPane" style in the current stylesheet.

Examples

open allclose all

Basic Examples  (2)

Create a locator pane with a single locator and a background image of a disk:

Create multiple locators:

Use Dynamic to connect locator positions to variables:

Do the same for multiple locators:

Scope  (8)

LocatorPane Content  (2)

Use a graphic as the background:

Include an empty graphic:

Use any expression as the background:

LocatorPane Control  (6)

Specify a range of coordinates for locators:

Specify both a range and jump size for locators:

Use any expression as the appearance for locators:

Use multiple locators:

Use a dynamic setting:

Connect the dynamic setting to a Slider2D:

Options  (15)

Appearance  (3)

Use any expression as the appearance for locators in LocatorPane:

Multiple locators with different appearances:

Use Appearance->None for invisible locators:

Use an invisible locator to implement a constrained movement:

AutoAction  (2)

By default, the locator does not change until you click in the locator pane:

By setting AutoAction, the locator changes as the mouse moves over the locator pane:

Background  (2)

Change the background colors:

Change the background color dynamically:

ContinuousAction  (2)

By default, variables are continuously updated:

Setting ContinuousAction to False makes variable updates only when the locator is released:

Enabled  (2)

By default, LocatorPane is enabled:

By setting Enabled->False, the locator is disabled but visible in its current state:

LocatorAutoCreate  (4)

By default, each click in the locator pane will move the nearest locator:

By setting LocatorAutoCreate->True, you can use Alt+Click to create or remove locators:

By setting LocatorAutoCreate->All, create a locator on each click (Alt+Click to remove):

Make an interactive plot that runs through all locators:

Applications  (6)

Set up an array of movable random points:

Create a locator that is constrained to follow the curve:

Use CurrentValue["CurrentLocatorPaneThumb"] to enforce different drag restrictions on different points:

Visualize solutions to a linear system of differential equations :

Interactive curve fit plot:

Interactive three-point circle [more info]:

Properties & Relations  (2)

LocatorPane is a special case of EventHandler:

Use Setting to extract the setting of a LocatorPane:

Neat Examples  (3)

Use AutoAction to select the locator closest to the mouse point:

Constrain the locator to a circle:

Visualize solutions to a linear system of differential equations :

Wolfram Research (2007), LocatorPane, Wolfram Language function, https://reference.wolfram.com/language/ref/LocatorPane.html (updated 2012).

Text

Wolfram Research (2007), LocatorPane, Wolfram Language function, https://reference.wolfram.com/language/ref/LocatorPane.html (updated 2012).

CMS

Wolfram Language. 2007. "LocatorPane." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/LocatorPane.html.

APA

Wolfram Language. (2007). LocatorPane. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LocatorPane.html

BibTeX

@misc{reference.wolfram_2024_locatorpane, author="Wolfram Research", title="{LocatorPane}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/LocatorPane.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_locatorpane, organization={Wolfram Research}, title={LocatorPane}, year={2012}, url={https://reference.wolfram.com/language/ref/LocatorPane.html}, note=[Accessed: 21-November-2024 ]}