From 467d4da8cc1848ced6d1246e7a53e53e1b1ad28e Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 19 Dec 2014 09:47:52 +0100 Subject: [PATCH] Fix navigation between issues in a big file --- .../main/coffee/issues/component-viewer/main.coffee | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee b/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee index 2b0be2c80b3..e3833ee2541 100644 --- a/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee +++ b/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee @@ -91,7 +91,7 @@ define [ selected = @options.app.state.get 'selectedIndex' selectedIssue = @options.app.issues.at selected if selectedIssue.get('component') == @model.get('key') - @scrollToLine selectedIssue.get('line') + @scrollToIssue selectedIssue.get('key') else @unbindShortcuts() @options.app.controller.showComponentViewer selectedIssue @@ -116,14 +116,8 @@ define [ scrollToIssue: (key) -> el = @$("#issue-#{key}") if el.length > 0 - viewTop = el.offset().top - viewBottom = viewTop + el.outerHeight() - windowTop = $(window).scrollTop() - windowBottom = windowTop + $(window).height() - if viewTop < windowTop - $(window).scrollTop viewTop - TOP_OFFSET - if viewBottom > windowBottom - $(window).scrollTop $(window).scrollTop() - windowBottom + viewBottom + BOTTOM_OFFSET + line = el.closest('[data-line-number]').data 'line-number' + this.scrollToLine line else @unbindShortcuts() selected = @options.app.state.get 'selectedIndex' -- 2.39.5