Laying out web now only refreshes right side when changing views. Faster and smoother.

This commit is contained in:
Samuel Clay 2015-02-09 17:47:05 -08:00
parent bed0f9d0e8
commit a3323de772
2 changed files with 71 additions and 69 deletions

View file

@ -256,15 +256,16 @@
this.apply_tipsy_titles();
},
apply_resizable_layout: function(refresh) {
apply_resizable_layout: function(options) {
options = options || {};
var story_anchor = this.model.preference('story_pane_anchor');
if (refresh) {
if (options.right_side) {
this.layout.contentLayout && this.layout.contentLayout.destroy();
this.layout.rightLayout && this.layout.rightLayout.destroy();
this.layout.leftCenterLayout && this.layout.leftCenterLayout.destroy();
this.layout.leftLayout && this.layout.leftLayout.destroy();
this.layout.outerLayout && this.layout.outerLayout.destroy();
// this.layout.leftCenterLayout && this.layout.leftCenterLayout.destroy();
// this.layout.leftLayout && this.layout.leftLayout.destroy();
// this.layout.outerLayout && this.layout.outerLayout.destroy();
var feed_stories_bin = $.make('div').append(this.$s.$feed_stories.children());
var story_titles_bin = $.make('div').append(this.$s.$story_titles.children());
@ -276,7 +277,7 @@
.removeClass('NB-story-pane-hidden')
.toggleClass('NB-story-pane-'+story_anchor,
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout') == 'split');
if (!options.right_side) {
this.layout.outerLayout = this.$s.$layout.layout({
zIndex: 2,
fxName: "slideOffscreen",
@ -338,6 +339,7 @@
enableCursorHotkey: false,
togglerLength_open: 0
});
}
if (_.contains(['split', 'full'],
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'))) {
@ -414,7 +416,7 @@
this.flags['story_titles_closed'] = false;
}
if (refresh) {
if (options.right_side) {
this.$s.$feed_stories.append(feed_stories_bin.children());
this.$s.$story_titles.append(story_titles_bin.children());
this.resize_window();
@ -1550,7 +1552,7 @@
NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, {'layout': story_layout});
this.set_correct_story_view_for_feed();
this.apply_resizable_layout(true);
this.apply_resizable_layout({right_side: true});
if (story_layout == 'list') {
if (this.active_story) {

View file

@ -313,7 +313,7 @@ NEWSBLUR.StoryOptionsPopover = NEWSBLUR.ReaderPopover.extend({
}
NEWSBLUR.assets.preference('story_pane_anchor', setting);
NEWSBLUR.assets.preference('story_titles_pane_size', pane_size);
NEWSBLUR.reader.apply_resizable_layout(true);
NEWSBLUR.reader.apply_resizable_layout({right_side: true});
},
change_single_story: function(e) {