581e1380e193c49cf80d3e29630d4cd27f2cd186 hiram Thu Oct 22 16:06:56 2020 -0700 only output the mouseOver element once refs #21980 diff --git src/hg/hgTracks/wigTrack.c src/hg/hgTracks/wigTrack.c index de45c0e..b78a3e0 100644 --- src/hg/hgTracks/wigTrack.c +++ src/hg/hgTracks/wigTrack.c @@ -1435,70 +1435,71 @@ graphPreDrawContainer(preContainer, preDrawZero, width, tg, hvg, xOff, yOff, graphUpperLimit, graphLowerLimit, graphRange, vis, wigCart); drawZeroLine(vis, wigCart->horizontalGrid, graphUpperLimit, graphLowerLimit, hvg, xOff, yOff, width, tg->lineHeight); drawArbitraryYLine(vis, (enum wiggleGridOptEnum)wigCart->yLineOnOff, graphUpperLimit, graphLowerLimit, hvg, xOff, yOff, width, tg->lineHeight, wigCart->yLineMark, graphRange, wigCart->yLineOnOff); #ifdef NOT_READY_TO_GO if (mouseOverData) { + static boolean beenHereDoneThat = FALSE; struct tempName jsonData; trashDirFile(&jsonData, "hgt", tg->track, ".json"); FILE *trashJson = mustOpen(jsonData.forCgi, "w"); struct jsonWrite *jw = jsonWriteNew(); jsonWriteObjectStart(jw, NULL); jsonWriteListStart(jw, tg->track); int i; /* could put up a 'no data' box when these items are not contiguous * e.g. when gaps interrupt the track data */ for (i = 0; i <= mouseOverIdx; ++i) { jsonWriteObjectStart(jw, NULL); jsonWriteNumber(jw, "x1", (long long)mouseOverData[i].x); jsonWriteNumber(jw, "y1", (long long)mouseOverData[i].y); jsonWriteNumber(jw, "x2", (long long)(mouseOverData[i].x + mouseOverData[i].width)); jsonWriteNumber(jw, "y2", (long long)(mouseOverData[i].y + mouseOverData[i].height)); jsonWriteDouble(jw, "v", mouseOverData[i].value); jsonWriteObjectEnd(jw); } jsonWriteListEnd(jw); jsonWriteObjectEnd(jw); fputs(jw->dy->string,trashJson); // This is the hidden signal to the javaScript of where to pick up // the json file hPrintf("<MAP Name=%s class=mouseOver trashFile='%s'>\n", tg->track, jsonData.forHtml); hPrintf("</MAP>\n"); carefulClose(&trashJson); - } -else -#endif - wigMapSelf(tg, hvg, seqStart, seqEnd, xOff, yOff, width); - -#ifdef NOT_READY_TO_GO + if (! beenHereDoneThat ) + { hPrintf("<div id='mouseOverContainer' class='wigMouseOver'>\n"); hPrintf(" <span id='mouseOverText' class=wigMouseOverValue'>\n"); -// hPrintf(" <p id='mouseOverValue'>. . . mouse over values</p>\n"); hPrintf(" </span>\n"); hPrintf("</div>\n"); + beenHereDoneThat = TRUE; + } + } +else #endif + wigMapSelf(tg, hvg, seqStart, seqEnd, xOff, yOff, width); } struct preDrawContainer *wigLoadPreDraw(struct track *tg, int seqStart, int seqEnd, int width) /* Do bits that load the predraw buffer tg->preDrawContainer. */ { /* Just need to do this once... */ if (tg->preDrawContainer) return tg->preDrawContainer; struct wigItem *wi; double pixelsPerBase = scaleForPixels(width); double basesPerPixel = 1.0; int itemCount = 0; char *currentFile = NULL; //char *currentFileRewrite = NULL;