55dec4f5f4ec7a38cc92c6c8bb27b1b195d2582f
galt
  Sun Jan 24 12:44:22 2016 -0800
Fixes #16700. Fixes broken limitVisibility. pack routine now returns 0 instead of 1 when data is still loading which then delays setting limitedVis until it is ready.

diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index a45ee80..ebbcb3b 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -401,39 +401,43 @@
 	{
 	spaceSaverFree(&ss); // free older ones
 	}
     }
 slReverse(&newSs);
 tg->ss = newSs;
 return result;
 }
 
 
 int packCountRowsOverflow(struct track *tg, int maxCount,
                           boolean withLabels, boolean allowOverflow, enum trackVisibility vis)
 /* Return packed height. */
 {
 
+// allowOverflow is currently ONLY used by xenoMrna and est tracks.
+//  When true,  the extra rows are kept, printed at the bottom in dense and Last Row: overlow count appears at bottom of leftLabel area.
+//  When false, the extra rows are tossed, the count seems to equal overflow limit + 2, and limitVisibility lowers vis and retries.
+
 //warn("packCountRowsOverflow tg->track %s (%sfirst window) tg->visibility=%d tg->limitedVis=%d tg->limitedVisSet=%d vis=%d insideWidth=%d", 
 //tg->track, currentWindow == windows ? "" : "non-", tg->visibility, tg->limitedVis, tg->limitedVisSet, vis, insideWidth); // DEBUG REMOVE
 
 // do not calculate if still loading all windows
 if (trackLoadingInProgress) // we pack after all windows are loaded.
     {
     // do not set ss yet
     //warn("trackLoadingInProgress, exiting currentWindow=%lu windows=%lu", (unsigned long) currentWindow, (unsigned long) windows); // DEBUG REMOVE
-    return 1;
+    return 0;  // height of 0 triggers unsetting limitedVis since our data is not all loaded yet and it will get set later.
     }
 
 
 // do not re-calculate if not needed
 if (tg->ss)
     {
     if (tg->ss->window != currentWindow)
 	errAbort("unexpected current window %lu, expected %lu", (unsigned long) currentWindow, (unsigned long) tg->ss->window);
     struct spaceSaver *ss = findSpaceSaverAndFreeOldOnes(tg, vis);
     if (ss)
 	return ss->rowCount;
     // Falls thru here if a new visibility is needed, such as full changing to pack after limitVisibility.
     // This will usually be when it is the first window and it is requesting a new vis.
     }