Colored, indexed, resizable locators
- To: mathgroup at smc.vnet.net
- Subject: [mg124584] Colored, indexed, resizable locators
- From: Chris Young <cy56 at comcast.net>
- Date: Wed, 25 Jan 2012 07:08:24 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
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 at 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}} ]