@@ -46,7 +46,9 @@ export default {
46
46
top : 0 ,
47
47
titleSize : 20 ,
48
48
hasElevation : true ,
49
- revealActive : false
49
+ revealActive : false ,
50
+ fixedLastActive : false ,
51
+ fixedLastHeigth : false
50
52
} ,
51
53
drawer : {
52
54
active : false ,
@@ -188,28 +190,25 @@ export default {
188
190
}
189
191
} ,
190
192
handleFixedLastMode ( $event ) {
191
- let { scrollTop, toolbarHeight } = this . getToolbarConstrants ( $event )
193
+ let { scrollTop, toolbarHeight, safeAmount } = this . getToolbarConstrants ( $event )
192
194
const toolbar = this . MdApp . toolbar . element
193
195
const firstRow = toolbar . querySelector ( '.md-toolbar-row:first-child' )
194
196
const firstRowHeight = firstRow . offsetHeight
195
197
196
- if ( scrollTop > firstRowHeight ) {
197
- this . setToolbarMarginAndHeight ( scrollTop - firstRowHeight , toolbarHeight )
198
- } else {
199
- this . setToolbarMarginAndHeight ( 0 , toolbarHeight )
200
- }
198
+ window . clearTimeout ( this . revealTimer )
201
199
202
- /* if (firstRowHeight) {
203
- if (scrollTop < initialHeight - firstRowHeight) {
204
- toolbar.style.height = scrollAmount + 'px'
205
- } else {
206
- toolbar.style.height = firstRowHeight + 'px'
207
- }
208
- }
200
+ this . revealTimer = window . setTimeout ( ( ) => {
201
+ this . revealLastPos = scrollTop
202
+ } , 100 )
209
203
210
- let { threshold, toolbarHeight } = this.getToolbarConstrants($event)
204
+ this . setToolbarMarginAndHeight ( scrollTop - firstRowHeight , toolbarHeight )
205
+ this . MdApp . toolbar . fixedLastHeigth = firstRowHeight
211
206
212
- this.setToolbarMarginAndHeight(scrollTop - threshold, toolbarHeight) */
207
+ if ( scrollTop >= firstRowHeight ) {
208
+ this . MdApp . toolbar . fixedLastActive = this . revealLastPos > scrollTop + safeAmount
209
+ } else {
210
+ this . MdApp . toolbar . fixedLastActive = true
211
+ }
213
212
} ,
214
213
handleModeScroll ( $event ) {
215
214
if ( this . mdMode === 'reveal' ) {
@@ -253,6 +252,7 @@ export default {
253
252
}
254
253
255
254
if ( this . mdMode === 'fixed-last' ) {
255
+ this . MdApp . toolbar . fixedLastActive = true
256
256
this . handleFixedLastMode ( {
257
257
target : {
258
258
scrollTop : 0
0 commit comments