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