[PATCH] hgweb: fix incorrect graph padding calculation

Tim Delaney timothy.c.delaney at gmail.com
Mon Sep 17 13:21:43 CDT 2012


# HG changeset patch
# User Tim Delaney <timothy.c.delaney at gmail.com>
# Date 1347903900 -36000
# Node ID 45fe374a8de52e35208fdfb49545ef118135a2b9
# Parent  fc1a5d0eb3bbb1116051b65dcd2873389f9d7ed4
hgweb: fix incorrect graph padding calculation

hgweb has an incorrect padding calculation, causing the text to move further
away from the graph the more branches there are (issue3626). This patch fixes
all existing templates (gitweb, monoblue, paper and spartan).

diff --git a/mercurial/templates/gitweb/graph.tmpl b/mercurial/templates/gitweb/graph.tmpl
--- a/mercurial/templates/gitweb/graph.tmpl
+++ b/mercurial/templates/gitweb/graph.tmpl
@@ -59,7 +59,7 @@
 	this.ctx.fill();
 	
 	var bg = '<li class="bg parity' + parity + '"></li>';
-	var left = (this.columns + 1) * this.bg_height;
+	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
 	var nstyle = 'padding-left: ' + left + 'px;';
 	
 	var tagspan = '';
diff --git a/mercurial/templates/monoblue/graph.tmpl b/mercurial/templates/monoblue/graph.tmpl
--- a/mercurial/templates/monoblue/graph.tmpl
+++ b/mercurial/templates/monoblue/graph.tmpl
@@ -57,7 +57,7 @@
         this.ctx.fill();
 
         var bg = '<li class="bg parity' + parity + '"></li>';
-        var left = (this.columns + 1) * this.bg_height;
+        var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
         var nstyle = 'padding-left: ' + left + 'px;';
 
         var tagspan = '';
diff --git a/mercurial/templates/paper/graph.tmpl b/mercurial/templates/paper/graph.tmpl
--- a/mercurial/templates/paper/graph.tmpl
+++ b/mercurial/templates/paper/graph.tmpl
@@ -70,7 +70,7 @@
 	this.ctx.fill();
 	
 	var bg = '<li class="bg parity' + parity + '"></li>';
-	var left = (this.columns + 1) * this.bg_height;
+	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
 	var nstyle = 'padding-left: ' + left + 'px;';
 
 	var tagspan = '';
diff --git a/mercurial/templates/spartan/graph.tmpl b/mercurial/templates/spartan/graph.tmpl
--- a/mercurial/templates/spartan/graph.tmpl
+++ b/mercurial/templates/spartan/graph.tmpl
@@ -51,7 +51,7 @@
 	this.ctx.fill();
 	
 	var bg = '<li class="bg parity' + parity + '"></li>';
-	var left = (this.columns + 1) * this.bg_height;
+	var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
 	var nstyle = 'padding-left: ' + left + 'px;';
 	var item = '<li style="' + nstyle + '"><span class="desc">';
 	item += '<a href="{url}rev/' + cur[0] + '{sessionvars%urlparameter}" title="' + cur[0] + '">' + cur[3] + '</a>';


More information about the Mercurial-devel mailing list