Commit 24763362 by Dmitry Baranovskiy

Merge branch 'master' of git@github.com:DmitryBaranovskiy/raphael

parents a300e42d 9d3c93c0
...@@ -1416,12 +1416,14 @@ var Raphael = (function (type) { ...@@ -1416,12 +1416,14 @@ var Raphael = (function (type) {
C.drawGrid = function (x, y, w, h, wv, hv, color) { C.drawGrid = function (x, y, w, h, wv, hv, color) {
color = color || "#000"; color = color || "#000";
var p = this.path({stroke: color, "stroke-width": 1}) var p = this.path({stroke: color, "stroke-width": 1})
.moveTo(x, y).lineTo(x + w, y).lineTo(x + w, y + h).lineTo(x, y + h).lineTo(x, y); .moveTo(x, y).lineTo(x + w, y).lineTo(x + w, y + h).lineTo(x, y + h).lineTo(x, y),
rowHeight = h / hv,
columnWidth = w / wv;
for (var i = 1; i < hv; i++) { for (var i = 1; i < hv; i++) {
p.moveTo(x, y + i * Math.round(h / hv)).lineTo(x + w, y + i * Math.round(h / hv)); p.moveTo(x, y + i * rowHeight).lineTo(x + w, y + i * rowHeight);
} }
for (var i = 1; i < wv; i++) { for (var i = 1; i < wv; i++) {
p.moveTo(x + i * Math.round(w / wv), y).lineTo(x + i * Math.round(w / wv), y + h); p.moveTo(x + i * columnWidth, y).lineTo(x + i * columnWidth, y + h);
} }
return p; return p;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment