From: Joris van Zundert Date: Wed, 5 Oct 2011 23:24:17 +0000 (+0200) Subject: Added coloting of polygons. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=119157ee32c7556eb1619687c9135a0620a6d267;p=scpubgit%2Fstemmatology.git Added coloting of polygons. --- diff --git a/TreeOfTexts/root/js/interaction.js b/TreeOfTexts/root/js/interaction.js index 00325bc..919fd51 100644 --- a/TreeOfTexts/root/js/interaction.js +++ b/TreeOfTexts/root/js/interaction.js @@ -4,6 +4,8 @@ $(document).ready(function() { $('.rowid').click( function() { row_triggered = true; $('ellipse').attr( {stroke:'black', fill:'#fff'} ); + $('.node').children('polygon').attr( {stroke:'#fff', fill:'#fff'} ); + $('.node').children('text').attr( {stroke:'none', fill:'#000'} ); $('tr.active_variant_row').children('td').removeClass('cellb0 cellb1 cellb2 cellb3 cellb4 cellb5 cellb6 cellb7'); $(this).parent().nextAll('.clickable').children('span').click(); $('td.active_variant_cell').removeClass('active_variant_cell'); @@ -15,27 +17,23 @@ function color_nodes( column_index, arr_node_ids, arr_greynode_ids ) { $('tr.active_variant_row').children('td').removeClass('cellb0 cellb1 cellb2 cellb3 cellb4 cellb5 cellb6 cellb7'); $('td.active_variant_cell').removeClass('active_variant_cell'); $('ellipse').attr( {stroke:'black', fill:'#fff'} ); + $('.node').children('polygon').attr( {stroke:'#fff', fill:'#fff'} ); + $('.node').children('text').attr( {stroke:'none', fill:'#000'} ); }; $('tr.active_variant_row').removeClass('active_variant_row') jQuery.each( arr_greynode_ids, function(index,value) { - $('.node').children('title').filter( function(index) { + nodes = $('.node').children('title').filter( function(index) { return $(this).text() == value; - }).siblings('ellipse').each( function( index ) { - $(this).attr( {stroke:'black', fill:'#444'} ); + }) + nodes.siblings('ellipse, polygon, text').each( function( index ) { + $(this).attr( {stroke:'#ddd', fill:'#f8f8f8'} ); }); }); jQuery.each( arr_node_ids, function(index,value) { $('.node').children('title').filter( function(index) { return $(this).text() == value; - }).siblings('ellipse').each( function( index ) { + }).siblings('ellipse, polygon').each( function( index ) { $(this).attr( {stroke:'black', fill:colors[column_index-1]} ); }); }); } - -// 8 columns tied to colors, based on td position I guess -// click on row id: all colors on, remaining (unused) nodes greyed -// click on cell: those colors on, unused nodes greyed -// c - -// \ No newline at end of file