comparison web/templog.py @ 383:a032051475fe

ui tweaks
author Matt Johnston <matt@ucc.asn.au>
date Wed, 04 Jul 2012 22:36:52 +0800
parents f22427bcfda8
children 3cd1ca6d0489
comparison
equal deleted inserted replaced
382:f429169aa3cd 383:a032051475fe
53 53
54 if 'zoom' in request.query: 54 if 'zoom' in request.query:
55 orig_start = end - timedelta(minutes=minutes) 55 orig_start = end - timedelta(minutes=minutes)
56 orig_end = end 56 orig_end = end
57 xpos = int(request.query.x) 57 xpos = int(request.query.x)
58 xpos -= config.GRAPH_LEFT_MARGIN 58 xpos -= config.GRAPH_LEFT_MARGIN * config.ZOOM
59 59
60 if xpos >= 0 and xpos < config.GRAPH_WIDTH: 60 if xpos >= 0 and xpos < config.GRAPH_WIDTH * config.ZOOM:
61 click_time = orig_start \ 61 click_time = orig_start \
62 + timedelta(minutes=(float(xpos) / config.GRAPH_WIDTH) * minutes) 62 + timedelta(minutes=(float(xpos) / (config.GRAPH_WIDTH * config.ZOOM)) * minutes)
63 minutes = int(minutes / ZOOM_SCALE) 63 minutes = int(minutes / ZOOM_SCALE)
64 64
65 end = click_time + timedelta(minutes=minutes/2) 65 end = click_time + timedelta(minutes=minutes/2)
66 else: 66 else:
67 # zoom out 67 # zoom out