Merge pull request #1921 from fredj/text-offset
Scale the text offset by the device's pixel ratio
This commit is contained in:
@@ -960,8 +960,10 @@ ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
|
|||||||
textTextBaseline : ol.render.canvas.defaultTextBaseline
|
textTextBaseline : ol.render.canvas.defaultTextBaseline
|
||||||
};
|
};
|
||||||
this.text_ = goog.isDef(textText) ? textText : '';
|
this.text_ = goog.isDef(textText) ? textText : '';
|
||||||
this.textOffsetX_ = goog.isDef(textOffsetX) ? textOffsetX : 0;
|
this.textOffsetX_ =
|
||||||
this.textOffsetY_ = goog.isDef(textOffsetY) ? textOffsetY : 0;
|
goog.isDef(textOffsetX) ? (this.pixelRatio_ * textOffsetX) : 0;
|
||||||
|
this.textOffsetY_ =
|
||||||
|
goog.isDef(textOffsetY) ? (this.pixelRatio_ * textOffsetY) : 0;
|
||||||
this.textRotation_ = goog.isDef(textRotation) ? textRotation : 0;
|
this.textRotation_ = goog.isDef(textRotation) ? textRotation : 0;
|
||||||
this.textScale_ = this.pixelRatio_ * (goog.isDef(textScale) ?
|
this.textScale_ = this.pixelRatio_ * (goog.isDef(textScale) ?
|
||||||
textScale : 1);
|
textScale : 1);
|
||||||
|
|||||||
@@ -346,9 +346,9 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
goog.asserts.assert(goog.isString(instruction[3]));
|
goog.asserts.assert(goog.isString(instruction[3]));
|
||||||
text = /** @type {string} */ (instruction[3]);
|
text = /** @type {string} */ (instruction[3]);
|
||||||
goog.asserts.assert(goog.isNumber(instruction[4]));
|
goog.asserts.assert(goog.isNumber(instruction[4]));
|
||||||
var offsetX = /** @type {number} */ (instruction[4]);
|
var offsetX = /** @type {number} */ (instruction[4]) * pixelRatio;
|
||||||
goog.asserts.assert(goog.isNumber(instruction[5]));
|
goog.asserts.assert(goog.isNumber(instruction[5]));
|
||||||
var offsetY = /** @type {number} */ (instruction[5]);
|
var offsetY = /** @type {number} */ (instruction[5]) * pixelRatio;
|
||||||
goog.asserts.assert(goog.isNumber(instruction[6]));
|
goog.asserts.assert(goog.isNumber(instruction[6]));
|
||||||
rotation = /** @type {number} */ (instruction[6]);
|
rotation = /** @type {number} */ (instruction[6]);
|
||||||
goog.asserts.assert(goog.isNumber(instruction[7]));
|
goog.asserts.assert(goog.isNumber(instruction[7]));
|
||||||
|
|||||||
Reference in New Issue
Block a user