Why can't I perfectly align an Inset LocatorPane with its container?
- To: mathgroup at smc.vnet.net
- Subject: [mg99879] Why can't I perfectly align an Inset LocatorPane with its container?
- From: Michael <michael2718 at gmail.com>
- Date: Mon, 18 May 2009 02:31:00 -0400 (EDT)
Here's the code: Module[{w, h, pts, img}, w = 800; h = 600; pts = {{60, 380}}; img = Graphics[{ RGBColor[0, 0, 1], Table[Rectangle[{x - 1, 0}, {x + 1, 600}], {x, 0, 800, 20}], Table[Rectangle[{0, y - 1}, {800, y + 1}], {y, 0, 600, 20}], Rectangle[{100, 100}, {200, 200}] }, ImageSize -> {w, h}, PlotRange -> {{0, w}, {0, h}}, PlotRangeClipping -> True]; Pane[Graphics[{ RGBColor[0, 0, 0], RGBColor[1, 0, 0], Table[Rectangle[{x - 1, 0}, {x + 1, 600}], {x, 0, 800, 20}], Table[Rectangle[{0, y - 1}, {800, y + 1}], {y, 0, 600, 20}], Rectangle[{150, 150}, {250, 250}], Opacity[0.5], Inset[ LocatorPane[Dynamic[pts], img, ImageSize -> {w, h}, LocatorAutoCreate -> True] (*,{397,302} *)] }, ImageSize -> {w, h}, PlotRange -> {{0, w}, {0, h}}, PlotRangeClipping -> True], ImageSize -> {800, 600}, ImageSizeAction -> "Scrollable", Scrollbars -> Automatic] ] Both the inset and the containing Graphics[] are supposed to be the same size, yet for some reason the default alignment ("Center") shows a noticable offset. If I uncomment the coordinates {392,302} (why I pretty much had to determine by visual inspection of the misalignment!) then everything aligns properly, but I'm still missing one pixel of the inset at the bottom edge, and two at the right edge. If I use a Pane instead of a LocatorPane, then the centered alignment is much closer, but it still appears to be off by one. Unrelated question, why doesn't LocatorPane have all the Options that Pane does? Specifically ImageSizeAction and ScrollPosition are missing. Thanks, Michael