|
@@ -7,8 +7,8 @@ import HotIcon from '@/components/HotIcon'
|
|
|
import { HotSpot, Krpano, VideoScene, videoSceneModel, View } from '@dage/krpano'
|
|
|
|
|
|
window.draggbleHotspotEvent = (ath: number, atv: number) => {
|
|
|
- console.log(`ath: ${ath}, atv: ${atv}`);
|
|
|
-};
|
|
|
+ console.log(`ath: ${ath}, atv: ${atv}`)
|
|
|
+}
|
|
|
|
|
|
function PanoVideo() {
|
|
|
// 0为 第一种模式的热点 其他为第二种
|
|
@@ -21,70 +21,75 @@ function PanoVideo() {
|
|
|
}, [ind])
|
|
|
|
|
|
const onReady = () => {
|
|
|
- window.ReactKrpanoActionProxy?.krpanoRenderer?.call("set(control.dragging, false);")
|
|
|
+ window.ReactKrpanoActionProxy?.krpanoRenderer?.call('set(control.dragging, false);')
|
|
|
}
|
|
|
|
|
|
- return <>
|
|
|
- <Krpano className={styles.PanoVideo} currentScene='scene1' onReady={onReady}>
|
|
|
- <VideoScene name='scene1'
|
|
|
- videointerfaceXmlUrl="/skin/videointerface.xml"
|
|
|
- videoplayerUrl="/plugins/videoplayer.js"
|
|
|
- sourceList={[
|
|
|
- {
|
|
|
- res: "2000x1000",
|
|
|
- url: baseURL + "/pano/1.mp4",
|
|
|
- poster: "",
|
|
|
- },
|
|
|
- ]}
|
|
|
- playRes="2000x1000"
|
|
|
- onVisibility={() => {
|
|
|
- if (document.visibilityState === "visible") {
|
|
|
- videoSceneModel.play();
|
|
|
- }
|
|
|
- }}
|
|
|
- >
|
|
|
- <View
|
|
|
- hlookat={0}
|
|
|
- vlookat={0}
|
|
|
- fovType="MFOV"
|
|
|
- fov={100}
|
|
|
- maxPixelZoom={2}
|
|
|
- fovMin={70}
|
|
|
- fovMax={140}
|
|
|
- limitView="auto"
|
|
|
- />
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <Krpano className={styles.PanoVideo} currentScene='scene1' onReady={onReady}>
|
|
|
+ <VideoScene
|
|
|
+ name='scene1'
|
|
|
+ videointerfaceXmlUrl='/skin/videointerface.xml'
|
|
|
+ videoplayerUrl='/plugins/videoplayer.js'
|
|
|
+ sourceList={[
|
|
|
+ {
|
|
|
+ res: '2000x1000',
|
|
|
+ url: baseURL + '/pano/1.mp4',
|
|
|
+ poster: ''
|
|
|
+ }
|
|
|
+ ]}
|
|
|
+ playRes='2000x1000'
|
|
|
+ onVisibility={() => {
|
|
|
+ if (document.visibilityState === 'visible') {
|
|
|
+ videoSceneModel.play()
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <View
|
|
|
+ hlookat={0}
|
|
|
+ vlookat={0}
|
|
|
+ fovType='MFOV'
|
|
|
+ fov={100}
|
|
|
+ maxPixelZoom={2}
|
|
|
+ fovMin={70}
|
|
|
+ fovMax={140}
|
|
|
+ limitView='auto'
|
|
|
+ />
|
|
|
|
|
|
- {myData.visit.hot.map((item, index) => (
|
|
|
- // 热点图标
|
|
|
- <HotSpot
|
|
|
- key={index}
|
|
|
- type="text"
|
|
|
- name={item.name}
|
|
|
- atv={item.atv}
|
|
|
- ath={item.ath}
|
|
|
- edge="top"
|
|
|
- distorted={true}
|
|
|
- scale={item.size}
|
|
|
- bg={false}
|
|
|
- onOver={() => setActiveIdx(index)}
|
|
|
- onOut={() => setActiveIdx(-1)}
|
|
|
- onClick={() => setInd(index)}
|
|
|
- >
|
|
|
- <HotIcon index={index}
|
|
|
- isHoverAc={activeIdx === index}
|
|
|
- hoverSrc={item.hoverSrc}
|
|
|
- />
|
|
|
- </HotSpot>
|
|
|
- ))}
|
|
|
- </VideoScene>
|
|
|
- </Krpano>
|
|
|
+ {myData.visit.hot.map((item, index) => (
|
|
|
+ // 热点图标
|
|
|
+ <HotSpot
|
|
|
+ key={index}
|
|
|
+ type='text'
|
|
|
+ name={item.name}
|
|
|
+ atv={item.atv}
|
|
|
+ ath={item.ath}
|
|
|
+ edge='top'
|
|
|
+ distorted={true}
|
|
|
+ scale={item.size}
|
|
|
+ bg={false}
|
|
|
+ onOver={() => setActiveIdx(index)}
|
|
|
+ onOut={() => setActiveIdx(-1)}
|
|
|
+ onClick={() => setInd(index)}
|
|
|
+ >
|
|
|
+ <HotIcon
|
|
|
+ index={index}
|
|
|
+ isHoverAc={activeIdx === index}
|
|
|
+ hoverSrc={item.hoverSrc}
|
|
|
+ panoWidth='113px'
|
|
|
+ />
|
|
|
+ </HotSpot>
|
|
|
+ ))}
|
|
|
+ </VideoScene>
|
|
|
+ </Krpano>
|
|
|
|
|
|
- {ind === -1 ? null : ind === 0 ? (
|
|
|
- <Hot1 data={data} closeFu={() => setInd(-1)} />
|
|
|
- ) : (
|
|
|
- <Hot2 data={data} closeFu={() => setInd(-1)} name={myData.visit.hot[ind].name} />
|
|
|
- )}
|
|
|
- </>
|
|
|
+ {ind === -1 ? null : ind === 0 ? (
|
|
|
+ <Hot1 data={data} closeFu={() => setInd(-1)} />
|
|
|
+ ) : (
|
|
|
+ <Hot2 data={data} closeFu={() => setInd(-1)} name={myData.visit.hot[ind].name} />
|
|
|
+ )}
|
|
|
+ </>
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
const MemoPanoVideo = React.memo(PanoVideo)
|