MCPcopy
hub / github.com/dhotson/springy / getTextWidth

Function getTextWidth

springyui.js:127–141  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

125 });
126
127 var getTextWidth = function(node) {
128 var text = (node.data.label !== undefined) ? node.data.label : node.id;
129 if (node._width && node._width[text])
130 return node._width[text];
131
132 ctx.save();
133 ctx.font = (node.data.font !== undefined) ? node.data.font : nodeFont;
134 var width = ctx.measureText(text).width;
135 ctx.restore();
136
137 node._width || (node._width = {});
138 node._width[text] = width;
139
140 return width;
141 };
142
143 var getTextHeight = function(node) {
144 return 16;

Callers 1

springyui.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected