Fix WebGL text offset direction
This commit is contained in:
@@ -129,8 +129,8 @@ if (ol.ENABLE_WEBGL) {
|
|||||||
var lines = this.text_.split('\n');
|
var lines = this.text_.split('\n');
|
||||||
var textSize = this.getTextSize_(lines);
|
var textSize = this.getTextSize_(lines);
|
||||||
var i, ii, j, jj, currX, currY, charArr, charInfo;
|
var i, ii, j, jj, currX, currY, charArr, charInfo;
|
||||||
var anchorX = Math.round(textSize[0] * this.textAlign_ + this.offsetX_);
|
var anchorX = Math.round(textSize[0] * this.textAlign_ - this.offsetX_);
|
||||||
var anchorY = Math.round(textSize[1] * this.textBaseline_ + this.offsetY_);
|
var anchorY = Math.round(textSize[1] * this.textBaseline_ - this.offsetY_);
|
||||||
var lineWidth = (this.state_.lineWidth / 2) * this.state_.scale;
|
var lineWidth = (this.state_.lineWidth / 2) * this.state_.scale;
|
||||||
|
|
||||||
for (i = 0, ii = lines.length; i < ii; ++i) {
|
for (i = 0, ii = lines.length; i < ii; ++i) {
|
||||||
|
|||||||
@@ -154,8 +154,8 @@ describe('ol.render.webgl.TextReplay', function() {
|
|||||||
expect(replay.originY).to.be(charInfo.offsetY);
|
expect(replay.originY).to.be(charInfo.offsetY);
|
||||||
expect(replay.imageHeight).to.be(charInfo.image.height);
|
expect(replay.imageHeight).to.be(charInfo.image.height);
|
||||||
expect(replay.imageWidth).to.be(charInfo.image.width);
|
expect(replay.imageWidth).to.be(charInfo.image.width);
|
||||||
expect(replay.anchorX).to.be(-widthX + 10);
|
expect(replay.anchorX).to.be(-widthX - 10);
|
||||||
expect(replay.anchorY).to.be(10);
|
expect(replay.anchorY).to.be(-10);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not draw if text is empty', function() {
|
it('does not draw if text is empty', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user