447513356fcfa684846bdd1b63476e68d9c17ce9 chmalee Thu Apr 6 09:04:41 2023 -0700 Add code to create tooltips under our control. Convert title attributes on hgTracks into these tooltips diff --git src/hg/hgTracks/imageV2.c src/hg/hgTracks/imageV2.c index be3b5b0..d885cd2 100644 --- src/hg/hgTracks/imageV2.c +++ src/hg/hgTracks/imageV2.c @@ -1885,31 +1885,31 @@ hPrintf(" width:9px; display:none;' class='%s %sbtn btnN'>
", trackName,(slice->link == NULL ? "inset " : "")); } else hPrintf("width:%dpx;'>",slice->width); } } // FF does not support newline code and '...' looks bad without newlines #define NEWLINE_ENCODED " " #define NEWLINE_NOT_SUPPORTED " - " #define NEWLINE_TO_USE(browser) ((browser) == btFF ? NEWLINE_NOT_SUPPORTED : NEWLINE_ENCODED) #define ELLIPSIS_TO_USE(browser) ((browser) == btFF ? "" : "...") static void sliceAndMapDraw(struct imgBox *imgBox,struct imgTrack *imgTrack, - enum sliceType sliceType,char *name,boolean scrollHandle) + enum sliceType sliceType,char *name,boolean scrollHandle, struct jsonElement *ele) // writes a slice of an image and any assocated image map as HTML { if (imgBox==NULL || imgTrack==NULL) return; struct imgSlice *slice = imgTrackSliceGetByType(imgTrack,sliceType); if (slice==NULL || slice->height == 0) return; boolean useMap=FALSE; int offsetX=slice->offsetX; int offsetY=slice->offsetY; int height = slice->height; int width=slice->width; if (slice->parentImg) { @@ -1967,30 +1967,33 @@ char *ellipsis = ELLIPSIS_TO_USE(browser); if (imgTrack->reorderable) hPrintf(" TITLE='%s%sclick or right click to configure%s%sdrag to reorder%s'", attributeEncode(slice->title), newLine, ellipsis, newLine, (tdbIsCompositeChild(imgTrack->tdb) ? " highlighted subtracks" : "") ); else hPrintf(" TITLE='%s%sclick or right click to configure%s'", attributeEncode(slice->title), newLine, ellipsis); } else hPrintf(" TITLE='Click for: %s'", attributeEncode(slice->title) ); } hPrintf(">\n" ); } +char *trackName = (imgTrack->name != NULL ? imgTrack->name : imgTrack->tdb->track ); +struct jsonElement *trackHash = jsonFindNamedField(ele, "trackDb", trackName); +jsonObjectAdd(trackHash, "imgOffsetY", newJsonNumber(offsetY)); imageDraw(imgBox,imgTrack,slice,name,offsetX,offsetY,useMap); if (slice->link != NULL) hPrintf(""); if (slice->parentImg) hPrintf(""); } struct imgTrack *smashSquish(struct imgTrack *imgTrackList) /* Javascript doesn't know about our trick to do squishyPack so we need to pass it a single div instead of two. * We assume that the linked track immediately follows the original track in the sorted list. */ { struct imgTrack *nextImg, *imgTrack; for (imgTrack = imgTrackList; imgTrack!=NULL;imgTrack = nextImg) @@ -2094,66 +2097,66 @@ { char *trackName = (imgTrack->name != NULL ? imgTrack->name : imgTrack->tdb->track ); struct track *track = hashFindVal(trackHash, trackName); if (track) jsonTdbSettingsBuild(jsonTdbVars, track, TRUE); hPrintf("