Maybe I could also see if the left-click release is very close to the where the mouse was when the button was first pressed (and there fore the drag distance is zero or very small).
i hate to nitpick further, but now you seem to be asking, and i'm always happy to answer. i don't think you want to check for a drag distance to make it "tolerant" of drag, because this is better for the person zooming, but the person panning will now experience "jumps" (like when a wm snaps to edge. nothing against snap to edge.)
i've been using a mouse since the mid 80's, when they were a lot less sophisticated, but almost as accurate as they are now. it's very possible to click without dragging. only accept a left click if the drag is 0.
i have nothing against middle click except that the only time i've found it easy to do is on xterm and the like, and then just because it's easier, i use shift insert instead. i think of people who have trouble double clicking, even though it's very easy, and for them simulating a middle click would be a lot to ask.
if you do put in a left-click-drag tolerance and do it your way, make the tolerance range 2 pixels. then it would be tolerable for both those panning and zooming. my first goal is to make everything easy for the user, but with all the work you've put in i'd like to make it very easy for you, too. originally i figured a drag tolerance of zero (for left click, versus left button drag) would suffice.