comparison mercurial/hgweb/webcommands.py @ 35534:acd8a2454b47

monoblue: make actual changeset entries have backgrounds on /graph This patch removes a separate container for backgrounds only and puts backgrounds on changeset elements themselves. This makes it so that JS code doesn't need to create background elements separately anymore. There's a bit of manipulating positions of elements: every changeset entry has a "fg" element that gets a higher z-index than <canvas> element. This prioritizes text information, so that even if it somehow gets close to the graph drawn on <canvas> (which has z-index of 5), it'll still be on top of it. This can happen if commit message has a long first line and browser window is narrow, for example. 'parity' is added to each entry because there's no stripes2 class in monoblue, only in paper.
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 05 Jan 2018 19:08:00 +0800
parents 0fe5d99804bb
children baca93a47992
comparison
equal deleted inserted replaced
35533:5afe0ca59b07 35534:acd8a2454b47
1263 'vertex': vtx, 1263 'vertex': vtx,
1264 'edges': edges} 1264 'edges': edges}
1265 for (id, type, ctx, vtx, edges) in fulltree()] 1265 for (id, type, ctx, vtx, edges) in fulltree()]
1266 1266
1267 def nodes(): 1267 def nodes():
1268 parity = paritygen(web.stripecount)
1268 for row, (id, type, ctx, vtx, edges) in enumerate(tree): 1269 for row, (id, type, ctx, vtx, edges) in enumerate(tree):
1269 entry = webutil.commonentry(web.repo, ctx) 1270 entry = webutil.commonentry(web.repo, ctx)
1270 edgedata = [{'col': edge[0], 1271 edgedata = [{'col': edge[0],
1271 'nextcol': edge[1], 1272 'nextcol': edge[1],
1272 'color': (edge[2] - 1) % 6 + 1, 1273 'color': (edge[2] - 1) % 6 + 1,
1274 'bcolor': edge[4]} 1275 'bcolor': edge[4]}
1275 for edge in edges] 1276 for edge in edges]
1276 1277
1277 entry.update({'col': vtx[0], 1278 entry.update({'col': vtx[0],
1278 'color': (vtx[1] - 1) % 6 + 1, 1279 'color': (vtx[1] - 1) % 6 + 1,
1280 'parity': next(parity),
1279 'edges': edgedata, 1281 'edges': edgedata,
1280 'row': row, 1282 'row': row,
1281 'nextrow': row + 1}) 1283 'nextrow': row + 1})
1282 1284
1283 yield entry 1285 yield entry