Skip to content
Browse files

limiting the commits detail view to the boundaries of the graph

  • Loading branch information...
1 parent 9357892 commit acaf02695b89033fa0272f5e4da3202c67bfadab @Lukx Lukx committed Jun 8, 2013
Showing with 12 additions and 4 deletions.
  1. +12 −4 web/js/networkGraph.js
View
16 web/js/networkGraph.js
@@ -236,6 +236,10 @@
el.css('top', y + 'px');
};
+ that.outerWidth = function( ) {
+ return el.outerWidth.apply(el, arguments);
+ };
+
return that;
}
@@ -247,7 +251,6 @@
indicatorElements;
that.updateIndicators = function() {
- console.log(indicatorElements);
if( isLoading ) {
$(indicatorElements).addClass('loading-commits');
} else {
@@ -262,7 +265,6 @@
indicatorElements = indicatorElements.add(el);
}
- console.log(indicatorElements.length);
};
that.unbindIndicator = function( el ) {
@@ -522,8 +524,14 @@
function handleCommitMouseover(evt) {
detailOverlay.setCommit( this.data('commit'))
- .show()
- .positionTo( evt.pageX - commitsGraph.position().left + commitsGraph.scrollLeft() - 200,
+ .show();
+
+ var xPos = evt.pageX - commitsGraph.position().left + commitsGraph.scrollLeft() - (detailOverlay.outerWidth()/2);
+ // check that x doesn't run out the viewport
+ xPos = Math.max( xPos, commitsGraph.scrollLeft() + 10);
+ xPos = Math.min( xPos, commitsGraph.scrollLeft() + commitsGraph.width() - detailOverlay.outerWidth() - 10);
+
+ detailOverlay.positionTo( xPos,
evt.pageY - commitsGraph.position().top + commitsGraph.scrollTop() + 10);
}

0 comments on commit acaf026

Please sign in to comment.
Something went wrong with that request. Please try again.