Fix WebGL text offset direction

This commit is contained in:
GaborFarkas
2017-08-11 11:14:37 +02:00
parent 87391e7795
commit bb593eaac8
2 changed files with 4 additions and 4 deletions

View File

@@ -129,8 +129,8 @@ if (ol.ENABLE_WEBGL) {
var lines = this.text_.split('\n');
var textSize = this.getTextSize_(lines);
var i, ii, j, jj, currX, currY, charArr, charInfo;
var anchorX = Math.round(textSize[0] * this.textAlign_ + this.offsetX_);
var anchorY = Math.round(textSize[1] * this.textBaseline_ + this.offsetY_);
var anchorX = Math.round(textSize[0] * this.textAlign_ - this.offsetX_);
var anchorY = Math.round(textSize[1] * this.textBaseline_ - this.offsetY_);
var lineWidth = (this.state_.lineWidth / 2) * this.state_.scale;
for (i = 0, ii = lines.length; i < ii; ++i) {

View File

@@ -154,8 +154,8 @@ describe('ol.render.webgl.TextReplay', function() {
expect(replay.originY).to.be(charInfo.offsetY);
expect(replay.imageHeight).to.be(charInfo.image.height);
expect(replay.imageWidth).to.be(charInfo.image.width);
expect(replay.anchorX).to.be(-widthX + 10);
expect(replay.anchorY).to.be(10);
expect(replay.anchorX).to.be(-widthX - 10);
expect(replay.anchorY).to.be(-10);
});
it('does not draw if text is empty', function() {