-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
scroll.view.ts
46 lines (31 loc) · 908 Bytes
/
scroll.view.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
namespace $.$$ {
/**
* Scrolling pane.
* @see https://mol.hyoo.ru/#!section=demos/demo=mol_scroll_demo
*/
export class $mol_scroll extends $.$mol_scroll {
@ $mol_mem
scroll_top( next? : number, cache?: 'cache' ): number {
const el = this.dom_node()
if( next !== undefined && !cache ) el.scrollTop = next
return el.scrollTop
}
@ $mol_mem
scroll_left( next? : number, cache?: 'cache' ): number {
const el = this.dom_node()
if( next !== undefined && !cache ) el.scrollLeft = next
return el.scrollLeft
}
event_scroll( next? : Event ) {
const el = this.dom_node() as HTMLElement
this.scroll_left( el.scrollLeft, 'cache' )
this.scroll_top( el.scrollTop, 'cache' )
}
minimal_height() {
return this.$.$mol_print.active() ? null! : 0
}
minimal_width() {
return this.$.$mol_print.active() ? null! : 0
}
}
}