Skip to content

Commit 6ef4335

Browse files
authored
Merge pull request #49 from yappbox/enhancement/aux-component
Pass verticalOffset to auxiliaryComponent in CollectionScrollView
2 parents cc3339a + d3c5fea commit 6ef4335

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

addon/components/collection-scroll-view/index.hbs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
@key={{@key}}
77
@auxiliaryComponent={{if @auxiliaryComponent
88
(component @auxiliaryComponent
9-
cell-layout=this.cellLayout
10-
items=@items
11-
estimated-width=@estimated-width
12-
estimated-height=@estimated-height
13-
client-width=this.clientWidth
14-
client-height=this.clientHeight
15-
scroll-top=this.scrollTop
9+
cellLayout=this.cellLayout
10+
items=@items
11+
clientSize=this.collectionClientSize
12+
scrollTop=this.collectionScrollTop
13+
verticalOffset=this.visibleHeaderHeight
1614
)
1715
}}
1816
@clientSizeChange={{this.clientSizeChange}}
@@ -50,9 +48,9 @@
5048

5149
{{#if @revealService}}
5250
{{emitter-action
53-
emitter=@revealService
54-
eventName="revealItemById"
55-
action=(fn this.scrollToItem scrollViewApi)
51+
emitter=@revealService
52+
eventName="revealItemById"
53+
action=(fn this.scrollToItem scrollViewApi)
5654
}}
5755
{{/if}}
5856
</ScrollView>

addon/components/collection-scroll-view/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ export default class CollectionScrollView extends Component {
7272
return Math.max(0, scrollTop - headerHeight);
7373
}
7474

75+
get visibleHeaderHeight() {
76+
let { headerHeight, scrollTop } = this;
77+
return Math.max(0, headerHeight - scrollTop);
78+
}
79+
7580
@action updateHeaderDimensions(scrollViewApi, entry) {
7681
let isFirstMeasure = !this.headerDimensions;
7782
this.headerDimensions = { width: entry.contentRect.width, height: entry.contentRect.height };

0 commit comments

Comments
 (0)