comparison web/templog.py @ 249:c490de0cf17e

scaled zooming works
author Matt Johnston <matt@ucc.asn.au>
date Wed, 27 May 2015 22:37:43 +0800
parents 2071d939e4ff
children 141948a400a6
comparison
equal deleted inserted replaced
248:317a1738f15c 249:c490de0cf17e
105 end = datetime.now() 105 end = datetime.now()
106 106
107 if 'zoom' in request.query: 107 if 'zoom' in request.query:
108 orig_start = end - timedelta(minutes=minutes) 108 orig_start = end - timedelta(minutes=minutes)
109 orig_end = end 109 orig_end = end
110 xpos = int(request.query.x) 110 scale = float(request.query.scaledwidth) / config.GRAPH_WIDTH
111 xpos = int(request.query.x) / scale
111 xpos -= config.GRAPH_LEFT_MARGIN * config.ZOOM 112 xpos -= config.GRAPH_LEFT_MARGIN * config.ZOOM
112 113
113 if xpos >= 0 and xpos < config.GRAPH_WIDTH * config.ZOOM: 114 if xpos >= 0 and xpos < config.GRAPH_WIDTH * config.ZOOM:
114 click_time = orig_start \ 115 click_time = orig_start \
115 + timedelta(minutes=(float(xpos) / (config.GRAPH_WIDTH * config.ZOOM)) * minutes) 116 + timedelta(minutes=(float(xpos) / (config.GRAPH_WIDTH * config.ZOOM)) * minutes)