mirror of
https://github.com/Lapikud/tipilan.git
synced 2026-03-23 13:24:21 +00:00
Set entrance hall as default
This commit is contained in:
@@ -20,9 +20,9 @@ export default function Expo() {
|
|||||||
const [mousePosition, setMousePosition] = useState({ x: 0, y: 0 });
|
const [mousePosition, setMousePosition] = useState({ x: 0, y: 0 });
|
||||||
const [showDividers, setShowDividers] = useState<boolean>(true);
|
const [showDividers, setShowDividers] = useState<boolean>(true);
|
||||||
const [currentView, setCurrentView] = useState<"tudengimaja" | "fuajee">(
|
const [currentView, setCurrentView] = useState<"tudengimaja" | "fuajee">(
|
||||||
"tudengimaja",
|
"fuajee",
|
||||||
);
|
);
|
||||||
const currentViewRef = useRef<"tudengimaja" | "fuajee">("tudengimaja");
|
const currentViewRef = useRef<"tudengimaja" | "fuajee">("fuajee");
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
|
|
||||||
// Define room names with translations
|
// Define room names with translations
|
||||||
@@ -103,9 +103,9 @@ export default function Expo() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Position camera for isometric view (default to tudengimaja)
|
// Position camera for isometric view (default to fuajee)
|
||||||
camera.position.copy(cameraPositions.tudengimaja.position);
|
camera.position.copy(cameraPositions.fuajee.position);
|
||||||
camera.lookAt(cameraPositions.tudengimaja.lookAt);
|
camera.lookAt(cameraPositions.fuajee.lookAt);
|
||||||
|
|
||||||
// Renderer
|
// Renderer
|
||||||
const renderer = new THREE.WebGLRenderer({ antialias: true });
|
const renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||||
@@ -319,6 +319,9 @@ export default function Expo() {
|
|||||||
// Store tudengimaja objects (rooms, ground, dividers)
|
// Store tudengimaja objects (rooms, ground, dividers)
|
||||||
tudengimajaObjects = [...rooms, ground, ground2, ...dividers];
|
tudengimajaObjects = [...rooms, ground, ground2, ...dividers];
|
||||||
|
|
||||||
|
// Set initial visibility for fuajee default view
|
||||||
|
tudengimajaObjects.forEach((obj) => (obj.visible = false));
|
||||||
|
|
||||||
// Load fuajee GLTF model
|
// Load fuajee GLTF model
|
||||||
const loader = new GLTFLoader();
|
const loader = new GLTFLoader();
|
||||||
loader.load(
|
loader.load(
|
||||||
@@ -327,7 +330,7 @@ export default function Expo() {
|
|||||||
fuajeeMesh = gltf.scene;
|
fuajeeMesh = gltf.scene;
|
||||||
fuajeeMesh.position.set(-1.5, 1, 0);
|
fuajeeMesh.position.set(-1.5, 1, 0);
|
||||||
fuajeeMesh.scale.set(0.3, 0.3, 0.3);
|
fuajeeMesh.scale.set(0.3, 0.3, 0.3);
|
||||||
fuajeeMesh.visible = false; // Initially hidden
|
fuajeeMesh.visible = true; // Initially visible for fuajee default
|
||||||
|
|
||||||
// Traverse the model to collect meshes
|
// Traverse the model to collect meshes
|
||||||
fuajeeMesh.traverse((child) => {
|
fuajeeMesh.traverse((child) => {
|
||||||
@@ -342,6 +345,11 @@ export default function Expo() {
|
|||||||
|
|
||||||
// Create example rooms for fuajee after the model loads
|
// Create example rooms for fuajee after the model loads
|
||||||
createfuajeeRooms();
|
createfuajeeRooms();
|
||||||
|
|
||||||
|
// Set initial visibility for fuajee view
|
||||||
|
tudengimajaObjects.forEach((obj) => (obj.visible = false));
|
||||||
|
fuajeeMesh.visible = true;
|
||||||
|
fuajeeRooms.forEach((room) => (room.visible = true));
|
||||||
},
|
},
|
||||||
(progress) => {
|
(progress) => {
|
||||||
console.log(
|
console.log(
|
||||||
@@ -457,7 +465,7 @@ export default function Expo() {
|
|||||||
room.castShadow = true;
|
room.castShadow = true;
|
||||||
room.receiveShadow = true;
|
room.receiveShadow = true;
|
||||||
room.userData = { name: roomDef.name, originalColor: roomDef.color };
|
room.userData = { name: roomDef.name, originalColor: roomDef.color };
|
||||||
room.visible = false; // Initially hidden
|
room.visible = true; // Initially visible for fuajee default
|
||||||
|
|
||||||
scene.add(room);
|
scene.add(room);
|
||||||
fuajeeRooms.push(room);
|
fuajeeRooms.push(room);
|
||||||
@@ -890,7 +898,7 @@ export default function Expo() {
|
|||||||
{currentView === "fuajee" && (
|
{currentView === "fuajee" && (
|
||||||
<button
|
<button
|
||||||
onClick={() => handleViewSwitch("tudengimaja")}
|
onClick={() => handleViewSwitch("tudengimaja")}
|
||||||
className="group absolute left-4 bottom-4 p-4 md:p-6 transition-all duration-300 hover:scale-110 z-20 touch-manipulation min-h-[48px] min-w-[48px] flex items-center justify-center"
|
className="group absolute left-4 bottom-4 p-4 md:p-6 transition-all duration-300 hover:scale-110 z-20 touch-manipulation min-h-[48px] min-w-[48px] flex items-center justify-center cursor-pointer bg-[#1F5673]"
|
||||||
title="Switch to Tudengimaja"
|
title="Switch to Tudengimaja"
|
||||||
aria-label="Switch to Tudengimaja view"
|
aria-label="Switch to Tudengimaja view"
|
||||||
>
|
>
|
||||||
@@ -904,7 +912,7 @@ export default function Expo() {
|
|||||||
{currentView === "tudengimaja" && (
|
{currentView === "tudengimaja" && (
|
||||||
<button
|
<button
|
||||||
onClick={() => handleViewSwitch("fuajee")}
|
onClick={() => handleViewSwitch("fuajee")}
|
||||||
className="group absolute right-4 bottom-4 p-4 md:p-6 transition-all duration-300 hover:scale-110 z-20 touch-manipulation min-h-[48px] min-w-[48px] flex items-center justify-center"
|
className="group absolute right-4 bottom-4 p-4 md:p-6 transition-all duration-300 hover:scale-110 z-20 touch-manipulation min-h-[48px] min-w-[48px] flex items-center justify-center cursor-pointer bg-[#1F5673]"
|
||||||
title="Switch to Fuajee"
|
title="Switch to Fuajee"
|
||||||
aria-label="Switch to Fuajee view"
|
aria-label="Switch to Fuajee view"
|
||||||
>
|
>
|
||||||
@@ -917,7 +925,7 @@ export default function Expo() {
|
|||||||
{currentView === "tudengimaja" && (
|
{currentView === "tudengimaja" && (
|
||||||
<button
|
<button
|
||||||
onClick={() => setShowDividers(!showDividers)}
|
onClick={() => setShowDividers(!showDividers)}
|
||||||
className={`absolute top-2 right-2 px-3 py-2 bg-[#1F5673] text-white hover:bg-[#2A7A9B] ${vipnagorgialla.className} uppercase italic text-sm font-semibold flex items-center transition-colors shadow-lg z-10`}
|
className={`absolute top-2 right-2 px-3 py-2 bg-[#1F5673] text-white hover:bg-[#2A7A9B] ${vipnagorgialla.className} uppercase italic text-sm font-semibold flex items-center transition-colors shadow-lg z-10 cursor-pointer bg-`}
|
||||||
>
|
>
|
||||||
{showDividers ? (
|
{showDividers ? (
|
||||||
<EyeClosed className="w-6 h-6 mr-2" />
|
<EyeClosed className="w-6 h-6 mr-2" />
|
||||||
|
|||||||
Reference in New Issue
Block a user