Skip to content
Browse files

left param

  • Loading branch information...
1 parent 8d3d102 commit e9d56f2e9337e75d6e3a936e09eaab01dcf41984 @substack committed Oct 2, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 index.js
View
5 index.js
@@ -12,8 +12,9 @@ module.exports = function (src, opts) {
var width = Math.max.apply(null, lines.map(function (line) {
return line.length;
})) * opts.width;
+ var left = opts.left || 0;
- var canvas = new Canvas(width, height);
+ var canvas = new Canvas(left + width, height);
var ctx = canvas.getContext('2d');
var rects = [];
@@ -60,7 +61,7 @@ module.exports = function (src, opts) {
if (r.end !== undefined && col + c.length > r.end) return;
if (!/\s{2,}/.test(c)) {
- var x = col * opts.width;
+ var x = left + col * opts.width;
var w = c.length * opts.width;
ctx.fillRect(x, y, w, opts.height);
}

0 comments on commit e9d56f2

Please sign in to comment.
Something went wrong with that request. Please try again.