| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @param {!Element} container Content container. | 6 * @param {!Element} container Content container. |
| 7 * @param {!ErrorBanner} errorBanner Error banner. | 7 * @param {!ErrorBanner} errorBanner Error banner. |
| 8 * @param {!cr.ui.ArrayDataModel} dataModel Data model. | 8 * @param {!cr.ui.ArrayDataModel} dataModel Data model. |
| 9 * @param {!cr.ui.ListSelectionModel} selectionModel Selection model. | 9 * @param {!cr.ui.ListSelectionModel} selectionModel Selection model. |
| 10 * @param {!VolumeManager} volumeManager Volume manager. | 10 * @param {!VolumeManager} volumeManager Volume manager. |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 Math.max(0, Mosaic.ANIMATED_SCROLL_DURATION - lastPosition)); | 310 Math.max(0, Mosaic.ANIMATED_SCROLL_DURATION - lastPosition)); |
| 311 scrollOffset += step; | 311 scrollOffset += step; |
| 312 | 312 |
| 313 var oldScrollLeft = this.scrollLeft; | 313 var oldScrollLeft = this.scrollLeft; |
| 314 var newScrollLeft = Math.round(scrollOffset); | 314 var newScrollLeft = Math.round(scrollOffset); |
| 315 | 315 |
| 316 if (oldScrollLeft !== newScrollLeft) | 316 if (oldScrollLeft !== newScrollLeft) |
| 317 this.scrollLeft = newScrollLeft; | 317 this.scrollLeft = newScrollLeft; |
| 318 | 318 |
| 319 if (step === 0 || this.scrollLeft !== newScrollLeft) { | 319 if (step === 0 || this.scrollLeft !== newScrollLeft) { |
| 320 this.scrollAnimation_ = null; | 320 this.scrollAnimation_ = 0; |
| 321 // Release the hovering lock after a safe delay to avoid hovering | 321 // Release the hovering lock after a safe delay to avoid hovering |
| 322 // a tile because of altering |this.scrollLeft|. | 322 // a tile because of altering |this.scrollLeft|. |
| 323 setTimeout(function() { | 323 setTimeout(function() { |
| 324 if (!this.scrollAnimation_) | 324 if (!this.scrollAnimation_) |
| 325 this.suppressHovering_ = false; | 325 this.suppressHovering_ = false; |
| 326 }.bind(this), 100); | 326 }.bind(this), 100); |
| 327 } else { | 327 } else { |
| 328 // Continue the animation. | 328 // Continue the animation. |
| 329 this.scrollAnimation_ = requestAnimationFrame(animationFrame); | 329 this.scrollAnimation_ = requestAnimationFrame(animationFrame); |
| 330 } | 330 } |
| (...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2309 return new ImageRect(this.left_ - this.container_.scrollLeft, this.top_, | 2309 return new ImageRect(this.left_ - this.container_.scrollLeft, this.top_, |
| 2310 this.width_, this.height_).inflate(-margin, -margin); | 2310 this.width_, this.height_).inflate(-margin, -margin); |
| 2311 }; | 2311 }; |
| 2312 | 2312 |
| 2313 /** | 2313 /** |
| 2314 * @return {number} X coordinate of the tile center. | 2314 * @return {number} X coordinate of the tile center. |
| 2315 */ | 2315 */ |
| 2316 Mosaic.Tile.prototype.getCenterX = function() { | 2316 Mosaic.Tile.prototype.getCenterX = function() { |
| 2317 return this.left_ + Math.round(this.width_ / 2); | 2317 return this.left_ + Math.round(this.width_ / 2); |
| 2318 }; | 2318 }; |
| OLD | NEW |