Implement text rendering along paths
This commit also changes the TextReplay.drawText() signature, and moves geometry calculation into drawText(). This improves performance where no text needs to be rendered (TextStyle.getText() == ''), which is used often in applications.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
|
||||
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.render.webgl.TextReplay');
|
||||
goog.require('ol.style.Fill');
|
||||
goog.require('ol.style.Stroke');
|
||||
@@ -127,19 +126,19 @@ describe('ol.render.webgl.TextReplay', function() {
|
||||
var point;
|
||||
|
||||
point = [1000, 2000];
|
||||
replay.drawText(point, 0, 2, 2, null, null);
|
||||
replay.drawText(new ol.geom.Point(point), null);
|
||||
expect(replay.vertices).to.have.length(256);
|
||||
expect(replay.indices).to.have.length(48);
|
||||
|
||||
point = [2000, 3000];
|
||||
replay.drawText(point, 0, 2, 2, null, null);
|
||||
replay.drawText(new ol.geom.Point(point), null);
|
||||
expect(replay.vertices).to.have.length(512);
|
||||
expect(replay.indices).to.have.length(96);
|
||||
});
|
||||
|
||||
it('sets part of its state during drawing', function() {
|
||||
var point = [1000, 2000];
|
||||
replay.drawText(point, 0, 2, 2, null, null);
|
||||
replay.drawText(new ol.geom.Point(point), null);
|
||||
|
||||
var height = replay.currAtlas_.height;
|
||||
var widths = replay.currAtlas_.width;
|
||||
@@ -163,7 +162,7 @@ describe('ol.render.webgl.TextReplay', function() {
|
||||
var point;
|
||||
|
||||
point = [1000, 2000];
|
||||
replay.drawText(point, 0, 2, 2, null, null);
|
||||
replay.drawText(new ol.geom.Point(point), null);
|
||||
expect(replay.vertices).to.have.length(0);
|
||||
expect(replay.indices).to.have.length(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user