Commit 17b939d7 authored by 李维's avatar 李维

修改进度条显示隐藏问题

parent c791db39
...@@ -1520,8 +1520,11 @@ cc.Class({ ...@@ -1520,8 +1520,11 @@ cc.Class({
const touchStart = (e) => { const touchStart = (e) => {
this.canvasTouchStart(e); this.canvasTouchStart(e);
console.log("touch start"); // console.log("touch start");
this.showProgressBar(true); if(e.target.name != "dragButton") {
this.showProgressBar(true);
}
if (canvas.hasEventListener(cc.Node.EventType.MOUSE_DOWN)) { if (canvas.hasEventListener(cc.Node.EventType.MOUSE_DOWN)) {
canvas.off(cc.Node.EventType.MOUSE_DOWN, mouseDown); canvas.off(cc.Node.EventType.MOUSE_DOWN, mouseDown);
} }
...@@ -1532,8 +1535,10 @@ cc.Class({ ...@@ -1532,8 +1535,10 @@ cc.Class({
return; return;
} }
this.canvasTouchStart(e); this.canvasTouchStart(e);
console.log("mouse down"); // console.log("mouse down");
this.showProgressBar(true); if(e.target.name != "dragButton") {
this.showProgressBar(true);
}
if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) { if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) {
canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove); canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove);
...@@ -1606,11 +1611,13 @@ cc.Class({ ...@@ -1606,11 +1611,13 @@ cc.Class({
this.isDragProgressBar = true; this.isDragProgressBar = true;
this.video.pause(); this.video.pause();
this.videoControlBar.emit("update_video_status", 0); this.videoControlBar.emit("update_video_status", 0);
this.cleanProgressBarTimer();
} else { } else {
this.restQuesData(this.video.currentTime); this.restQuesData(this.video.currentTime);
this.isDragProgressBar = false; this.isDragProgressBar = false;
this.video.play(); this.video.play();
this.videoControlBar.emit("update_video_status", 1); this.videoControlBar.emit("update_video_status", 1);
this.setProgressBarTimer();
} }
}) })
...@@ -1621,6 +1628,8 @@ cc.Class({ ...@@ -1621,6 +1628,8 @@ cc.Class({
// 监听组件发来视频播放、暂停事件 // 监听组件发来视频播放、暂停事件
this.videoControlBar.on("video_btn_click", (isPlay)=>{ this.videoControlBar.on("video_btn_click", (isPlay)=>{
this.cleanProgressBarTimer();
this.setProgressBarTimer();
if(isPlay) { if(isPlay) {
if(this.isWaitingUserAction) { if(this.isWaitingUserAction) {
this.hideWaitingVideo(); this.hideWaitingVideo();
...@@ -1639,9 +1648,7 @@ cc.Class({ ...@@ -1639,9 +1648,7 @@ cc.Class({
// 隐藏进度条定时器 // 隐藏进度条定时器
timeoutHideBarId : null, timeoutHideBarId : null,
showProgressBar(withAnimation = false) { showProgressBar(withAnimation = false) {
if(this.timeoutHideBarId) { this.cleanProgressBarTimer()
clearTimeout(this.timeoutHideBarId);
}
if(this.isShowProgressBar) { if(this.isShowProgressBar) {
// 如果当前显示进度条 // 如果当前显示进度条
...@@ -1651,12 +1658,21 @@ cc.Class({ ...@@ -1651,12 +1658,21 @@ cc.Class({
// 如果当前显示进度条 // 如果当前显示进度条
this.videoControlBar.emit("show_bar", withAnimation); this.videoControlBar.emit("show_bar", withAnimation);
this.isShowProgressBar = true; this.isShowProgressBar = true;
this.timeoutHideBarId = setTimeout(()=>{ this.setProgressBarTimer();
this.videoControlBar.emit("hide_bar", true);
this.isShowProgressBar = false;
}, 2000)
} }
},
cleanProgressBarTimer() {
if(this.timeoutHideBarId) {
clearTimeout(this.timeoutHideBarId);
}
},
setProgressBarTimer() {
this.timeoutHideBarId = setTimeout(()=>{
this.videoControlBar.emit("hide_bar", true);
this.isShowProgressBar = false;
}, 2000)
}, },
canvasTouchStart(e) { canvasTouchStart(e) {
...@@ -1761,6 +1777,7 @@ cc.Class({ ...@@ -1761,6 +1777,7 @@ cc.Class({
hotZoneBg: null, hotZoneBg: null,
initHotZoneBg() { initHotZoneBg() {
for (let i = 0; i < this.data.quesArr.length; i++) { for (let i = 0; i < this.data.quesArr.length; i++) {
this.data.quesArr[i].index = i;
const data = this.data.quesArr[i]; const data = this.data.quesArr[i];
const hotZoneBg = new cc.Node(); const hotZoneBg = new cc.Node();
...@@ -2794,10 +2811,10 @@ cc.Class({ ...@@ -2794,10 +2811,10 @@ cc.Class({
// this.startWrongVideo(); // this.startWrongVideo();
// } // }
const id = data.index; const id = this.quesIndex;
bg.active = false; bg.active = false;
this.hand.active = false; this.hand.active = false;
console.log("跳转", data.index) console.log("跳转", id)
this.showMask(() => { this.showMask(() => {
if (!this.isLocal) { if (!this.isLocal) {
console.log("[MRBR_VIDEO] 调用系统方法:PSQS_jump_to_question") console.log("[MRBR_VIDEO] 调用系统方法:PSQS_jump_to_question")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment