diff --git a/src/ol/render/canvas/canvasreplay.js b/src/ol/render/canvas/canvasreplay.js index 2f6392814b..18b83f4a4b 100644 --- a/src/ol/render/canvas/canvasreplay.js +++ b/src/ol/render/canvas/canvasreplay.js @@ -231,10 +231,14 @@ ol.render.canvas.Replay.prototype.replay_ = function( var anchorY = /** @type {number} */ (instruction[5]) * pixelRatio; var height = /** @type {number} */ (instruction[6]) * pixelRatio; var opacity = /** @type {number} */ (instruction[7]); - var rotation = /** @type {number} */ (instruction[8]); - var scale = /** @type {number} */ (instruction[9]); - var snapToPixel = /** @type {boolean|undefined} */ (instruction[10]); - var width = /** @type {number} */ (instruction[11]) * pixelRatio; + var rotateWithMap = /** @type {boolean} */ (instruction[8]); + var rotation = /** @type {number} */ (instruction[9]); + var scale = /** @type {number} */ (instruction[10]); + var snapToPixel = /** @type {boolean|undefined} */ (instruction[11]); + var width = /** @type {number} */ (instruction[12]) * pixelRatio; + if (rotateWithMap) { + rotation += viewRotation; + } for (; d < dd; d += 2) { x = pixelCoordinates[d] - anchorX; y = pixelCoordinates[d + 1] - anchorY; @@ -621,6 +625,12 @@ ol.render.canvas.ImageReplay = function(tolerance) { */ this.opacity_ = undefined; + /** + * @private + * @type {boolean|undefined} + */ + this.rotateWithMap_ = undefined; + /** * @private * @type {number|undefined} @@ -676,6 +686,7 @@ ol.render.canvas.ImageReplay.prototype.drawPointGeometry = goog.asserts.assert(goog.isDef(this.anchorY_)); goog.asserts.assert(goog.isDef(this.height_)); goog.asserts.assert(goog.isDef(this.opacity_)); + goog.asserts.assert(goog.isDef(this.rotateWithMap_)); goog.asserts.assert(goog.isDef(this.rotation_)); goog.asserts.assert(goog.isDef(this.scale_)); goog.asserts.assert(goog.isDef(this.width_)); @@ -689,15 +700,17 @@ ol.render.canvas.ImageReplay.prototype.drawPointGeometry = this.instructions.push([ ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_, // Remaining arguments to DRAW_IMAGE are in alphabetical order - this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.rotation_, - this.scale_, this.snapToPixel_, this.width_ + this.anchorX_, this.anchorY_, this.height_, this.opacity_, + this.rotateWithMap_, this.rotation_, this.scale_, this.snapToPixel_, + this.width_ ]); this.hitDetectionInstructions.push([ ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.hitDetectionImage_, // Remaining arguments to DRAW_IMAGE are in alphabetical order - this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.rotation_, - this.scale_, this.snapToPixel_, this.width_ + this.anchorX_, this.anchorY_, this.height_, this.opacity_, + this.rotateWithMap_, this.rotation_, this.scale_, this.snapToPixel_, + this.width_ ]); this.endGeometry(pointGeometry, data); }; @@ -715,6 +728,7 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPointGeometry = goog.asserts.assert(goog.isDef(this.anchorY_)); goog.asserts.assert(goog.isDef(this.height_)); goog.asserts.assert(goog.isDef(this.opacity_)); + goog.asserts.assert(goog.isDef(this.rotateWithMap_)); goog.asserts.assert(goog.isDef(this.rotation_)); goog.asserts.assert(goog.isDef(this.scale_)); goog.asserts.assert(goog.isDef(this.width_)); @@ -728,15 +742,17 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPointGeometry = this.instructions.push([ ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_, // Remaining arguments to DRAW_IMAGE are in alphabetical order - this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.rotation_, - this.scale_, this.snapToPixel_, this.width_ + this.anchorX_, this.anchorY_, this.height_, this.opacity_, + this.rotateWithMap_, this.rotation_, this.scale_, this.snapToPixel_, + this.width_ ]); this.hitDetectionInstructions.push([ ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.hitDetectionImage_, // Remaining arguments to DRAW_IMAGE are in alphabetical order - this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.rotation_, - this.scale_, this.snapToPixel_, this.width_ + this.anchorX_, this.anchorY_, this.height_, this.opacity_, + this.rotateWithMap_, this.rotation_, this.scale_, this.snapToPixel_, + this.width_ ]); this.endGeometry(multiPointGeometry, data); }; @@ -755,6 +771,7 @@ ol.render.canvas.ImageReplay.prototype.finish = function() { this.height_ = undefined; this.scale_ = undefined; this.opacity_ = undefined; + this.rotateWithMap_ = undefined; this.rotation_ = undefined; this.snapToPixel_ = undefined; this.width_ = undefined; @@ -780,6 +797,7 @@ ol.render.canvas.ImageReplay.prototype.setImageStyle = function(imageStyle) { this.image_ = image; this.height_ = size[1]; this.opacity_ = imageStyle.getOpacity(); + this.rotateWithMap_ = imageStyle.getRotateWithMap(); this.rotation_ = imageStyle.getRotation(); this.scale_ = imageStyle.getScale(); this.snapToPixel_ = imageStyle.getSnapToPixel();