Skip to content

Commit

Permalink
$mol_float: hide only when scrolling axis same with float axis.
Browse files Browse the repository at this point in the history
  • Loading branch information
nin--jin committed Sep 27, 2017
1 parent 9197327 commit 658d2c7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
4 changes: 3 additions & 1 deletion float/float.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ namespace $.$$ {
}

scrolling() {
return this.$.$mol_scroll_moving()
if( this.horizontal() && this.$.$mol_scroll_moving_hor() ) return true
if( this.vertical() && this.$.$mol_scroll_moving_vert() ) return true
return false
}

}
Expand Down
2 changes: 2 additions & 0 deletions scroll/scroll.view.tree
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
$mol_scroll $mol_view
minimal_height 0
moving_hor?val false
moving_vert?val false
field *
^
scrollTop <= scroll_top?val 0
Expand Down
23 changes: 18 additions & 5 deletions scroll/scroll.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ namespace $.$$ {
return false
}

export function $mol_scroll_moving_vert() {
return false
}

export function $mol_scroll_moving_hor() {
return false
}

export class $mol_scroll extends $.$mol_scroll {

// scroll_top( next? : number ) {
Expand All @@ -33,7 +41,8 @@ namespace $.$$ {
}

event_scroll( next? : Event ) {
this.moving( true )
this.moving_vert( this.scroll_top() !== this.dom_node().scrollTop )
this.moving_hor( this.scroll_left() !== this.dom_node().scrollLeft )
this.moving_task_stop()

new $mol_defer( ()=> {
Expand Down Expand Up @@ -62,12 +71,14 @@ namespace $.$$ {
_moving_task_timer = 0
moving_task_stop() {
clearTimeout( this._moving_task_timer )
this._moving_task_timer = setTimeout( ()=> this.moving( false ) , 50 )
this._moving_task_timer = setTimeout( ()=> {
this.moving_vert( false )
this.moving_hor( false )
} , 50 )
}

@ $mol_mem
moving( next? : boolean ) {
return next || false
moving() {
return this.moving_hor() || this.moving_vert()
}

@ $mol_mem
Expand All @@ -87,6 +98,8 @@ namespace $.$$ {
subContext.$mol_scroll_top = ()=> this.scroll_top()
subContext.$mol_scroll_left = ()=> this.scroll_left()
subContext.$mol_scroll_moving = ()=> this.moving()
subContext.$mol_scroll_moving_vert = ()=> this.moving_vert()
subContext.$mol_scroll_moving_hor = ()=> this.moving_hor()
return subContext
}

Expand Down

0 comments on commit 658d2c7

Please sign in to comment.