Skip to content

Commit

Permalink
Files.app: Remove flicker of thumbnail on the preview panel.
Browse files Browse the repository at this point in the history
The CL stop thumbnail loading when if the selected entries are not changed.

BUG=316050
TEST=see the thumbnail during copy

Review URL: https://codereview.chromium.org/723043002

Cr-Commit-Position: refs/heads/master@{#304007}
  • Loading branch information
hirono-chromium authored and Commit bot committed Nov 13, 2014
1 parent d57020d commit 0eef218
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ui/file_manager/file_manager/foreground/js/ui/preview_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ PreviewPanel.Thumbnails = function(element, metadataCache, volumeManager) {
this.element_ = element;
this.metadataCache_ = metadataCache;
this.volumeManager_ = volumeManager;
this.sequence_ = 0;
this.lastEntriesHash_ = '';
Object.seal(this);
};

Expand Down Expand Up @@ -413,8 +413,15 @@ PreviewPanel.Thumbnails.prototype = {
* @param {FileSelection} value Entries.
*/
set selection(value) {
this.sequence_++;
this.loadThumbnails_(value);
// Create hash for the selection.
var hash = value.entries.slice(
0, PreviewPanel.Thumbnails.MAX_THUMBNAIL_COUNT).map(function(entry) {
return entry.toURL();
}).sort().join('\n');
if (hash !== this.lastEntriesHash_) {
this.lastEntriesHash_ = hash;
this.loadThumbnails_(value);
}
},

/**
Expand Down Expand Up @@ -454,7 +461,7 @@ PreviewPanel.Thumbnails.prototype.loadThumbnails_ = function(selection) {
this.volumeManager_,
ThumbnailLoader.FillMode.FILL,
FileGrid.ThumbnailQuality.LOW,
/* animation */ false,
/* animation */ true,
i == 0 && length == 1 ? this.setZoomedImage_.bind(this) : undefined);
}

Expand Down

0 comments on commit 0eef218

Please sign in to comment.