Revision: 485
Author:
ryandesign.com
Date: Sat Sep 14 11:05:43 2013 UTC
Log: work around xdotversion 1.5 radial gradient angle inversion bug
http://code.google.com/p/canviz/source/detail?r=485
Modified:
/canviz/trunk/src/Canviz.js
/canviz/trunk/src/Entity.js
=======================================
--- /canviz/trunk/src/Canviz.js Fri Sep 13 11:51:19 2013 UTC
+++ /canviz/trunk/src/Canviz.js Sat Sep 14 11:05:43 2013 UTC
@@ -260,8 +260,8 @@
},
draw: function (redrawCanvasOnly) {
if (typeof redrawCanvasOnly == 'undefined') redrawCanvasOnly = false;
- var bugs = this.bugs = {};
var xdotVersion = this.graphs[0].attrs.xdotversion;
+ var bugs = this.bugs =
{gradAngle: !versionCompare(xdotVersion, '1.5')};
bugs.gradY = bugs.textY = versionCompare(xdotVersion, '1.5') < 0;
var ctx = this.ctx;
var ctxScale = this.scale * this.dpi / XDOT_DPI;
=======================================
--- /canviz/trunk/src/Entity.js Fri Sep 13 11:39:00 2013 UTC
+++ /canviz/trunk/src/Entity.js Sat Sep 14 11:05:43 2013 UTC
@@ -378,6 +378,14 @@
}
if (radial) {
r1 = tokenizer.takeNumber();
+ if (this.canviz.bugs.gradAngle) {
+ // In xdotversion 1.5 (Graphviz version 2.34.0 to
2.35.20130913.0446
+ // inclusive, fixed in git commit
99a0ab64cba065db6ba14e167f9a05481c227e9c)
+ // the radial gradient angle is inverted. (x1, y1) happens to be
the
+ // center, so we can reflect y0 across the line y=y1.
+ //
http://www.graphviz.org/mantisbt/view.php?id=2367
+ y0 += 2 * (y1 - y0);
+ }
gradient = ctx.createRadialGradient(x0, y0, r0, x1, y1, r1);
} else {
gradient = ctx.createLinearGradient(x0, y0, x1, y1);