644f1ed70c1b04896944f66bdfa03c16278135d6 braney Fri Jul 31 15:16:12 2026 -0700 quickLift: keep the difference lines from standing still during a drag The difference lines are drawn up over a track's center label, but center labels don't scroll with the data, so the lines sat still while the image moved underneath them. hgTracks now keeps each center label as text with the color it was drawn in, and flags the label when lines were painted over it. While the image is being dragged hgTracks.js hides that slice and puts the label up as text in its place, then swaps the image back on drop. Windows with no difference lines drawn are untouched. refs #37974 diff --git src/hg/hgTracks/imageV2.c src/hg/hgTracks/imageV2.c index 82ad780d229..9564d622927 100644 --- src/hg/hgTracks/imageV2.c +++ src/hg/hgTracks/imageV2.c @@ -1905,32 +1905,37 @@ char *name,int offsetX,int offsetY,boolean useMap) // writes an image as HTML { if (slice->parentImg && slice->parentImg->file != NULL) { hPrintf(" <IMG id='img_%s' src='%s' style='left:-%dpx; top: -%dpx;'", name,slice->parentImg->file,offsetX,offsetY); // Problem: dragScroll beyond left shows unsightly leftLabel! // Tried clip:rect() but this only works with position:absolute! // May need to split image betweeen side label and data!!! That is a big change. if (useMap) hPrintf(" usemap='#map_%s'",name); hPrintf(" class='sliceImg %s",sliceTypeToClass(slice->type)); if (slice->type==stData && imgBox->showPortal) // || slice->type==stCenter will make centerLabels scroll too - hPrintf(" panImg'"); - else + hPrintf(" panImg"); + // When something is drawn over the center label (quickLift difference lines) that + // slice can't be shown while the image is being dragged: center labels don't scroll, + // so the lines would sit still while the image moves underneath them. Mark it so + // dragScroll can swap it for the text stand-in below. + if (slice->type==stCenter && imgTrack->cntrLabDrawnOver && imgTrack->cntrLabText != NULL) + hPrintf(" cntrLabLines"); hPrintf("'"); if (slice->title != NULL) hPrintf(" title='%s'", attributeEncode(slice->title) ); // Adds slice wide title else if (slice->parentImg->title != NULL) hPrintf("' title='%s'", attributeEncode(slice->parentImg->title) );// Adds image wide title if (slice->type==stData || slice->type==stCenter) { char id[256]; safef(id, sizeof id, "img_%s", name); jsOnEventById("drag", id, "return false;"); } hPrintf(">"); } else { @@ -2023,30 +2028,45 @@ // Adjustment for portal if (imgBox->showPortal && imgBox->basesPerPixel > 0 && (sliceType==stData || sliceType==stCenter)) { offsetX += (imgBox->portalStart - imgBox->chromStart) / imgBox->basesPerPixel; width=imgBox->portalWidth; } hPrintf(" <div style='width:%dpx; height:%dpx;",width,height); if (sliceType == stCenter && imgTrack->centerLabelSeen == clNotSeen) hPrintf(" display:none;"); hPrintf("' class='sliceDiv %s",sliceTypeToClass(slice->type)); if (imgBox->showPortal && (sliceType==stData || sliceType==stCenter)) hPrintf(" panDiv%s",(scrollHandle ? " scroller" : "")); hPrintf("'>\n"); + + if (sliceType == stCenter && imgTrack->cntrLabDrawnOver + && imgTrack->cntrLabText != NULL) + { + // Text stand-in for a center label that has quickLift difference lines painted + // over it. dragScroll shows this and hides the image slice while the image is + // moving (see panImages() in hgTracks.js). Centered in the same box as the + // label in the image, though not in the same font. + hPrintf(" <div class='cntrLabStandIn' style='display:none; width:%dpx; " + "height:%dpx; line-height:%dpx; font-size:%dpx; overflow:hidden; " + "text-align:center; white-space:nowrap; color:%s; " + "font-family:Helvetica,Arial,sans-serif;'>%s</div>\n", + width, height, height, height - 2, imgTrack->cntrLabTextColor, + htmlEncode(imgTrack->cntrLabText)); + } } struct mapSet *map = sliceGetMap(slice,FALSE); // Could be the image map or slice specific if (map) useMap = imageMapDraw(map,name); else if (slice->link != NULL) { if (sameString(TITLE_BUT_NO_LINK,slice->link)) { // This fake link ensures a mouse-over title is seen but not heard hPrintf("<A class='%s'",TITLE_BUT_NO_LINK); } else if (skipToSpaces(slice->link) != NULL) hPrintf(" <A HREF=%s",slice->link); else hPrintf(" <A HREF='%s'",slice->link); if (slice->title != NULL)