Skip to content

Instantly share code, notes, and snippets.

View gossi's full-sized avatar

Thomas Gossmann gossi

View GitHub Profile
@gossi
gossi / gist:728625
Created December 5, 2010 00:16
Spacetree Label fitInNode
$jit.ST.Label.Native = new Class({
Implements: Graph.Label.Native,
renderLabel: function(canvas, node, controller) {
var ctx = canvas.getCtx(),
coord = node.pos.getc(true),
height = 0, maxHeight, lineHeight, restText, testLastLine, textSplit,
width = node.getData("width"), modifyLastLine = false, lines, i, len, y;
if (!canvas.viz.config.Node.autoWidth && ctx.measureText(node.name).width > width) {