only getComputedTextLength() once

This commit is contained in:
Ansis Brammanis
2013-01-11 16:56:28 -05:00
parent 7e9eaa6422
commit 6b09da380d
+9 -5
View File
@@ -1,10 +1,14 @@
iD.svg.Lines = function() {
return function(surface, graph, entities, filter, projection) {
var arrowtext = '►\u3000\u3000',
arrow = surface.append('text').text(arrowtext),
alength = arrow.node().getComputedTextLength();
arrow.remove();
var arrowtext = '►\u3000\u3000',
alength;
return function(surface, graph, entities, filter, projection) {
if (!alength) {
var arrow = surface.append('text').text(arrowtext);
alength = arrow.node().getComputedTextLength();
arrow.remove();
}
var lines = [];