javascript - Infovis: Label disappears on partial nodes -
the label on left node disappears if node partially displayed on canvas. how resolve this?
thanks
infovis tries hide node labels when asserts label fall off canvas, if displayed on node.
it computes canvas position , dimensions, node position , dimensions, , tries see if label's position out of canvas.
this can seen on placelabel
and fitsincanvas
functions, around lines 9683 , 7669 of final jit.js file, respectively.
i faced problem too, while working spacetree visualizations. became issue when tried present decent experience in mobile, not find way put canvas panning work (so, when node label partially disappeared, had no way select node , centre whole tree consequence, allow further exploration of other nodes...).
what did change function fitsincanvas
:
fitsincanvas: function(pos, canvas, nodew, nodeh) { var size = canvas.getsize(); if(pos.x >= size.width || (pos.x + nodew) < 0 || pos.y >= size.height || pos.y + nodeh < 0) return false; return true; }
and called accordingly on placelabel
:
placelabel: function(tag, node, controller) { ... ... ... var style = tag.style; style.left = labelpos.x + 'px'; style.top = labelpos.y + 'px'; // passing on node's width , heigh style.display = this.fitsincanvas(labelpos, canvas, w, h)? '' : 'none'; controller.onplacelabel(tag, node); }
however, no solution. see labels falling off canvas, in weird effect, until whole node disappears. and, obviously, changed source directly... ticket should filled on github.
edit:
actually, seems working old version of lib. discussed behaviour changed similar describing. so, there no need change code. download again files. specifically, following link should give these changes:
Comments
Post a Comment