pdCanvas: improve behavior of "auto-select layer under mouse"

If the user interacts with a layer via the canvas, it will be
auto-activated (if the relevant toggle is active).  When the mouse
leaves the canvas, it may pass over other layers on its way out.  When
this happens, focus should be restored to the *last layer interacted
with*.