Index: src/hg/hgTracks/simpleTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/simpleTracks.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -b -B -U 4 -r1.97 -r1.98
--- src/hg/hgTracks/simpleTracks.c	25 Aug 2009 21:28:40 -0000	1.97
+++ src/hg/hgTracks/simpleTracks.c	27 Aug 2009 00:10:16 -0000	1.98
@@ -570,23 +570,28 @@
     start = winStart;
     end = winEnd;
     }
 #ifdef IMAGEv2_UI
-if(curMap != NULL)
+if(theImgBox && curMap)
     {
+    // FIXME: The problem with leftLabel toggle appears to be a single map area meant to cover the whole leftLabel and data!
+    // eg: COORDS="11,395,800,405" in non IMAGEv2 image covers everything left of button through to right edge of image
+    // Solution?  Either drop the toggle on side button, or make separate map areas.
     char link[512];
     safef(link,sizeof(link),"%s?%s",hgTracksName(), ui->string); // NOTE: position removed due to portal
     mapSetItemAdd(curMap,link,(char *)(message != NULL?message:NULL),x, y, x+width, y+height);
     }
-#else//ndef IMAGEv2_UI
-hPrintf("<AREA SHAPE=RECT COORDS=\"%d,%d,%d,%d\" ", x, y, x+width, y+height);
-hPrintf("HREF=\"%s?position=%s:%d-%d",
+else
+#endif//def IMAGEv2_UI
+    {
+    hPrintf("<AREA SHAPE=RECT COORDS=\"%d,%d,%d,%d\" ", x, y, x+width, y+height);
+    hPrintf("HREF=\"%s?position=%s:%d-%d",
 	hgTracksName(), chrom, start+1, end);
-hPrintf("&%s\"", ui->string);
-if (message != NULL)
+    hPrintf("&%s\"", ui->string);
+    if (message != NULL)
     mapStatusMessage("%s", message);
-hPrintf(">\n");
-#endif//ndef IMAGEv2_UI
+    hPrintf(">\n");
+    }
 freeDyString(&ui);
 }
 
 void mapBoxToggleVis(struct hvGfx *hvg, int x, int y, int width, int height,
@@ -639,9 +644,9 @@
     char *encodedItem = cgiEncode(item);
     char *encodedTrack = cgiEncode(track);
 
     #ifdef IMAGEv2_UI
-    if(curMap != NULL)
+    if(theImgBox && curMap)
         {
         char link[512];
         if (directUrl)
             {
@@ -658,9 +663,11 @@
             safef(link+strlen(link),sizeof(link)-strlen(link),"&%s", extra);
         // Add map item to currnent map (TODO: pass in map)
         mapSetItemAdd(curMap,link,(char *)(statusLine!=NULL?statusLine:NULL),x, y, xEnd, yEnd);
         }
-    #else//ifndef IMAGEv2_UI
+    else
+    #endif//def IMAGEv2_UI
+        {
     hPrintf("<AREA SHAPE=RECT COORDS=\"%d,%d,%d,%d\" ", x, y, xEnd, yEnd);
     if (directUrl)
 	{
 	hPrintf("HREF=\"");
@@ -680,9 +687,9 @@
     hPrintf("\" ");
     if (statusLine != NULL)
 	   mapStatusMessage("%s", statusLine);
     hPrintf(">\n");
-    #endif//ndef IMAGEv2_UI
+        }
     freeMem(encodedItem);
     freeMem(encodedTrack);
     }
 }

