|
@@ -1,27 +1,25 @@
|
|
|
-import React, { useState } from "react";
|
|
|
+import React, { useCallback, useState } from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
import { HotSpot, Krpano } from "@dage/krpano";
|
|
|
import { Tab2InfoType } from "@/types";
|
|
|
import classNames from "classnames";
|
|
|
-import { modelUrl } from "@/utils/history";
|
|
|
+import { isMobileFu, modelUrl } from "@/utils/history";
|
|
|
|
|
|
type Props = {
|
|
|
curScene: string;
|
|
|
curVillage: Tab2InfoType[];
|
|
|
infoInd: number;
|
|
|
setInfoInd: (index: number) => void;
|
|
|
- scale: number;
|
|
|
};
|
|
|
|
|
|
-function KrpanoCom({
|
|
|
- curScene,
|
|
|
- curVillage,
|
|
|
- infoInd,
|
|
|
- setInfoInd,
|
|
|
- scale,
|
|
|
-}: Props) {
|
|
|
+function KrpanoCom({ curScene, curVillage, infoInd, setInfoInd }: Props) {
|
|
|
const [hotspotHoverName, setHotspotHoverName] = useState("");
|
|
|
|
|
|
+ // 标签大小
|
|
|
+ const sizeRes = useCallback((item: Tab2InfoType) => {
|
|
|
+ if (isMobileFu()) return item.sizeM || 0.5;
|
|
|
+ else return item.sizePc || 0.3;
|
|
|
+ }, []);
|
|
|
return (
|
|
|
<Krpano
|
|
|
className={styles.villageKrpano}
|
|
@@ -38,7 +36,7 @@ function KrpanoCom({
|
|
|
type="text"
|
|
|
atv={item.atv}
|
|
|
ath={item.ath}
|
|
|
- scale={scale}
|
|
|
+ scale={sizeRes(item)}
|
|
|
edge="top"
|
|
|
bg={false}
|
|
|
distorted={true}
|