|
@@ -1,8 +1,11 @@
|
|
import { Component, createRef } from "react";
|
|
import { Component, createRef } from "react";
|
|
import PropTypes from "prop-types";
|
|
import PropTypes from "prop-types";
|
|
import { gsap, ScrollTrigger } from "gsap/all";
|
|
import { gsap, ScrollTrigger } from "gsap/all";
|
|
|
|
+import LazyLoad from "react-lazyload";
|
|
import { css } from "@emotion/react";
|
|
import { css } from "@emotion/react";
|
|
|
|
+
|
|
const isDebug = Number(import.meta.env.VITE_APP_DEBUG) === 1;
|
|
const isDebug = Number(import.meta.env.VITE_APP_DEBUG) === 1;
|
|
|
|
+
|
|
console.log("isDebug", isDebug);
|
|
console.log("isDebug", isDebug);
|
|
export default class Viewer extends Component {
|
|
export default class Viewer extends Component {
|
|
constructor() {
|
|
constructor() {
|
|
@@ -81,8 +84,8 @@ export default class Viewer extends Component {
|
|
if (!this.exitTimeline && this.props.exitTween) {
|
|
if (!this.exitTimeline && this.props.exitTween) {
|
|
this.initializeExitTween();
|
|
this.initializeExitTween();
|
|
}
|
|
}
|
|
- ScrollTrigger.getAll().forEach((ST) => ST.refresh(true));
|
|
|
|
- console.error("ScrollTrigger.getAll()", ScrollTrigger.getAll());
|
|
|
|
|
|
+
|
|
|
|
+ ScrollTrigger.refresh();
|
|
}
|
|
}
|
|
|
|
|
|
loadImage(index) {
|
|
loadImage(index) {
|
|
@@ -105,6 +108,7 @@ export default class Viewer extends Component {
|
|
this.poolNewFrames(index - 1);
|
|
this.poolNewFrames(index - 1);
|
|
}
|
|
}
|
|
// var t = 100 - (this.frame / this.fullFrameCount) * 100 + "%";
|
|
// var t = 100 - (this.frame / this.fullFrameCount) * 100 + "%";
|
|
|
|
+ // this.loadingProgress.current.style.width
|
|
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();
|
|
@@ -180,7 +184,6 @@ export default class Viewer extends Component {
|
|
onEnter: () => {
|
|
onEnter: () => {
|
|
// closeLoading();
|
|
// closeLoading();
|
|
this.isAbove = false;
|
|
this.isAbove = false;
|
|
- console.log("onEnter");
|
|
|
|
console.log(this.props.path, "onEnter");
|
|
console.log(this.props.path, "onEnter");
|
|
},
|
|
},
|
|
onEnterBack: () => {
|
|
onEnterBack: () => {
|
|
@@ -220,14 +223,13 @@ export default class Viewer extends Component {
|
|
initializeEnterTween() {
|
|
initializeEnterTween() {
|
|
const duration = this.props.enterTween.duration || 1;
|
|
const duration = this.props.enterTween.duration || 1;
|
|
let openPin = false;
|
|
let openPin = false;
|
|
- console.warn("this.props.enterTween", this.props.enterTween);
|
|
|
|
|
|
+ console.warn("this.props.enterTween", duration, this.props.enterTween);
|
|
gsap.set(this.viewerRef.current, {
|
|
gsap.set(this.viewerRef.current, {
|
|
yPercent: -100 * duration,
|
|
yPercent: -100 * duration,
|
|
});
|
|
});
|
|
if (void 0 !== this.props.enterTween.pin) {
|
|
if (void 0 !== this.props.enterTween.pin) {
|
|
openPin = this.props.enterTween.pin;
|
|
openPin = this.props.enterTween.pin;
|
|
}
|
|
}
|
|
-
|
|
|
|
this.enterTimeline = gsap.timeline({
|
|
this.enterTimeline = gsap.timeline({
|
|
scrollTrigger: {
|
|
scrollTrigger: {
|
|
trigger: this.viewerRef.current,
|
|
trigger: this.viewerRef.current,
|
|
@@ -294,6 +296,17 @@ export default class Viewer extends Component {
|
|
)
|
|
)
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+ if (this.props.exitTween.to) {
|
|
|
|
+ this.exitTimeline.to(
|
|
|
|
+ this.viewerRef.current,
|
|
|
|
+ Object.assign(
|
|
|
|
+ {
|
|
|
|
+ ease: "none",
|
|
|
|
+ },
|
|
|
|
+ this.props.exitTween.to
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
poolNewFrames(index) {
|
|
poolNewFrames(index) {
|