usecase thumbnail bug fix
This commit is contained in:
@@ -15,6 +15,7 @@ import { useLoadingProgress } from "../../store/builder/store";
|
||||
import { useSocketStore } from "../../store/socket/useSocketStore";
|
||||
import { Color, SRGBColorSpace } from "three";
|
||||
import { compressImage } from "../../utils/compressImage";
|
||||
import { ALPHA_ORG } from "../../pages/Dashboard";
|
||||
|
||||
export default function Scene({ layout }: { readonly layout: "Main Layout" | "Comparison Layout" }) {
|
||||
const map = useMemo(
|
||||
@@ -27,7 +28,7 @@ export default function Scene({ layout }: { readonly layout: "Main Layout" | "Co
|
||||
],
|
||||
[]
|
||||
);
|
||||
const { assetStore } = useSceneContext();
|
||||
const { assetStore, layoutType } = useSceneContext();
|
||||
const { assets } = assetStore();
|
||||
const { userId, organization } = getUserData();
|
||||
const { projectId } = useParams();
|
||||
@@ -38,7 +39,7 @@ export default function Scene({ layout }: { readonly layout: "Main Layout" | "Co
|
||||
useEffect(() => {
|
||||
if (!projectId || loadingProgress !== 0) return;
|
||||
const canvas = document.getElementById("sceneCanvas")?.getElementsByTagName("canvas")[0];
|
||||
if (!canvas) return;
|
||||
if (!canvas || !(layoutType === "default" || (layoutType === "useCase" && organization === ALPHA_ORG))) return;
|
||||
compressImage(canvas.toDataURL("image/png")).then((screenshotDataUrl) => {
|
||||
const updateProjects = {
|
||||
projectId,
|
||||
@@ -51,7 +52,7 @@ export default function Scene({ layout }: { readonly layout: "Main Layout" | "Co
|
||||
}
|
||||
});
|
||||
// eslint-disable-next-line
|
||||
}, [activeModule, assets, loadingProgress, projectId]);
|
||||
}, [activeModule, assets, loadingProgress, projectId, layoutType]);
|
||||
|
||||
return (
|
||||
<KeyboardControls map={map}>
|
||||
|
||||
Reference in New Issue
Block a user