|
@@ -47,9 +47,9 @@ Viewer.propTypes = {
|
|
};
|
|
};
|
|
|
|
|
|
class ViewerInner extends Component {
|
|
class ViewerInner extends Component {
|
|
- constructor() {
|
|
|
|
|
|
+ constructor(props) {
|
|
super();
|
|
super();
|
|
- console.log("hello constructor");
|
|
|
|
|
|
+
|
|
//ref
|
|
//ref
|
|
this.containerRef = createRef(null);
|
|
this.containerRef = createRef(null);
|
|
this.viewerRef = createRef(null);
|
|
this.viewerRef = createRef(null);
|
|
@@ -84,10 +84,12 @@ class ViewerInner extends Component {
|
|
this.lastProgress = false;
|
|
this.lastProgress = false;
|
|
this.isBelow = true;
|
|
this.isBelow = true;
|
|
this.isAbove = false;
|
|
this.isAbove = false;
|
|
|
|
+
|
|
|
|
+ props.debug && console.log("init ", props.name);
|
|
}
|
|
}
|
|
static propTypes = Viewer.propTypes;
|
|
static propTypes = Viewer.propTypes;
|
|
componentWillUnmount() {
|
|
componentWillUnmount() {
|
|
- console.error("remove-timeline");
|
|
|
|
|
|
+ this.props.debug && console.warn("remove-timeline");
|
|
if (this.timeline) {
|
|
if (this.timeline) {
|
|
this.timeline.kill(true);
|
|
this.timeline.kill(true);
|
|
}
|
|
}
|
|
@@ -136,6 +138,21 @@ class ViewerInner extends Component {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.sequence.push(img);
|
|
this.sequence.push(img);
|
|
|
|
+ img.onerror = () => {
|
|
|
|
+ var timeStamp = Math.floor(Date.now() * Math.random())
|
|
|
|
+ .toString()
|
|
|
|
+ .substring(0, 8);
|
|
|
|
+ img.retried < 2
|
|
|
|
+ ? setTimeout(() => {
|
|
|
|
+ img.src = img.ogSrc + "?" + timeStamp;
|
|
|
|
+ }, 80)
|
|
|
|
+ : img.retried < 3 &&
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ img.src = img.ogSrc.slice(0, -4) + ".jpg?" + timeStamp;
|
|
|
|
+ }, 80),
|
|
|
|
+ img.retried++;
|
|
|
|
+ this.props.debug && console.log("img.retried", img.retried);
|
|
|
|
+ };
|
|
|
|
|
|
img.onload = () => {
|
|
img.onload = () => {
|
|
index === 1 && this.renderImageToCanvas(0);
|
|
index === 1 && this.renderImageToCanvas(0);
|
|
@@ -146,8 +163,10 @@ class ViewerInner extends Component {
|
|
) {
|
|
) {
|
|
this.poolNewFrames(index - 1);
|
|
this.poolNewFrames(index - 1);
|
|
}
|
|
}
|
|
- // var t = 100 - (this.frame / this.fullFrameCount) * 100 + "%";
|
|
|
|
- // this.loadingProgress.current.style.width
|
|
|
|
|
|
+ var t = 100 - (this.frame / this.fullFrameCount) * 100 + "%";
|
|
|
|
+ if (this.preProcessingRef.current) {
|
|
|
|
+ this.preProcessingRef.current.style.width = t;
|
|
|
|
+ }
|
|
this.loadedCount += 1;
|
|
this.loadedCount += 1;
|
|
if (this.loadedCount === parseFloat(this.props.frameCount) - 1) {
|
|
if (this.loadedCount === parseFloat(this.props.frameCount) - 1) {
|
|
this.loadingComplete();
|
|
this.loadingComplete();
|