hookehuyr

调整全景地图控制

...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
14 "dependencies": { 14 "dependencies": {
15 "@photo-sphere-viewer/core": "^5.2.0", 15 "@photo-sphere-viewer/core": "^5.2.0",
16 "@photo-sphere-viewer/gallery-plugin": "^5.2.0", 16 "@photo-sphere-viewer/gallery-plugin": "^5.2.0",
17 + "@photo-sphere-viewer/gyroscope-plugin": "^5.2.0",
17 "@photo-sphere-viewer/markers-plugin": "^5.2.0", 18 "@photo-sphere-viewer/markers-plugin": "^5.2.0",
19 + "@photo-sphere-viewer/stereo-plugin": "^5.2.0",
18 "@photo-sphere-viewer/virtual-tour-plugin": "^5.2.0", 20 "@photo-sphere-viewer/virtual-tour-plugin": "^5.2.0",
19 "@videojs-player/vue": "^1.0.0", 21 "@videojs-player/vue": "^1.0.0",
20 "@vitejs/plugin-legacy": "^1.8.2", 22 "@vitejs/plugin-legacy": "^1.8.2",
......
1 <!-- 1 <!--
2 * @Date: 2023-08-16 09:29:57 2 * @Date: 2023-08-16 09:29:57
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-08-17 09:55:35 4 + * @LastEditTime: 2023-08-17 13:53:41
5 * @FilePath: /map-demo/src/components/VRViewer/index.vue 5 * @FilePath: /map-demo/src/components/VRViewer/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
9 <div class="vr-viewer"> 9 <div class="vr-viewer">
10 <van-popup v-model:show="show_vr" position="right" :overlay="true" 10 <van-popup v-model:show="show_vr" position="right" :overlay="true"
11 :style="{ height: '100%', width: '100%', background: '#FFF' }"> 11 :style="{ height: '100%', width: '100%', background: '#FFF' }">
12 - <div class="vr" style="height: 90%;"> 12 + <!-- <div style="height: 10%;">
13 - <div id="viewer"></div>
14 - </div>
15 - <div style="height: 10%;">
16 <span @click="onClose">关闭</span> 13 <span @click="onClose">关闭</span>
14 + </div> -->
15 + <div class="vr" style="height: 100%;">
16 + <div id="viewer"></div>
17 </div> 17 </div>
18 </van-popup> 18 </van-popup>
19 </div> 19 </div>
...@@ -25,6 +25,8 @@ import { Viewer } from '@photo-sphere-viewer/core' // 引入插件 ...@@ -25,6 +25,8 @@ import { Viewer } from '@photo-sphere-viewer/core' // 引入插件
25 import { MarkersPlugin } from '@photo-sphere-viewer/markers-plugin'; 25 import { MarkersPlugin } from '@photo-sphere-viewer/markers-plugin';
26 import { VirtualTourPlugin } from '@photo-sphere-viewer/virtual-tour-plugin'; 26 import { VirtualTourPlugin } from '@photo-sphere-viewer/virtual-tour-plugin';
27 import { GalleryPlugin } from '@photo-sphere-viewer/gallery-plugin'; 27 import { GalleryPlugin } from '@photo-sphere-viewer/gallery-plugin';
28 +import { GyroscopePlugin } from '@photo-sphere-viewer/gyroscope-plugin';
29 +// import { StereoPlugin } from '@photo-sphere-viewer/stereo-plugin';
28 import '@photo-sphere-viewer/core/index.css' //引入CSS样式 30 import '@photo-sphere-viewer/core/index.css' //引入CSS样式
29 import '@photo-sphere-viewer/markers-plugin/index.css' 31 import '@photo-sphere-viewer/markers-plugin/index.css'
30 import '@photo-sphere-viewer/gallery-plugin/index.css' 32 import '@photo-sphere-viewer/gallery-plugin/index.css'
...@@ -116,6 +118,7 @@ export default { ...@@ -116,6 +118,7 @@ export default {
116 panorama: temp_img, 118 panorama: temp_img,
117 links: [ 119 links: [
118 { 120 {
121 + name: '2',
119 nodeId: '2', 122 nodeId: '2',
120 // position: { textureX: 2000, textureY: 1000 }, 123 // position: { textureX: 2000, textureY: 1000 },
121 position: { yaw: -300, pitch: 0 }, 124 position: { yaw: -300, pitch: 0 },
...@@ -123,7 +126,7 @@ export default { ...@@ -123,7 +126,7 @@ export default {
123 color: '#AEEEEE', 126 color: '#AEEEEE',
124 hoverColor: 0xaa5500, 127 hoverColor: 0xaa5500,
125 outlineColor: 0x000000, 128 outlineColor: 0x000000,
126 - scale: [0.5, 2], 129 + scale: [1, 1],
127 } 130 }
128 }, 131 },
129 ], 132 ],
...@@ -164,13 +167,17 @@ export default { ...@@ -164,13 +167,17 @@ export default {
164 }, 167 },
165 ], 168 ],
166 name: '卧室', 169 name: '卧室',
167 - thumbnail: temp_img 170 + thumbnail: temp_img,
168 }, 171 },
169 { 172 {
170 id: '2', 173 id: '2',
171 panorama: temp_img2, 174 panorama: temp_img2,
172 links: [ 175 links: [
173 { 176 {
177 + nodeId: '1',
178 + position: { yaw: 10, pitch: 0 },
179 + },
180 + {
174 nodeId: '3', 181 nodeId: '3',
175 // position: { textureX: 1000, textureY: 1000 }, 182 // position: { textureX: 1000, textureY: 1000 },
176 position: { yaw: 0, pitch: 0 }, 183 position: { yaw: 0, pitch: 0 },
...@@ -186,13 +193,29 @@ export default { ...@@ -186,13 +193,29 @@ export default {
186 { 193 {
187 nodeId: '1', 194 nodeId: '1',
188 // position: { textureX: 1000, textureY: 1000 }, 195 // position: { textureX: 1000, textureY: 1000 },
189 - position: { yaw: 300, pitch: 0 }, 196 + position: { yaw: 10, pitch: 0 },
197 + },
198 + {
199 + nodeId: '2',
200 + position: { yaw: 0, pitch: 0 },
190 }, 201 },
191 ], 202 ],
192 name: '室外', 203 name: '室外',
193 thumbnail: temp_img3 204 thumbnail: temp_img3
194 }, 205 },
195 ], 1); 206 ], 1);
207 + // 监听节点切换状态
208 + virtualTour.addEventListener('node-changed', ({ node, data }) => {
209 + // console.log(`Current node is ${node.id}`);
210 + // if (data.fromNode) {
211 + // // other data are available
212 + // console.log(`Previous node was ${data.fromNode.id}`);
213 + // }
214 + // console.warn(node);
215 + // console.warn(data);
216 + // 打开陀螺仪
217 + // $('.psv-gyroscope-button').trigger('click');
218 + });
196 }) 219 })
197 } 220 }
198 } 221 }
...@@ -207,7 +230,15 @@ export default { ...@@ -207,7 +230,15 @@ export default {
207 // loadingImg: temp_img_loading, 230 // loadingImg: temp_img_loading,
208 panorama: temp_img, 231 panorama: temp_img,
209 defaultZoomLvl: 0, 232 defaultZoomLvl: 0,
210 - navbar: 'zoom move gallery', 233 + navbar: ['zoom', 'move', 'gallery' , 'gyroscope', {
234 + id: 'my-button',
235 + content: '<svg t="1692238613802" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4229" width="64" height="64"><path d="M879.480512 64.020082c-22.23235 0-42.339294 9.080819-56.830333 23.728424l-0.007163-0.007163L511.706311 398.677025 200.77063 87.741343l-0.007163 0.007163c-14.492062-14.647605-34.597983-23.728424-56.830333-23.728424-44.155662 0-79.950913 35.795251-79.950913 79.950913 0 22.23235 9.080819 42.339294 23.728424 56.830333l-0.007163 0.007163 310.935682 310.935682L87.702458 822.680878l0.007163 0.007163c-14.647605 14.492062-23.728424 34.597983-23.728424 56.830333 0 44.155662 35.795251 79.950913 79.950913 79.950913 22.23235 0 42.339294-9.080819 56.830333-23.728424l0.007163 0.007163 310.935682-310.935682 310.935682 310.935682 0.007163-0.007163c14.492062 14.647605 34.597983 23.728424 56.830333 23.728424 44.155662 0 79.950913-35.795251 79.950913-79.950913 0-22.23235-9.080819-42.339294-23.728424-56.830333l0.007163-0.007163L624.77346 511.745197l310.935682-310.935682-0.007163-0.007163c14.647605-14.492062 23.728424-34.597983 23.728424-56.830333C959.431425 99.815333 923.635151 64.020082 879.480512 64.020082z" fill="#cecdcb" p-id="4230"></path></svg>',
236 + title: 'Hello world',
237 + className: 'custom-button',
238 + onClick: (viewer) => {
239 + this.onClose();
240 + },
241 + },],
211 plugins: [ 242 plugins: [
212 [MarkersPlugin, { 243 [MarkersPlugin, {
213 // markers: [ 244 // markers: [
...@@ -230,6 +261,8 @@ export default { ...@@ -230,6 +261,8 @@ export default {
230 // ], 261 // ],
231 }], 262 }],
232 VirtualTourPlugin, 263 VirtualTourPlugin,
264 + GyroscopePlugin,
265 + // StereoPlugin,
233 [GalleryPlugin, { 266 [GalleryPlugin, {
234 thumbnailSize: { width: 150, height: 150 }, 267 thumbnailSize: { width: 150, height: 150 },
235 }] 268 }]
...@@ -260,5 +293,18 @@ export default { ...@@ -260,5 +293,18 @@ export default {
260 } 293 }
261 </script> 294 </script>
262 295
263 -<style lang="less" scoped> 296 +<style lang="less">
297 + .custom-button {
298 + svg {
299 + width: 20px;
300 + height: 20px;
301 + }
302 + }
303 + .psv-navbar {
304 + height: 50px;
305 + }
306 + .psv--has-navbar .psv-gallery {
307 + bottom: 50px;
308 + transform: translateY(calc(100% + 50px));
309 + }
264 </style> 310 </style>
......
...@@ -143,6 +143,13 @@ ...@@ -143,6 +143,13 @@
143 dependencies: 143 dependencies:
144 "@photo-sphere-viewer/core" "5.2.0" 144 "@photo-sphere-viewer/core" "5.2.0"
145 145
146 +"@photo-sphere-viewer/gyroscope-plugin@5.2.0", "@photo-sphere-viewer/gyroscope-plugin@^5.2.0":
147 + version "5.2.0"
148 + resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/gyroscope-plugin/-/gyroscope-plugin-5.2.0.tgz#a956df8e17ec075157809aa8368d26844073b88d"
149 + integrity sha512-Cbtuij+pZ3x2X32JtTt+MJD4dvJp4TuEJo/+rcmHJdMaNc2N62nj7kxrUY7zg+ZTdZ1iMDlH7nT51TVBYQGU9g==
150 + dependencies:
151 + "@photo-sphere-viewer/core" "5.2.0"
152 +
146 "@photo-sphere-viewer/markers-plugin@5.2.0", "@photo-sphere-viewer/markers-plugin@^5.2.0": 153 "@photo-sphere-viewer/markers-plugin@5.2.0", "@photo-sphere-viewer/markers-plugin@^5.2.0":
147 version "5.2.0" 154 version "5.2.0"
148 resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/markers-plugin/-/markers-plugin-5.2.0.tgz#709a4a0848aa86496d2334557c94ac7b05ccc3b5" 155 resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/markers-plugin/-/markers-plugin-5.2.0.tgz#709a4a0848aa86496d2334557c94ac7b05ccc3b5"
...@@ -150,6 +157,14 @@ ...@@ -150,6 +157,14 @@
150 dependencies: 157 dependencies:
151 "@photo-sphere-viewer/core" "5.2.0" 158 "@photo-sphere-viewer/core" "5.2.0"
152 159
160 +"@photo-sphere-viewer/stereo-plugin@^5.2.0":
161 + version "5.2.0"
162 + resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/stereo-plugin/-/stereo-plugin-5.2.0.tgz#6fe8922e0179b08dce3be8d980c2a5d96372b739"
163 + integrity sha512-TU5AngtCHhjikK49HKWvAA52NqOfCYbOU0vWMAX49aXf70hS5A0N3AgpQqZEAB6DKS5Pq0gW4VsxQABFLejtyw==
164 + dependencies:
165 + "@photo-sphere-viewer/core" "5.2.0"
166 + "@photo-sphere-viewer/gyroscope-plugin" "5.2.0"
167 +
153 "@photo-sphere-viewer/virtual-tour-plugin@^5.2.0": 168 "@photo-sphere-viewer/virtual-tour-plugin@^5.2.0":
154 version "5.2.0" 169 version "5.2.0"
155 resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/virtual-tour-plugin/-/virtual-tour-plugin-5.2.0.tgz#32419fe510d5de91e783ce56bdf759ef2a1e1244" 170 resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/virtual-tour-plugin/-/virtual-tour-plugin-5.2.0.tgz#32419fe510d5de91e783ce56bdf759ef2a1e1244"
......