comparison web/templog.py @ 548:b3dc81bee5b3

scaled zooming works
author Matt Johnston <matt@ucc.asn.au>
date Wed, 27 May 2015 22:37:43 +0800
parents 30628aa50a10
children 141948a400a6
comparison
equal deleted inserted replaced
547:7689af9f56a8 548:b3dc81bee5b3
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)