change global store name

This commit is contained in:
DefectingCat
2023-06-25 14:35:37 +08:00
parent 56fed3cf38
commit 27a22bd779
2 changed files with 5 additions and 5 deletions

View File

@ -2,7 +2,7 @@
import { Canvas, useFrame, useLoader, useThree } from '@react-three/fiber'; import { Canvas, useFrame, useLoader, useThree } from '@react-three/fiber';
import { useEffect, useRef } from 'react'; import { useEffect, useRef } from 'react';
import useMainStore from 'store'; import useStore from 'store';
import * as THREE from 'three'; import * as THREE from 'three';
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader'; import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
@ -15,7 +15,7 @@ const rotationX = 0.18;
const Model = () => { const Model = () => {
const mixer = useRef<THREE.AnimationMixer | null>(null); const mixer = useRef<THREE.AnimationMixer | null>(null);
const toggleLoading = useMainStore((state) => state.toggleLoading); const toggleLoading = useStore((state) => state.toggleLoading);
const camera = useThree((state) => state.camera); const camera = useThree((state) => state.camera);
const gltf = useLoader( const gltf = useLoader(
@ -79,7 +79,7 @@ const Model = () => {
}; };
const HomeModel = () => { const HomeModel = () => {
const modelLoading = useMainStore((state) => state.modelLoading); const modelLoading = useStore((state) => state.modelLoading);
return ( return (
<> <>

View File

@ -5,7 +5,7 @@ interface MainStore {
toggleLoading: (loaded: boolean) => void; toggleLoading: (loaded: boolean) => void;
} }
const useMainStore = create<MainStore>()((set) => ({ const useStore = create<MainStore>()((set) => ({
modelLoading: true, modelLoading: true,
toggleLoading: (loaded) => toggleLoading: (loaded) =>
set(() => ({ set(() => ({
@ -13,4 +13,4 @@ const useMainStore = create<MainStore>()((set) => ({
})), })),
})); }));
export default useMainStore; export default useStore;