Zoom/Pan constraints

Hmm, okay. Try putting this at the end of mouseWheel:

translateX = max(0, min(translateX, width * scale));
translateY = max(0, min(translateY, height * scale));