src/hg/lib/hui.c 1.214

1.214 2009/06/24 23:23:50 tdreszer
Fix for matrix 'right buttons' being parially triggered by empty columns
Index: src/hg/lib/hui.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/hui.c,v
retrieving revision 1.213
retrieving revision 1.214
diff -b -B -U 4 -r1.213 -r1.214
--- src/hg/lib/hui.c	16 Jun 2009 01:25:46 -0000	1.213
+++ src/hg/lib/hui.c	24 Jun 2009 23:23:50 -0000	1.214
@@ -4873,9 +4873,9 @@
 
 matrixXheadings(parentTdb,dimensionX,dimensionY,tdbsX,TRUE);
 
 // Now the Y by X matrix
-int cntY=0;
+int cntX=0,cntY=0;
 for (ixY = 0; ixY < sizeOfY; ixY++)
     {
     if(tdbsY[ixY] != NULL || dimensionY == NULL)
         {
@@ -4889,8 +4889,11 @@
             {
             if(tdbsX[ixX] != NULL || dimensionX == NULL)
                 {
                 assert(!dimensionX || ixX < dimensionX->count);
+                if(cntY==1) // Only do this on the first good Y
+                    cntX++;
+
                 if(dimensionX && ixX == dimensionX->count)
                     break;
                 if(cells[ixX][ixY] > 0)
                     {
@@ -4922,9 +4925,9 @@
                 else
                     puts("<TD>&nbsp;</TD>");
                 }
             }
-        if(dimensionX && dimensionX->count>MATRIX_RIGHT_BUTTONS_AFTER)
+        if(dimensionX && cntX>MATRIX_RIGHT_BUTTONS_AFTER)
             matrixYheadings(parentTdb, dimensionX,dimensionY,ixY,tdbsY[ixY],FALSE);
         puts("</TR>\n");
         }
     }