Add tests, remove unused code, encapsulate repeated code in functions

This commit is contained in:
Andreas Hocevar
2016-02-15 01:35:20 +01:00
parent a109062b1f
commit 952b99742e
5 changed files with 120 additions and 63 deletions

View File

@@ -94,3 +94,18 @@ ol.render.canvas.defaultTextBaseline = 'middle';
* @type {number}
*/
ol.render.canvas.defaultLineWidth = 1;
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {number} rotation Rotation.
* @param {number} offsetX X offset.
* @param {number} offsetY Y offset.
*/
ol.render.canvas.rotateAtOffset = function(context, rotation, offsetX, offsetY) {
if (rotation !== 0) {
context.translate(offsetX, offsetY);
context.rotate(rotation);
context.translate(-offsetX, -offsetY);
}
};