From 32663de09c39353c40b4a20fbbf5d41311968591 Mon Sep 17 00:00:00 2001 From: abe33 Date: Tue, 10 Mar 2015 12:18:16 +0100 Subject: [PATCH] Add a setting for scroll animation duration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Useful in test so that we can override it. Also if people want to tweak it, it’s now possible. --- lib/main.coffee | 6 +++++- lib/minimap-element.coffee | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/main.coffee b/lib/main.coffee index ee236b1e..2bf51961 100644 --- a/lib/main.coffee +++ b/lib/main.coffee @@ -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 diff --git a/lib/minimap-element.coffee b/lib/minimap-element.coffee index c7620d3d..36ef35d3 100644 --- a/lib/minimap-element.coffee +++ b/lib/minimap-element.coffee @@ -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)