X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=stemmaweb%2Froot%2Fjs%2Fcomponentload.js;h=97c48c0edab0c953705d2a55241f0c1b5f0a45ad;hb=a88e75b1e7858fa3878155c70f473897694162ba;hp=c5e5d3c4000f827fb203c2db577701ca1283cf73;hpb=ca863fc20998938e133772b264b99107945a4b87;p=scpubgit%2Fstemmatology.git diff --git a/stemmaweb/root/js/componentload.js b/stemmaweb/root/js/componentload.js index c5e5d3c..97c48c0 100644 --- a/stemmaweb/root/js/componentload.js +++ b/stemmaweb/root/js/componentload.js @@ -1,6 +1,14 @@ function loadTradition( textid ) { - $('#stemma_graph').load( "stemma/" + textid ); - $('#stemma_graph > svg').width('485px'); - $('#variant_graph').load( "variantgraph/" + textid ); - $('#variant_graph > svg').height('300px'); -} \ No newline at end of file + $('#stemma_graph').load( "stemma/" + textid , function() { + var stemma_svg_element = $('#stemma_graph svg').svg().svg('get').root(); + stemma_svg_element.height.baseVal.value = $('#stemma_graph').height(); + }); + $('#variant_graph').load( "variantgraph/" + textid , function() { + var variant_svg_element = $('#variant_graph svg').svg().svg('get').root(); + var svg_height = variant_svg_element.height.baseVal.value; + var svg_width = variant_svg_element.width.baseVal.value; + var container_height = $('#variant_graph').height(); + variant_svg_element.height.baseVal.value = container_height; + variant_svg_element.width.baseVal.value = (svg_width/svg_height * container_height); + }); +}