diff --git a/lib/forcegraph.js b/lib/forcegraph.js index 2b266c5..10fd665 100644 --- a/lib/forcegraph.js +++ b/lib/forcegraph.js @@ -557,20 +557,19 @@ define(["d3"], function (d3) { var name = nodeName(d) - ctx.font = "11px Roboto" var offset = 8 var lineWidth = 3 - var width = ctx.measureText(name).width var buffer = document.createElement("canvas") var r = window.devicePixelRatio var bctx = buffer.getContext("2d") + bctx.font = "11px Roboto" + var width = bctx.measureText(name).width var scale = zoomBehavior.scaleExtent()[1] * r buffer.width = (width + 2 * lineWidth) * scale buffer.height = (16 + 2 * lineWidth) * scale bctx.scale(scale, scale) bctx.textBaseline = "middle" bctx.textAlign = "center" - bctx.font = ctx.font bctx.lineWidth = lineWidth bctx.lineCap = "round" bctx.strokeStyle = "rgba(255, 255, 255, 0.8)"