Skip to content

Commit

Permalink
Add a setting for scroll animation duration
Browse files Browse the repository at this point in the history
Useful in test so that we can override it. Also if people want to tweak
it, it’s now possible.
  • Loading branch information
abe33 committed Mar 10, 2015
1 parent e1ef779 commit 32663de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ class Main
scrollAnimation:
type: 'boolean'
default: false
description: "If this option is enabled then when you click the minimap it will scroll to the destination with animation"
description: 'Enables animations when scrolling by clicking on the minimap.'
scrollAnimationDuration:
type: 'integer'
default: 300
description: 'The duration of scrolling animations when clicking on the minimap.'
createPluginInDevMode:
type: 'boolean'
default: false
Expand Down
2 changes: 1 addition & 1 deletion lib/minimap-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ class MinimapElement extends HTMLElement
scrollTop = row * textEditor.getLineHeightInPixels() - textEditor.getHeight() / 2

if atom.config.get('minimap.scrollAnimation')
duration = 300
from = textEditor.getScrollTop()
to = scrollTop
step = (now) => textEditor.setScrollTop(now)
duration = atom.config.get('minimap.scrollAnimationDuration')
@animate(from: from, to: to, duration: duration, step: step)
else
textEditor.setScrollTop(scrollTop)
Expand Down

0 comments on commit 32663de

Please sign in to comment.