ventDefault()
    e.stopPropagation()

def mouse_up(e):
    global key,mpos
    key = [0, 0, 0, 0, 0]
    mpos = None
    e.preventDefault()
    e.stopPropagation()

def mouse_down(e):
    global mpos
    mpos = [e.x, e.y]
    e.preventDefault()
    e.stopPropagation()

def mouse_move(e):
    global mpos
    if mpos == None:
        return
    x, y = mpos
    mpos = [e.x, e.y]
    if x == mpos[0]:
        if mpos[1] - y > 0:
            key[3] = 1 # down
        elif mpos[1] - y < 0:
            key[2] = 1 