Patch to synchronize title svg and allignment svg scrolling
authorCharles Ofoegbu <tcnofoegbu@dundee.ac.uk>
Mon, 22 Dec 2014 16:38:45 +0000 (16:38 +0000)
committerCharles Ofoegbu <tcnofoegbu@dundee.ac.uk>
Mon, 22 Dec 2014 16:38:45 +0000 (16:38 +0000)
src/jalview/io/HtmlSvgOutput.java

index 0ffbea1..3c9c608 100644 (file)
@@ -260,15 +260,40 @@ public class HtmlSvgOutput
   private String getHtml(String titleSvg, String alignmentSvg)
   {
     StringBuilder htmlSvg = new StringBuilder();
-    htmlSvg.append("<html><style type=\"text/css\"> div.title {"
-            + "height: 100%; width:11%; float: left; }"
-            + "div.align { height: 100%; width:89%;"
-            + "overflow: scroll; float: right; } </style>"
-            + "<div style=\"width:100%; height:100%; overflow: hidden\">"
-            + "<div class=\"title\">");
-    htmlSvg.append(titleSvg);
-    htmlSvg.append("</div><div class=\"align\">").append(alignmentSvg);
+    htmlSvg.append("<html>"
+            + "<style type=\"text/css\"> "
+            + "div.parent{ width:100%;<!-- overflow: auto; -->}\n"
+            + "div.titlex{ width:11%; float: left; }\n"
+            + "div.align{ width:89%; float: right; }\n"
+            + ".sub-category-container {overflow-y: scroll; overflow-x: hidden; width: 100%; height: 100%;}\n"
+            + "object {pointer-events: none;}"
+            + "</style>");
+    htmlSvg.append("<div>");
+    htmlSvg.append(
+"<div class=\"titlex\">");
+    htmlSvg.append(
+"<div class=\"sub-category-container\"> ")
+            .append(titleSvg)
+            .append("</div>")
+            .append("</div>\n\n<!-- ========================================================================================== -->\n\n");
+    htmlSvg.append(
+"<div class=\"align\" >");
+    htmlSvg.append(
+            "<div class=\"sub-category-container\"> <div style=\"overflow-x: scroll;\">")
+            .append(alignmentSvg)
+.append("</div></div>")
+            .append("</div>");
     htmlSvg.append("</div>");
+
+    htmlSvg.append("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js\"></script>\n"
+            + "<script language=\"JavaScript\" type=\"text/javascript\"  src=\"//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js\"></script>\n"
+            + "<script>\n"
+            + "var subCatContainer = $(\".sub-category-container\");\n"
+            + "subCatContainer.scroll(\nfunction() {\n"
+            + "subCatContainer.scrollTop($(this).scrollTop());\n});\n");
+
+    htmlSvg.append("</script></hmtl>");
+
     return htmlSvg.toString();
   }
 }