Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8161 > unrolled thread

Colored, indexed, resizable locators

Started byChris Young <cy56@comcast.net>
First post2012-01-25 12:13 +0000
Last post2012-01-25 12:13 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Colored, indexed, resizable locators Chris Young <cy56@comcast.net> - 2012-01-25 12:13 +0000

#8161 — Colored, indexed, resizable locators

FromChris Young <cy56@comcast.net>
Date2012-01-25 12:13 +0000
SubjectColored, indexed, resizable locators
Message-ID<jforl6$6c7$1@smc.vnet.net>
The only problems remaining is that the locators don't initially snap
to the grid, when they're first created, and that increasing the offset
of the indices too much tends to nudge the locators away from their
correct positions slightly.

To use this, just add whatever graphics you want in the Graphics[ ]
expresssion. I've just connected the points with lines.

http://home.comcast.net/~cy56/Mma/ColoredResizableLocators.nb
http://home.comcast.net/~cy56/Mma/ColoredResizableLocatorsPic.png

Chris Young
cy56@comcast.net

loc[k_, n_, locSize_, opac_, offset_] :=
 Graphics[
  {
   Opacity[opac],
   Hue[0.85 ((k - 1)/(n - 1))], Disk[{0, 0}],
   Opacity[1], Black, Circle[{0, 0}],
   Line[{{-1.5, 0}, {1.5, 0}}], Line[{{0, -1.5}, {0, 1.5}}],
   Text[k, {0, 0}, offset]
   },
  ImageSize -> locSize]

Manipulate[
 DynamicModule[
  {P = {{0, 0}, {1, 1}}},

  Dynamic @ LocatorPane[
    Dynamic @ P,

    Show[
     Graphics[{Thick, Line[Dynamic @ P]}],

     Axes -> True,
     PlotRange -> 2,
     GridLines -> {Range[-2, 2, 0.25], Range[-2, 2, 0.25]},
     GridLinesStyle -> LightGray
     ],
    {{-2, -2}, {2, 2}, {0.25, 0.25}},

    LocatorAutoCreate -> True,
    Appearance -> With[{n = Length[P]},
      Table[loc[k, n, locSize, opac, offset], {k, 1, n}]
      ]
    ]
  ],
 {{locSize, 30}, 5, 80, 1},
 {{opac, 0.3}, 0, 1},
 {{offset, {1, -1}}, {-2, -2}, {2, 2}, {0.25, 0.25}}
 ]

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web