OLD | NEW |
1 <!-- | 1 <!-- |
2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 --> | 5 --> |
6 <import src="../../framework/sky-element/sky-element.sky" as="SkyElement" /> | 6 <import src="../../framework/sky-element/sky-element.sky" as="SkyElement" /> |
7 <import src="city-data-service.sky" as="CityDataService" /> | 7 <import src="city-data-service.sky" as="CityDataService" /> |
8 <import src="city-sequence.sky" as="CitySequence" /> | 8 <import src="city-sequence.sky" as="CitySequence" /> |
9 | 9 |
10 <template> | 10 <template> |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 while (this.firstItem > 0 && | 472 while (this.firstItem > 0 && |
473 targetTop < this.drawTop) { | 473 targetTop < this.drawTop) { |
474 | 474 |
475 var datum = data[this.firstItem - 1]; | 475 var datum = data[this.firstItem - 1]; |
476 var type = this.viewType(datum); | 476 var type = this.viewType(datum); |
477 var height = viewHeights[type]; | 477 var height = viewHeights[type]; |
478 | 478 |
479 this.drawTop -= height; | 479 this.drawTop -= height; |
480 | 480 |
481 var tile = targetBottom < this.drawTop ? | 481 var tile = targetBottom < this.drawTop ? |
482 new Tile(datum, null, viewType, -1) : // off-screen | 482 new Tile(datum, null, datum.viewType, -1) : // off-screen |
483 this.checkoutTile(type, datum, this.drawTop); | 483 this.checkoutTile(type, datum, this.drawTop); |
484 | 484 |
485 this.firstItem--; | 485 this.firstItem--; |
486 tiles.unshift(tile); | 486 tiles.unshift(tile); |
487 } | 487 } |
488 | 488 |
489 // Layout down to targetBottom | 489 // Layout down to targetBottom |
490 while (this.firstItem + tiles.length < data.length - 1 && | 490 while (this.firstItem + tiles.length < data.length - 1 && |
491 targetBottom > this.drawBottom) { | 491 targetBottom > this.drawBottom) { |
492 | 492 |
493 var datum = data[this.firstItem + tiles.length]; | 493 var datum = data[this.firstItem + tiles.length]; |
494 var type = this.viewType(datum); | 494 var type = this.viewType(datum); |
495 var height = viewHeights[type]; | 495 var height = viewHeights[type]; |
496 | 496 |
497 this.drawBottom += height; | 497 this.drawBottom += height; |
498 | 498 |
499 var tile = targetTop > this.drawBottom ? | 499 var tile = targetTop > this.drawBottom ? |
500 new Tile(datum, null, viewType, -1) : // off-screen | 500 new Tile(datum, null, datum.viewType, -1) : // off-screen |
501 this.checkoutTile(type, datum, this.drawBottom - height); | 501 this.checkoutTile(type, datum, this.drawBottom - height); |
502 | 502 |
503 tiles.push(tile); | 503 tiles.push(tile); |
504 } | 504 } |
505 | 505 |
506 // Debug validate: | 506 // Debug validate: |
507 // for (var i = 0; i < tiles.length; i++) { | 507 // for (var i = 0; i < tiles.length; i++) { |
508 // if (tiles[i].datum !== data[this.firstItem + i]) | 508 // if (tiles[i].datum !== data[this.firstItem + i]) |
509 // throw Error('Invalid') | 509 // throw Error('Invalid') |
510 // } | 510 // } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 return; | 593 return; |
594 | 594 |
595 this.updateView(this.loader.getItems(), true); | 595 this.updateView(this.loader.getItems(), true); |
596 } | 596 } |
597 }); | 597 }); |
598 | 598 |
599 })(this); | 599 })(this); |
600 | 600 |
601 </script> | 601 </script> |
602 | 602 |
OLD | NEW |