comparison web/templog.py @ 77:959e88c0bdfa

ui tweaks
author Matt Johnston <matt@ucc.asn.au>
date Wed, 04 Jul 2012 22:36:52 +0800
parents a8ff20f15734
children 3cd1ca6d0489
comparison
equal deleted inserted replaced
76:6e47a61edc47 77:959e88c0bdfa
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