|
@@ -62,9 +62,7 @@ export class CanvasPlayer extends Mitt {
|
|
|
(pre, current) => pre + current["total"],
|
|
|
0
|
|
|
);
|
|
|
- console.log("total", total);
|
|
|
Array.from(this.setting).forEach((item, framekey) => {
|
|
|
- console.log("item", item, framekey);
|
|
|
const base = [];
|
|
|
const clip = {
|
|
|
id: item.sectionType,
|
|
@@ -117,18 +115,21 @@ export class CanvasPlayer extends Mitt {
|
|
|
enableScroll(type = 0) {
|
|
|
this.canScroll = true;
|
|
|
this.currentType = type;
|
|
|
- // this.initFirstFrame();
|
|
|
+ this.initFirstFrame();
|
|
|
}
|
|
|
unEnableScroll() {
|
|
|
this.canScroll = false;
|
|
|
}
|
|
|
manualScroll(event, type) {
|
|
|
+ if (!this.canScroll) {
|
|
|
+ this.enableScroll(type);
|
|
|
+ }
|
|
|
let lastKnownScrollPosition = 0;
|
|
|
let deltaY = 0;
|
|
|
const scrollY = event.target.scrollTop;
|
|
|
- this.enableScroll(type);
|
|
|
- deltaY = scrollY - lastKnownScrollPosition;
|
|
|
|
|
|
+ deltaY = scrollY - lastKnownScrollPosition;
|
|
|
+ console.log("deltaY", deltaY);
|
|
|
// this.watchScroll(event);
|
|
|
}
|
|
|
watchScroll(event) {
|
|
@@ -170,12 +171,18 @@ export class CanvasPlayer extends Mitt {
|
|
|
return;
|
|
|
}
|
|
|
if (na) {
|
|
|
- console.log("1111");
|
|
|
this.currentFrame++;
|
|
|
+ // console.log("111", this.currentFrame);
|
|
|
+ if (this.currentFrame === clip.total) {
|
|
|
+ this.emit("scroll-next");
|
|
|
+ }
|
|
|
this.reDraw(this.currentFrame, this.currentType);
|
|
|
} else {
|
|
|
- console.log("222");
|
|
|
this.currentFrame--;
|
|
|
+ // console.log("222", this.currentFrame);
|
|
|
+ if (this.currentFrame === 0) {
|
|
|
+ this.emit("scroll-prev");
|
|
|
+ }
|
|
|
this.reDraw(this.currentFrame, this.currentType);
|
|
|
}
|
|
|
const process = Number(this.currentFrame / clip.total) * 100;
|
|
@@ -215,6 +222,7 @@ export class CanvasPlayer extends Mitt {
|
|
|
}
|
|
|
initFirstFrame() {
|
|
|
if (this.currentType) {
|
|
|
+ console.log("initFirstFrame", initFirstFrame);
|
|
|
const frameItem = this.frames.find(
|
|
|
(item) => item.id == this.currentType && item.index == 1
|
|
|
);
|