diff --git a/src/ol/style/Text.js b/src/ol/style/Text.js index 7daffd24f4..091df3e7ba 100644 --- a/src/ol/style/Text.js +++ b/src/ol/style/Text.js @@ -401,6 +401,16 @@ class Text { this.placement_ = placement; } + /** + * Set whether to rotate the text with the view. + * + * @param {boolean} rotateWithView Rotate with map. + * @api + */ + setRotateWithView(rotateWithView) { + this.rotateWithView_ = rotateWithView; + } + /** * Set the fill. * diff --git a/test/spec/ol/style/text.test.js b/test/spec/ol/style/text.test.js index 938fdd9fbb..4799274e3e 100644 --- a/test/spec/ol/style/text.test.js +++ b/test/spec/ol/style/text.test.js @@ -97,4 +97,13 @@ describe('ol.style.Text', function() { }); + describe('#setRotateWithView', function() { + it('sets the rotateWithView property', function() { + const textStyle = new Text(); + expect(textStyle.getRotateWithView()).to.eql(undefined); + textStyle.setRotateWithView(true); + expect(textStyle.getRotateWithView()).to.eql(true); + }); + }); + });