selected = @options.app.state.get 'selectedIndex'
selectedIssue = @options.app.issues.at selected
if selectedIssue.get('component') == @model.get('key')
- selectedKey = selectedIssue.get 'key'
- @scrollToIssue selectedKey
+ @scrollToLine selectedIssue.get('line')
else
@unbindShortcuts()
@options.app.controller.showComponentViewer selectedIssue
$ = jQuery
- TOP_OFFSET = 72
+ TOP_OFFSET = 43
+ COMPONENT_HEIGHT = 29
BOTTOM_OFFSET = 10
selectedIssue = @collection.at @options.app.state.get 'selectedIndex'
return unless selectedIssue?
selectedIssueView = @children.findByModel selectedIssue
- viewTop = selectedIssueView.$el.offset().top
- viewBottom = viewTop + selectedIssueView.$el.outerHeight()
+ viewTop = selectedIssueView.$el.offset().top - TOP_OFFSET
+ if selectedIssueView.$el.prev().is('.issues-workspace-list-component')
+ viewTop -= COMPONENT_HEIGHT
+ viewBottom = selectedIssueView.$el.offset().top + selectedIssueView.$el.outerHeight() + BOTTOM_OFFSET
windowTop = $(window).scrollTop()
windowBottom = windowTop + $(window).height()
if viewTop < windowTop
- $(window).scrollTop viewTop - TOP_OFFSET
+ $(window).scrollTop viewTop
if viewBottom > windowBottom
- $(window).scrollTop $(window).scrollTop() - windowBottom + viewBottom + BOTTOM_OFFSET
+ $(window).scrollTop $(window).scrollTop() - windowBottom + viewBottom
appendHtml: (compositeView, itemView, index) ->