shaogen1995 1 year ago
parent
commit
5bda6244ea

+ 9 - 11
code/src/components/KrpanoCom/index.tsx

@@ -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}

+ 1 - 1
code/src/pages/B1Village/index.tsx

@@ -30,6 +30,7 @@ function B1Village() {
     );
   }, [uId, villageData]);
 
+
   //当前村落的 信息
   const curVillage = useMemo(
     () =>
@@ -127,7 +128,6 @@ function B1Village() {
       {/* 全景相关 */}
       {curScene ? (
         <KrpanoCom
-          scale={0.3}
           curScene={curScene}
           curVillage={curVillage}
           infoInd={infoInd}

+ 0 - 1
code/src/pages/B1VillageM/index.tsx

@@ -131,7 +131,6 @@ function B1VillageM() {
       {/* 全景相关 */}
       {curScene ? (
         <KrpanoCom
-          scale={0.5}
           curScene={curScene}
           curVillage={curVillage}
           infoInd={infoInd}

+ 2 - 0
code/src/types/api/layot.d.ts

@@ -61,6 +61,8 @@ export type Tab2InfoType = {
   label: string;
   atv: number;
   ath: number;
+  sizePc:number
+  sizeM:number
   txt: string;
   architecId: string;
   zhen: number;

File diff suppressed because it is too large
+ 1642 - 156
静态资源/web/staticData/dataTemp.js