Don't scale the text stroke width by pixel ratio

This commit is contained in:
Frederic Junod
2014-06-05 17:53:50 +02:00
parent 3fdd0e4bf7
commit 52b1ba30fa
2 changed files with 6 additions and 4 deletions

View File

@@ -946,8 +946,8 @@ ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
textStrokeStyleLineDash : ol.render.canvas.defaultLineDash,
lineJoin: goog.isDef(textStrokeStyleLineJoin) ?
textStrokeStyleLineJoin : ol.render.canvas.defaultLineJoin,
lineWidth: this.pixelRatio_ * (goog.isDef(textStrokeStyleWidth) ?
textStrokeStyleWidth : ol.render.canvas.defaultLineWidth),
lineWidth: goog.isDef(textStrokeStyleWidth) ?
textStrokeStyleWidth : ol.render.canvas.defaultLineWidth,
miterLimit: goog.isDef(textStrokeStyleMiterLimit) ?
textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit,
strokeStyle: ol.color.asString(!goog.isNull(textStrokeStyleColor) ?

View File

@@ -416,8 +416,10 @@ ol.render.canvas.Replay.prototype.replay_ = function(
goog.asserts.assert(goog.isString(instruction[4]));
goog.asserts.assert(goog.isNumber(instruction[5]));
goog.asserts.assert(!goog.isNull(instruction[6]));
var usePixelRatio = goog.isDef(instruction[7]) ? instruction[7] : true;
var lineWidth = /** @type {number} */ (instruction[2]);
context.strokeStyle = /** @type {string} */ (instruction[1]);
context.lineWidth = /** @type {number} */ (instruction[2]) * pixelRatio;
context.lineWidth = usePixelRatio ? lineWidth * pixelRatio : lineWidth;
context.lineCap = /** @type {string} */ (instruction[3]);
context.lineJoin = /** @type {string} */ (instruction[4]);
context.miterLimit = /** @type {number} */ (instruction[5]);
@@ -1647,7 +1649,7 @@ ol.render.canvas.TextReplay.prototype.setReplayStrokeState_ =
var setStrokeStyleInstruction = [
ol.render.canvas.Instruction.SET_STROKE_STYLE, strokeState.strokeStyle,
strokeState.lineWidth, strokeState.lineCap, strokeState.lineJoin,
strokeState.miterLimit, strokeState.lineDash
strokeState.miterLimit, strokeState.lineDash, false
];
this.instructions.push(setStrokeStyleInstruction);
this.hitDetectionInstructions.push(setStrokeStyleInstruction);