Skip to content

Commit dfb5b54

Browse files
author
liuzhaoting
committed
修改指令块的操作
1 parent de36710 commit dfb5b54

File tree

2 files changed

+248
-181
lines changed

2 files changed

+248
-181
lines changed

src/labs/ScrollUI.ts

+18-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ class ScrollUI extends PIXI.Container {
6666
public scrollBg!: PIXI.Graphics;//滑动背景;
6767
public scrollContent!: PIXI.Graphics;//滑动内容;
6868
public minScrollLen: number = 200;//最小滑动条长度
69+
70+
71+
private _lock:boolean = false;//禁止一切滑动;
6972
constructor() {
7073
super();
7174

@@ -74,7 +77,20 @@ class ScrollUI extends PIXI.Container {
7477

7578

7679

80+
public set lock(_b:boolean){
81+
if(_b === true){
82+
this.scrollContent.interactive = false;
83+
this.scrollBar.interactive= false;
7784

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+
}
7894

7995
public set scrollTop(n: number) {
8096

@@ -535,10 +551,10 @@ class ScrollUI extends PIXI.Container {
535551

536552
// }
537553
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,谷歌滑轮事件
539555

540556
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滑轮事件
542558
self.scrollTop += e.wheelDelta;
543559
}
544560
};

0 commit comments

Comments
 (0)