File tree 2 files changed +248
-181
lines changed
2 files changed +248
-181
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,9 @@ class ScrollUI extends PIXI.Container {
66
66
public scrollBg ! : PIXI . Graphics ; //滑动背景;
67
67
public scrollContent ! : PIXI . Graphics ; //滑动内容;
68
68
public minScrollLen : number = 200 ; //最小滑动条长度
69
+
70
+
71
+ private _lock :boolean = false ; //禁止一切滑动;
69
72
constructor ( ) {
70
73
super ( ) ;
71
74
@@ -74,7 +77,20 @@ class ScrollUI extends PIXI.Container {
74
77
75
78
76
79
80
+ public set lock ( _b :boolean ) {
81
+ if ( _b === true ) {
82
+ this . scrollContent . interactive = false ;
83
+ this . scrollBar . interactive = false ;
77
84
85
+ } else {
86
+ this . scrollContent . interactive = true ;
87
+ this . scrollBar . interactive = true ;
88
+ }
89
+ this . _lock = _b ;
90
+ }
91
+ public get lock ( ) {
92
+ return this . _lock ;
93
+ }
78
94
79
95
public set scrollTop ( n : number ) {
80
96
@@ -535,10 +551,10 @@ class ScrollUI extends PIXI.Container {
535
551
536
552
// }
537
553
let islong = self . _contentHeight > self . _scrollHeight
538
- if ( e . wheelDelta && self . scrollContent_overed && islong ) { //判断浏览器IE,谷歌滑轮事件
554
+ if ( e . wheelDelta && self . scrollContent_overed && islong && ! self . lock ) { //判断浏览器IE,谷歌滑轮事件
539
555
540
556
self . scrollTop += e . wheelDelta ;
541
- } else if ( e . detail && self . scrollContent_overed && islong ) { //Firefox滑轮事件
557
+ } else if ( e . detail && self . scrollContent_overed && islong && ! self . lock ) { //Firefox滑轮事件
542
558
self . scrollTop += e . wheelDelta ;
543
559
}
544
560
} ;
You can’t perform that action at this time.
0 commit comments