bugfix
This commit is contained in:
@ -2,6 +2,7 @@ import { create } from "zustand";
|
||||
import { models } from "@/constant/models.ts";
|
||||
import { Vector3 } from "three";
|
||||
import { devtools } from "zustand/middleware";
|
||||
|
||||
// import { v4 as uuidv4 } from "uuid";
|
||||
export enum StickerType {
|
||||
text,
|
||||
@ -10,7 +11,7 @@ export enum StickerType {
|
||||
|
||||
export interface DecalSticker {
|
||||
id: string;
|
||||
postion: Vector3;
|
||||
position: Vector3;
|
||||
text?: string;
|
||||
url: string;
|
||||
scale: number;
|
||||
@ -38,7 +39,7 @@ interface ModelState {
|
||||
|
||||
decals: DecalSticker[];
|
||||
activeDecal?: string;
|
||||
setDecalPositon: (id: string, postion: Vector3) => void;
|
||||
setDecalPosition: (id: string, position: Vector3) => void;
|
||||
setDecals: (decals: DecalSticker[]) => void;
|
||||
setDecalScale: (id: string, scale: number) => void;
|
||||
setActiveDecal: (decalId: string) => void;
|
||||
@ -93,13 +94,13 @@ const useModelStore = create<ModelState>()(
|
||||
|
||||
decals: [],
|
||||
activeDecal: undefined,
|
||||
setDecalPositon: (id: string, postion: Vector3) =>
|
||||
setDecalPosition: (id: string, position: Vector3) =>
|
||||
set((state) => {
|
||||
const _decals = state.decals.map((el) => {
|
||||
if (el.id === id) {
|
||||
return {
|
||||
...el,
|
||||
postion,
|
||||
position,
|
||||
};
|
||||
} else {
|
||||
return el;
|
||||
|
Reference in New Issue
Block a user