javascript - How to make a svg element (e.g. rectangle) scrollIntoView? -
i have svg in graph panel. nodes in svg listed in panel. hope clicking node in node list, svg can scroll node. each node rectangle. found upper border in view, while rest part of node still out of view. there way fix problem? (either javascript or extjs)
this code:
function selectrectangle(id){ var ele = ext.get(id); ele.scrollintoview(ext.get('graph-panel-body'), true);}
by whatever reason scrollintoview seems not work svg elements.
suppose svg in
<div id="container"> <svg ...> ... <path id> ...</path> </svg> </div>
then suppose in variable 'element' have element want scrollintoview
var bbox = ele.getbbox() var top = bbox.y + bbox.y2 top = 50 * math.floor(top/50) $("#container").get(0).scrolltop=top
i not sure, observe taht getbbox pretty slow. take care.
Comments
Post a Comment