|
@@ -1,14 +1,169 @@
|
|
|
import { useMemo, useState } from "react";
|
|
|
import classnames from "classnames";
|
|
|
-import { Krpano, ROTATE_DIRECTION, Scene, ZOOM_ACTION } from "@dage/krpano";
|
|
|
-import { ALL_SCENES, MENUS } from "./constants";
|
|
|
+import {
|
|
|
+ HotSpot,
|
|
|
+ Krpano,
|
|
|
+ ROTATE_DIRECTION,
|
|
|
+ Scene,
|
|
|
+ View,
|
|
|
+ ZOOM_ACTION,
|
|
|
+} from "@dage/krpano";
|
|
|
import { MouseHoldView } from "@/components";
|
|
|
+import { ISceneProps } from "@/types";
|
|
|
import "./index.scss";
|
|
|
|
|
|
+const URL = "https://houseoss.4dkankan.com/project/leifeng-transfer";
|
|
|
+
|
|
|
export default function HomePage() {
|
|
|
const [currentMenu, setCurrentMenu] = useState(0);
|
|
|
- const sceneList = useMemo(() => MENUS[currentMenu].scenes, [currentMenu]);
|
|
|
- const [currentScene, setCurrentScene] = useState(sceneList[0].name);
|
|
|
+ const [currentScene, setCurrentScene] = useState("center1");
|
|
|
+ const CENTER_SCENE_LIST = useMemo<ISceneProps[]>(
|
|
|
+ () => [
|
|
|
+ {
|
|
|
+ name: "center1",
|
|
|
+ thumbUrl: URL + "/panos/center1.tiles/thumb.jpg",
|
|
|
+ previewUrl: URL + "/panos/center1.tiles/preview.jpg",
|
|
|
+ imageTagAttributes: {
|
|
|
+ type: "cube",
|
|
|
+ tileSize: 512,
|
|
|
+ multires: true,
|
|
|
+ },
|
|
|
+ images: [
|
|
|
+ {
|
|
|
+ tiledImageWidth: 2624,
|
|
|
+ tiledImageHeight: 2624,
|
|
|
+ url: URL + "/panos/center1.tiles/%s/l3/%v/l3_%s_%v_%h.jpg",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tiledImageWidth: 1280,
|
|
|
+ tiledImageHeight: 1280,
|
|
|
+ url: URL + "/panos/center1.tiles/%s/l2/%v/l2_%s_%v_%h.jpg",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tiledImageWidth: 640,
|
|
|
+ tiledImageHeight: 640,
|
|
|
+ url: URL + "/panos/center1.tiles/%s/l1/%v/l1_%s_%v_%h.jpg",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ children: (
|
|
|
+ <>
|
|
|
+ <View
|
|
|
+ hlookat={0}
|
|
|
+ vlookat={0}
|
|
|
+ fovType="MFOV"
|
|
|
+ fov={120}
|
|
|
+ maxPixelZoom={2}
|
|
|
+ fovMin={70}
|
|
|
+ fovMax={140}
|
|
|
+ limitView="auto"
|
|
|
+ />
|
|
|
+
|
|
|
+ <HotSpot
|
|
|
+ name="hotspot1"
|
|
|
+ url="/images/guide.png"
|
|
|
+ atv={5}
|
|
|
+ scale={0.5}
|
|
|
+ onClick={() => setCurrentScene("center2")}
|
|
|
+ />
|
|
|
+ </>
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "center2",
|
|
|
+ thumbUrl: URL + "/panos/center2.tiles/thumb.jpg",
|
|
|
+ previewUrl: URL + "/panos/center2.tiles/preview.jpg",
|
|
|
+ imageTagAttributes: {
|
|
|
+ type: "cube",
|
|
|
+ tileSize: 512,
|
|
|
+ multires: true,
|
|
|
+ },
|
|
|
+ images: [
|
|
|
+ {
|
|
|
+ tiledImageWidth: 2624,
|
|
|
+ tiledImageHeight: 2624,
|
|
|
+ url: URL + "/panos/center2.tiles/%s/l3/%v/l3_%s_%v_%h.jpg",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tiledImageWidth: 1280,
|
|
|
+ tiledImageHeight: 1280,
|
|
|
+ url: URL + "/panos/center2.tiles/%s/l2/%v/l2_%s_%v_%h.jpg",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tiledImageWidth: 640,
|
|
|
+ tiledImageHeight: 640,
|
|
|
+ url: URL + "/panos/center2.tiles/%s/l1/%v/l1_%s_%v_%h.jpg",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ children: (
|
|
|
+ <View
|
|
|
+ hlookat={0}
|
|
|
+ vlookat={0}
|
|
|
+ fovType="MFOV"
|
|
|
+ fov={120}
|
|
|
+ maxPixelZoom={2}
|
|
|
+ fovMin={70}
|
|
|
+ fovMax={140}
|
|
|
+ limitView="auto"
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ []
|
|
|
+ );
|
|
|
+ const SERVICE_SCENE_LIST = useMemo<ISceneProps[]>(
|
|
|
+ () => [
|
|
|
+ {
|
|
|
+ name: "service1",
|
|
|
+ thumbUrl: URL + "/panos/service1.tiles/thumb.jpg",
|
|
|
+ previewUrl: URL + "/panos/service1.tiles/preview.jpg",
|
|
|
+ imageTagAttributes: {
|
|
|
+ type: "cube",
|
|
|
+ tileSize: 512,
|
|
|
+ multires: true,
|
|
|
+ },
|
|
|
+ images: [
|
|
|
+ {
|
|
|
+ tiledImageWidth: 2624,
|
|
|
+ tiledImageHeight: 2624,
|
|
|
+ url: URL + "/panos/service1.tiles/%s/l3/%v/l3_%s_%v_%h.jpg",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tiledImageWidth: 1280,
|
|
|
+ tiledImageHeight: 1280,
|
|
|
+ url: URL + "/panos/service1.tiles/%s/l2/%v/l2_%s_%v_%h.jpg",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tiledImageWidth: 640,
|
|
|
+ tiledImageHeight: 640,
|
|
|
+ url: URL + "/panos/service1.tiles/%s/l1/%v/l1_%s_%v_%h.jpg",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ children: (
|
|
|
+ <View
|
|
|
+ hlookat={0}
|
|
|
+ vlookat={0}
|
|
|
+ fovType="MFOV"
|
|
|
+ fov={120}
|
|
|
+ maxPixelZoom={2}
|
|
|
+ fovMin={70}
|
|
|
+ fovMax={140}
|
|
|
+ limitView="auto"
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ []
|
|
|
+ );
|
|
|
+ const MENUS = [
|
|
|
+ {
|
|
|
+ title: "长沙国防教育馆",
|
|
|
+ scenes: CENTER_SCENE_LIST,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "游客服务中心",
|
|
|
+ scenes: SERVICE_SCENE_LIST,
|
|
|
+ },
|
|
|
+ ];
|
|
|
|
|
|
const handleSceneClick = (name: string) => {
|
|
|
setCurrentScene(name);
|
|
@@ -33,7 +188,7 @@ export default function HomePage() {
|
|
|
currentScene={currentScene}
|
|
|
passQueryParameters={true}
|
|
|
>
|
|
|
- {ALL_SCENES.map((sc) => (
|
|
|
+ {[...CENTER_SCENE_LIST, ...SERVICE_SCENE_LIST].map((sc) => (
|
|
|
<Scene key={sc.name} {...sc} />
|
|
|
))}
|
|
|
</Krpano>
|
|
@@ -55,7 +210,7 @@ export default function HomePage() {
|
|
|
</div>
|
|
|
|
|
|
<div className="scene-panel__list">
|
|
|
- {sceneList.map((sc) => (
|
|
|
+ {MENUS[currentMenu].scenes.map((sc) => (
|
|
|
<div
|
|
|
key={sc.name}
|
|
|
className={`scene-panel__list__item ${
|