templates: use canvaswidth instead of fixed width for canvas (
issue2683)
Before this patch, template files for "graph" web page use fixed width
size "480" for canvas element.
This causes pruned lanes and invisible vertexes, if there are 16 or
more vertical lanes at once. In such case, part of graph in right side
area over 480 is invisible, even though corresponded summary text
blocks are visible correctly.
This limitation isn't reasonable for workflow using many branches at
once (e.g. "one branch per issue" workflow).
There were changes below related to width of canvas:
-
7359cb753a54 (templates: widen the graph canvas (
issue2683)),
released as a part of Mercurial 1.8.2
According to the description, this assumed that 15 parallel
branches was enough for ordinary workflow, and bumped width of
canvas up from 224 to 480.
-
d490edc71146 (hgweb: make graph data suitable for template usage),
released as a part of Mercurial 2.3
This introduced "canvaswidth" template keyword as a part of
refactoring around graph rendering.
But 'width="480"' of canvas element in template files wasn't
replaced by 'width="{canvaswidth}"' in it (or subsequent one).
This patch uses dynamic value "{canvaswidth}" instead of fixed width
size "480" for canvas element.
This is posted for "stable", because:
- this is re-fixing
issue2683
- this is simple enough for stable
- using "{canvaswidth}" doesn't require any additional cost
Calculation of canvaswidth is already implied as a part of "graph"
web command.
--- a/mercurial/templates/gitweb/graph.tmpl Wed Jan 20 08:16:58 2016 -0800
+++ b/mercurial/templates/gitweb/graph.tmpl Thu Jan 21 02:42:01 2016 +0900
@@ -41,7 +41,7 @@
<div id="wrapper">
<ul id="nodebgs"></ul>
-<canvas id="graph" width="480" height="{canvasheight}"></canvas>
+<canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
<ul id="graphnodes"></ul>
</div>
--- a/mercurial/templates/monoblue/graph.tmpl Wed Jan 20 08:16:58 2016 -0800
+++ b/mercurial/templates/monoblue/graph.tmpl Thu Jan 21 02:42:01 2016 +0900
@@ -36,7 +36,7 @@
<div id="noscript">The revision graph only works with JavaScript-enabled browsers.</div>
<div id="wrapper">
<ul id="nodebgs"></ul>
- <canvas id="graph" width="480" height="{canvasheight}"></canvas>
+ <canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
<ul id="graphnodes"></ul>
</div>
--- a/mercurial/templates/paper/graph.tmpl Wed Jan 20 08:16:58 2016 -0800
+++ b/mercurial/templates/paper/graph.tmpl Thu Jan 21 02:42:01 2016 +0900
@@ -55,7 +55,7 @@
<div id="wrapper">
<ul id="nodebgs" class="stripes2"></ul>
-<canvas id="graph" width="480" height="{canvasheight}"></canvas>
+<canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
<ul id="graphnodes"></ul>
</div>
--- a/mercurial/templates/spartan/graph.tmpl Wed Jan 20 08:16:58 2016 -0800
+++ b/mercurial/templates/spartan/graph.tmpl Thu Jan 21 02:42:01 2016 +0900
@@ -32,7 +32,7 @@
<div id="wrapper">
<ul id="nodebgs"></ul>
-<canvas id="graph" width="480" height="{canvasheight}"></canvas>
+<canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
<ul id="graphnodes"></ul>
</div>
--- a/tests/test-hgweb-commands.t Wed Jan 20 08:16:58 2016 -0800
+++ b/tests/test-hgweb-commands.t Thu Jan 21 02:42:01 2016 +0900
@@ -1751,7 +1751,7 @@
<div id="wrapper">
<ul id="nodebgs"></ul>
- <canvas id="graph" width="480" height="168"></canvas>
+ <canvas id="graph" width="39" height="168"></canvas>
<ul id="graphnodes"></ul>
</div>
--- a/tests/test-hgweb-empty.t Wed Jan 20 08:16:58 2016 -0800
+++ b/tests/test-hgweb-empty.t Thu Jan 21 02:42:01 2016 +0900
@@ -294,7 +294,7 @@
<div id="wrapper">
<ul id="nodebgs" class="stripes2"></ul>
- <canvas id="graph" width="480" height="12"></canvas>
+ <canvas id="graph" width="39" height="12"></canvas>
<ul id="graphnodes"></ul>
</div>