Great!
I am not really that experienced with this, so I might be wrong in my explanations but this is at least what I believe happens:
I'll need to start with number 3 in order to explain number 1. Dynamic[pt2] is a symbol that is sent to LocatorPane and it will use the initial value of pt2 when initializing. If it has a Dynamic[] head, LocatorPane will be able to manipulate the symbol and the new values affect other parts of the Notebook. If there was only pt2, no Dynamic[], it would only use pt2 as a start value and actions in the LocatorPane would not update any symbol. This is the same of all control objects, check for example the documentation for Slider.
The Dynamic around LocatorPane is needed because the square you are drawing changes with your mouse movements. If there wasn't any Dynamic around it, it would only display the square that was drawn when the LocatorPane was initialized and it wouldn't update with new values for pt2 or pt1.
Check for example this code:
x = 1;
{Dynamic[Slider[Dynamic[x], {0, x}, ContinuousAction -> False]],
Dynamic[x]}
The slider gets redrawn only because there is a Dynamic around it.
Now, the problem is that since the LocatorPane gets redrawn on every new value for pt2, the cursor loses focus when it is redrawn. Thus I was not able to move the pointer since it would instantly lose focus. AutoAction was a way around it, I don't really know why that works, but it did. AutoAction only gets enabled when the right mouse button is pressed and disabled once it is released.
The cleanest way would possibly be to only update the LocatorPane on zoom in and overlay the zoom square, but I was not able to get that to work.
AutoAction works with most control objects, it even works with CheckBox, though I would not recommend using it there (:
You can use this to get a feeling for where the zoom square is and the two different points:
autoAction = False;
pt1 = {0, 0};
pt2 = {0, 0};
zoom = {{0, 4}, {-2, 2}};
graphics = {Thick, Green, Rectangle[{0, -1}, {2, 1}], Red, Disk[],
Blue, Circle[{2, 0}], Yellow, Polygon[{{2, 0}, {4, 1}, {4, -1}}],
Purple, Arrowheads[Large], Arrow[{{4, 3/2}, {0, 3/2}, {0, 0}}],
Black, Dashed, Line[{{-1, 0}, {4, 0}}]};
EventHandler[
Dynamic[LocatorPane[Dynamic[pt2],
Graphics[{graphics, Locator[pt1, Style["pt1", Large]],
Locator[pt2, Style["pt2", Large]],
Directive[{LightOrange, Opacity[0.5]}], Rectangle[pt1, pt2]},
PlotRange -> zoom], AutoAction -> autoAction,
Appearance -> None]], {{"MouseDown", 1} :> (autoAction = True;
pt1 = MousePosition["Graphics"];), {"MouseUp",
1} :> (autoAction = False;
zoom = Transpose[{pt1, pt2}]; pt1 = {0, 0};
pt2 = {0, 0};), {"MouseClicked", 2} :> (zoom = {{0, 4}, {-2, 2}})}]
Dynamic[Graphics[{graphics, Locator[pt1, Style["pt1", Large]],
Locator[pt2, Style["pt2", Large]],
Directive[{LightOrange, Opacity[0.5]}],
Rectangle @@ Transpose[zoom]}]]
Regards,
Patrik