Support bearing in path overlays
This commit is contained in:
parent
900ca4ed3e
commit
2d2c43aeb5
1 changed files with 8 additions and 1 deletions
|
@ -353,7 +353,14 @@ module.exports = function(options, repo, params, id) {
|
||||||
var ctx = canvas.getContext('2d');
|
var ctx = canvas.getContext('2d');
|
||||||
var center = precisePx([x, y], z);
|
var center = precisePx([x, y], z);
|
||||||
ctx.scale(scale, scale);
|
ctx.scale(scale, scale);
|
||||||
ctx.translate(-center[0] + w / 2, -center[1] + h / 2);
|
if (bearing) {
|
||||||
|
ctx.translate(w / 2, h / 2);
|
||||||
|
ctx.rotate(-bearing / 180 * Math.PI);
|
||||||
|
ctx.translate(-center[0], -center[1]);
|
||||||
|
} else {
|
||||||
|
// optimized path
|
||||||
|
ctx.translate(-center[0] + w / 2, -center[1] + h / 2);
|
||||||
|
}
|
||||||
var lineWidth = query.width !== undefined ?
|
var lineWidth = query.width !== undefined ?
|
||||||
parseFloat(query.width) : 1;
|
parseFloat(query.width) : 1;
|
||||||
ctx.lineWidth = lineWidth;
|
ctx.lineWidth = lineWidth;
|
||||||
|
|
Loading…
Reference in a new issue