public/js/jquery.t.js in sequenceserver-1.0.1 vs public/js/jquery.t.js in sequenceserver-1.0.2
- old
+ new
@@ -14,10 +14,22 @@
evt.stopPropagation();
window.location.hash = $(this).attr('href');
});
};
+ var setupResponsiveness = function ($queryDiv, $graphDiv, index, opts) {
+ var currentWidth = $(window).width();
+ var debounced_draw = _.debounce(function () {
+ if (currentWidth !== $(window).width()) {
+ var shownHits = $queryDiv.find('.ghit > g').length;
+ $.graphIt($queryDiv, $graphDiv, shownHits, index, opts);
+ currentWidth = $(window).width();
+ }
+ }, 125);
+ $(window).resize(debounced_draw);
+ };
+
var graphControls = function ($queryDiv, $graphDiv, isInit) {
var MIN_HITS_TO_SHOW = 20;
var totalHits, shownHits, lessButton, moreButton;
@@ -340,9 +352,11 @@
}
// Bind listener events once all the graphical elements have
// been drawn for first time.
if (index === 0) {
graphControls($queryDiv, $graphDiv, true);
+ // Redraw the SVG on a browser resize...
+ setupResponsiveness($queryDiv, $graphDiv, index, opts);
}
// Refresh tooltip each time graph is redrawn.
setupTooltip();
// Ensure clicking on 'rect' takes user to the relevant hit on all
// browsers.