Commit c221fd34 authored by David Schnur's avatar David Schnur

Merge pull request #1209 from Jeff-Tian/0.9-work

Allow text markings without a solid background.
parents fc1e4094 59767e65
...@@ -2417,35 +2417,33 @@ Licensed under the MIT license. ...@@ -2417,35 +2417,33 @@ Licensed under the MIT license.
yrange.from = Math.max(yrange.from, yrange.axis.min); yrange.from = Math.max(yrange.from, yrange.axis.min);
yrange.to = Math.min(yrange.to, yrange.axis.max); yrange.to = Math.min(yrange.to, yrange.axis.max);
if (xrange.from === xrange.to && yrange.from === yrange.to) {
return;
}
// then draw // then draw
xrange.from = xrange.axis.p2c(xrange.from); xrange.from = xrange.axis.p2c(xrange.from);
xrange.to = xrange.axis.p2c(xrange.to); xrange.to = xrange.axis.p2c(xrange.to);
yrange.from = yrange.axis.p2c(yrange.from); yrange.from = yrange.axis.p2c(yrange.from);
yrange.to = yrange.axis.p2c(yrange.to); yrange.to = yrange.axis.p2c(yrange.to);
if (xrange.from === xrange.to || yrange.from === yrange.to) { if (xrange.from !== xrange.to || xrange.from !== yrange.to) {
// draw line if (xrange.from === xrange.to || yrange.from === yrange.to) {
ctx.beginPath(); // draw line
ctx.strokeStyle = m.color || options.grid.markingsColor; ctx.beginPath();
ctx.lineWidth = m.lineWidth || options.grid.markingsLineWidth; ctx.strokeStyle = m.color || options.grid.markingsColor;
ctx.moveTo(xrange.from, yrange.from); ctx.lineWidth = m.lineWidth || options.grid.markingsLineWidth;
ctx.lineTo(xrange.to, yrange.to); ctx.moveTo(xrange.from, yrange.from);
ctx.stroke(); ctx.lineTo(xrange.to, yrange.to);
} else { ctx.stroke();
// fill area
ctx.fillStyle = m.color || options.grid.markingsColor;
if (!m.rounded) {
ctx.fillRect(xrange.from, yrange.to,
xrange.to - xrange.from,
yrange.from - yrange.to);
} else { } else {
roundRect(ctx, xrange.from, yrange.to, xrange.to - xrange.from, yrange.from - yrange.to, m.rounded); // fill area
ctx.fill(); ctx.fillStyle = m.color || options.grid.markingsColor;
if (!m.rounded) {
ctx.fillRect(xrange.from, yrange.to,
xrange.to - xrange.from,
yrange.from - yrange.to);
} else {
roundRect(ctx, xrange.from, yrange.to, xrange.to - xrange.from, yrange.from - yrange.to, m.rounded);
ctx.fill();
}
} }
} }
......
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 to comment