From e45de166e7bcca9c4cdee7e0872777e24d00b936 Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Thu, 18 Jul 2013 12:46:47 -0700 Subject: [PATCH] Fixing infernal scroll bug where scroll events would queue up even though they weren't supposed to. --- media/js/newsblur/reader/reader.js | 8 ++++---- media/js/newsblur/views/story_list_view.js | 3 +-- media/js/newsblur/views/story_share_view.js | 2 +- media/js/newsblur/views/story_titles_view.js | 4 ++-- media/js/vendor/jquery.scrollTo.js | 1 - 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/media/js/newsblur/reader/reader.js b/media/js/newsblur/reader/reader.js index 40a080e44..2e4ced337 100644 --- a/media/js/newsblur/reader/reader.js +++ b/media/js/newsblur/reader/reader.js @@ -815,27 +815,27 @@ } // NEWSBLUR.log(['scroll_in_story', this.$s.$story_pane, direction, amount]); if (NEWSBLUR.assets.preference('story_layout') == 'list') { - this.$s.$story_titles.scrollTo({ + this.$s.$story_titles.stop().scrollTo({ top: dir+'='+amount, left:'+=0' }, 130, {queue: false}); } else if (this.story_view == 'page' && !this.flags['page_view_showing_feed_view'] && !this.flags['temporary_story_view']) { - this.$s.$feed_iframe.scrollTo({ + this.$s.$feed_iframe.stop().scrollTo({ top: dir+'='+amount, left:'+=0' }, 130, {queue: false}); } else if ((this.story_view == 'feed' && !this.flags['temporary_story_view']) || this.flags['page_view_showing_feed_view']) { - this.$s.$feed_scroll.scrollTo({ + this.$s.$feed_scroll.stop().scrollTo({ top: dir+'='+amount, left:'+=0' }, 130, {queue: false}); } else if (this.story_view == 'text' || this.flags['temporary_story_view']) { - this.$s.$text_view.scrollTo({ + this.$s.$text_view.stop().scrollTo({ top: dir+'='+amount, left:'+=0' }, 130, {queue: false}); diff --git a/media/js/newsblur/views/story_list_view.js b/media/js/newsblur/views/story_list_view.js index a0b38534c..2e4a79aab 100644 --- a/media/js/newsblur/views/story_list_view.js +++ b/media/js/newsblur/views/story_list_view.js @@ -178,9 +178,8 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({ clearTimeout(NEWSBLUR.reader.locks.scrolling); NEWSBLUR.reader.flags.scrolling_by_selecting_story_title = true; - NEWSBLUR.reader.$s.$feed_scroll._scrollable().stop(); var scroll_to = options.scroll_to_top ? 0 : $story; - NEWSBLUR.reader.$s.$feed_scroll.scrollTo(scroll_to, { + NEWSBLUR.reader.$s.$feed_scroll.stop().scrollTo(scroll_to, { duration: options.immediate ? 0 : 340, axis: 'y', easing: 'easeInOutQuint', diff --git a/media/js/newsblur/views/story_share_view.js b/media/js/newsblur/views/story_share_view.js index 1bd088286..4a5067d2e 100644 --- a/media/js/newsblur/views/story_share_view.js +++ b/media/js/newsblur/views/story_share_view.js @@ -122,7 +122,7 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({ if (_.contains(['split', 'full'], NEWSBLUR.assets.preference('story_layout'))) { $scroll_container = this.model.latest_story_detail_view.$el.parent(); } - $scroll_container.scrollTo(this.$el, { + $scroll_container.stop().scrollTo(this.$el, { duration: 600, queue: false, easing: 'easeInOutQuint', diff --git a/media/js/newsblur/views/story_titles_view.js b/media/js/newsblur/views/story_titles_view.js index 3a267e71c..6d4a7b970 100644 --- a/media/js/newsblur/views/story_titles_view.js +++ b/media/js/newsblur/views/story_titles_view.js @@ -114,7 +114,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({ if (this.pre_load_page_scroll_position > 0) { this.pre_load_page_scroll_position += $endline.outerHeight(); } - $story_titles.scrollTo($endline, { + $story_titles.stop().scrollTo($endline, { duration: 0, axis: 'y', easing: 'easeInOutQuint', @@ -170,7 +170,7 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({ if (this.post_load_page_scroll_position == $story_titles.scrollTop() && this.pre_load_page_scroll_position != null && !NEWSBLUR.reader.flags['select_story_in_feed']) { - $story_titles.scrollTo(this.pre_load_page_scroll_position, { + $story_titles.stop().scrollTo(this.pre_load_page_scroll_position, { duration: 0, axis: 'y', offset: 0, diff --git a/media/js/vendor/jquery.scrollTo.js b/media/js/vendor/jquery.scrollTo.js index e6ee06b7a..c6fe9845b 100644 --- a/media/js/vendor/jquery.scrollTo.js +++ b/media/js/vendor/jquery.scrollTo.js @@ -103,7 +103,6 @@ duration = duration || settings.duration; // Make sure the settings are given right settings.queue = settings.queue && settings.axis.length > 1; - if( settings.queue ) // Let's keep the overall duration duration /= 2;