I am trying to make a cookie cutter that will extract a small square from a much larger bitmap with a click of the mouse. The LocatorPane
appears to be a useful way to move the cookie cutter around, but I'm not having much luck in drawing the small dynamic rectangle over the bitmap. I would like to change the appearance of the locator icon to a small rectangle, or just make the locator icon disappear. The LocatorPane
option Appearance -> Graphics[Rectangle[]]
didn't work. Beyond that there is the question of how to capture a point value with a mouse click. This is my first use of Dynamic
. I suspect I am going about this all the wrong way and perhaps I should be doing something with mouse functions and cursor images. If so, I would appreciate it if someone would point me towards a pertinent page or two. I have not been able to find one.
This script draws the locator on a bitmap labeled "background":
Clear[background]
background = Image[Graphics[{LightGray, Rectangle[]}]];
DynamicModule[
{pt = {180, 180}},
LocatorPane[Dynamic[pt], background]
]
But when I add code for the dynamic rectangle, I find that it draws outside the background bitmap.
DynamicModule[
{pt = {180, 180}},
{LocatorPane[Dynamic[pt], background],
Graphics[
{EdgeForm[{Thick, Red}],
FaceForm[],
Rectangle[Dynamic[pt]]}
]}
]