Here is a program that works properly. The key subtle issue is this: Suppose you press down the mouse button at x = 0.4, and you set scene.center.x to 0.4. Now where the mouse is located is no longer x = 0.4 but x = 0.8. A way to deal with that is to set the initial lastx to 0.8 rather than 0.4, hence the odd factor of 2 in the last line of the down function.
#---------------------------------------------------------------
def down():
global drag, lastx
drag = True
scene.center.x = scene.mouse.pos.x
lastx = 2*scene.center.x
def move():
global lastx
if drag:
dx = scene.mouse.pos.x - lastx
scene.center.x += dx
lastx = scene.mouse.pos.x+dx
def up():
global drag
drag = False
#---------------------------------------------------------------
scene.range = 1
sphere(pos=vec(-.4,0,0), radius=0.1, color=color.red)
sphere(pos=vec(0,0,0), radius=0.1, color=color.green)
sphere(pos=vec(.4,0,0), radius=0.1, color=color.blue)