Add floorName property to Floor interface and update related components for floor creation
This commit is contained in:
@@ -93,6 +93,7 @@ function FloorCreator() {
|
|||||||
if (tempPoints.length > 2 && isCreating && pointIntersects.object.uuid === tempPoints[0].pointUuid) {
|
if (tempPoints.length > 2 && isCreating && pointIntersects.object.uuid === tempPoints[0].pointUuid) {
|
||||||
const floor: Floor = {
|
const floor: Floor = {
|
||||||
floorUuid: THREE.MathUtils.generateUUID(),
|
floorUuid: THREE.MathUtils.generateUUID(),
|
||||||
|
floorName: "Floor",
|
||||||
points: tempPoints,
|
points: tempPoints,
|
||||||
topMaterial,
|
topMaterial,
|
||||||
sideMaterial,
|
sideMaterial,
|
||||||
@@ -144,6 +145,7 @@ function FloorCreator() {
|
|||||||
if (tempPoints.length >= 3) {
|
if (tempPoints.length >= 3) {
|
||||||
const floor: Floor = {
|
const floor: Floor = {
|
||||||
floorUuid: THREE.MathUtils.generateUUID(),
|
floorUuid: THREE.MathUtils.generateUUID(),
|
||||||
|
floorName: "Floor",
|
||||||
points: tempPoints,
|
points: tempPoints,
|
||||||
topMaterial,
|
topMaterial,
|
||||||
sideMaterial,
|
sideMaterial,
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ function ReferenceFloor({ tempPoints }: Readonly<ReferenceFloorProps>) {
|
|||||||
|
|
||||||
setTempFloor({
|
setTempFloor({
|
||||||
floorUuid: 'temp-floor',
|
floorUuid: 'temp-floor',
|
||||||
|
floorName: 'temp-floor',
|
||||||
points: floorPoints,
|
points: floorPoints,
|
||||||
topMaterial: 'default',
|
topMaterial: 'default',
|
||||||
sideMaterial: 'default',
|
sideMaterial: 'default',
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ interface FloorStore {
|
|||||||
setFloors: (floors: Floor[]) => void;
|
setFloors: (floors: Floor[]) => void;
|
||||||
addFloor: (floor: Floor) => void;
|
addFloor: (floor: Floor) => void;
|
||||||
updateFloor: (uuid: string, updated: Partial<Floor>) => Floor | undefined;
|
updateFloor: (uuid: string, updated: Partial<Floor>) => Floor | undefined;
|
||||||
|
setFloorName: (uuid: string, name: string) => void;
|
||||||
removeFloor: (uuid: string) => void;
|
removeFloor: (uuid: string) => void;
|
||||||
removePoint: (pointUuid: string) => { removedFloors: Floor[], updatedFloors: Floor[] };
|
removePoint: (pointUuid: string) => { removedFloors: Floor[], updatedFloors: Floor[] };
|
||||||
removeFloorByPoints: (Points: [Point, Point]) => { removedFloors: Floor[], updatedFloors: Floor[] };
|
removeFloorByPoints: (Points: [Point, Point]) => { removedFloors: Floor[], updatedFloors: Floor[] };
|
||||||
@@ -57,6 +58,13 @@ export const createFloorStore = () => {
|
|||||||
return updatedFloor;
|
return updatedFloor;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setFloorName: (uuid, name) => set(state => {
|
||||||
|
const floor = state.floors.find(f => f.floorUuid === uuid);
|
||||||
|
if (floor) {
|
||||||
|
floor.floorName = name;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
removeFloor: (uuid) => set(state => {
|
removeFloor: (uuid) => set(state => {
|
||||||
state.floors = state.floors.filter(f => f.floorUuid !== uuid);
|
state.floors = state.floors.filter(f => f.floorUuid !== uuid);
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ interface ZoneStore {
|
|||||||
setZones: (zones: Zone[]) => void;
|
setZones: (zones: Zone[]) => void;
|
||||||
addZone: (zone: Zone) => void;
|
addZone: (zone: Zone) => void;
|
||||||
updateZone: (uuid: string, updated: Partial<Zone>) => void;
|
updateZone: (uuid: string, updated: Partial<Zone>) => void;
|
||||||
|
setZoneName: (uuid: string, name: string) => void;
|
||||||
removeZone: (uuid: string) => void;
|
removeZone: (uuid: string) => void;
|
||||||
removePointFromZones: (pointUuid: string) => void;
|
removePointFromZones: (pointUuid: string) => void;
|
||||||
clearZones: () => void;
|
clearZones: () => void;
|
||||||
@@ -35,6 +36,13 @@ export const createZoneStore = () => {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
setZoneName: (uuid, name) => set(state => {
|
||||||
|
const zone = state.zones.find(z => z.zoneUuid === uuid);
|
||||||
|
if (zone) {
|
||||||
|
zone.zoneName = name;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
removeZone: (uuid) => set(state => {
|
removeZone: (uuid) => set(state => {
|
||||||
state.zones = state.zones.filter(z => z.zoneUuid !== uuid);
|
state.zones = state.zones.filter(z => z.zoneUuid !== uuid);
|
||||||
}),
|
}),
|
||||||
|
|||||||
1
app/src/types/builderTypes.d.ts
vendored
1
app/src/types/builderTypes.d.ts
vendored
@@ -113,6 +113,7 @@ type Walls = Wall[];
|
|||||||
|
|
||||||
interface Floor {
|
interface Floor {
|
||||||
floorUuid: string;
|
floorUuid: string;
|
||||||
|
floorName: string;
|
||||||
points: Point[];
|
points: Point[];
|
||||||
sideMaterial: string;
|
sideMaterial: string;
|
||||||
topMaterial: string;
|
topMaterial: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user