def scroll(axis_side): axis, side = literal_eval(axis_side) #print "axis, side", axis, side, side = -1 if side == 0 else 1 diff = P(50 * side, 0) if axis == 0 else P(0, 50 * side) #print diff scale = get_scale(doc['drawing'], "zoom") xy = get_translate(doc['drawing'], "scroll_xy") + diff / scale doc['drawing.transforms.scroll_xy'] = ("translate", xy)
def zoom(out): # Should conjugate by current mouse position out = literal_eval(out) zoom = get_scale(doc["drawing"], "zoom") / 1.25 if out else\ get_scale(doc["drawing"], "zoom") * 1.25 doc["drawing"].transforms["zoom"] = ("scale", zoom)