| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Thumbnail Mode. | 6 * Thumbnail Mode. |
| 7 * @param {!HTMLElement} container A container. | 7 * @param {!HTMLElement} container A container. |
| 8 * @param {!ErrorBanner} errorBanner Error banner. | 8 * @param {!ErrorBanner} errorBanner Error banner. |
| 9 * @param {!GalleryDataModel} dataModel Gallery data model. | 9 * @param {!GalleryDataModel} dataModel Gallery data model. |
| 10 * @param {!cr.ui.ListSelectionModel} selectionModel List selection model. | 10 * @param {!cr.ui.ListSelectionModel} selectionModel List selection model. |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 * Scrolls viewport to show the thumbnail of the index. | 436 * Scrolls viewport to show the thumbnail of the index. |
| 437 * @param {number} index Index of a thumbnail which becomes to appear in the | 437 * @param {number} index Index of a thumbnail which becomes to appear in the |
| 438 * viewport. | 438 * viewport. |
| 439 * @private | 439 * @private |
| 440 * | 440 * |
| 441 * TODO(yawano): Add scroll animation. | 441 * TODO(yawano): Add scroll animation. |
| 442 */ | 442 */ |
| 443 ThumbnailView.prototype.scrollTo_ = function(index) { | 443 ThumbnailView.prototype.scrollTo_ = function(index) { |
| 444 var thumbnailRect = this.getThumbnailRect(index); | 444 var thumbnailRect = this.getThumbnailRect(index); |
| 445 | 445 |
| 446 if (thumbnailRect.top - ThumbnailView.MARGIN < ImageEditor.Toolbar.HEIGHT) { | 446 if (thumbnailRect.top - ThumbnailView.MARGIN < ImageEditorToolbar.HEIGHT) { |
| 447 this.container_.scrollTop -= | 447 this.container_.scrollTop -= |
| 448 ImageEditor.Toolbar.HEIGHT - thumbnailRect.top + ThumbnailView.MARGIN; | 448 ImageEditorToolbar.HEIGHT - thumbnailRect.top + ThumbnailView.MARGIN; |
| 449 } else if (thumbnailRect.bottom + ThumbnailView.MARGIN > | 449 } else if (thumbnailRect.bottom + ThumbnailView.MARGIN > |
| 450 this.container_.clientHeight) { | 450 this.container_.clientHeight) { |
| 451 this.container_.scrollTop += thumbnailRect.bottom + ThumbnailView.MARGIN - | 451 this.container_.scrollTop += thumbnailRect.bottom + ThumbnailView.MARGIN - |
| 452 this.container_.clientHeight; | 452 this.container_.clientHeight; |
| 453 } | 453 } |
| 454 }; | 454 }; |
| 455 | 455 |
| 456 /** | 456 /** |
| 457 * Updates scroll bar. | 457 * Updates scroll bar. |
| 458 * @private | 458 * @private |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 }; | 1018 }; |
| 1019 }.bind(this, this.thumbnailLoadRequestId_)) | 1019 }.bind(this, this.thumbnailLoadRequestId_)) |
| 1020 .catch(function(requestId, error) { | 1020 .catch(function(requestId, error) { |
| 1021 if (requestId !== this.thumbnailLoadRequestId_) | 1021 if (requestId !== this.thumbnailLoadRequestId_) |
| 1022 return null; | 1022 return null; |
| 1023 | 1023 |
| 1024 this.setError_(error); | 1024 this.setError_(error); |
| 1025 return null; | 1025 return null; |
| 1026 }.bind(this, this.thumbnailLoadRequestId_)); | 1026 }.bind(this, this.thumbnailLoadRequestId_)); |
| 1027 }; | 1027 }; |
| OLD | NEW |