Showing
5 changed files
with
115 additions
and
4 deletions
| ... | @@ -14,6 +14,7 @@ | ... | @@ -14,6 +14,7 @@ |
| 14 | "dependencies": { | 14 | "dependencies": { |
| 15 | "@photo-sphere-viewer/core": "^5.2.0", | 15 | "@photo-sphere-viewer/core": "^5.2.0", |
| 16 | "@photo-sphere-viewer/markers-plugin": "^5.2.0", | 16 | "@photo-sphere-viewer/markers-plugin": "^5.2.0", |
| 17 | + "@photo-sphere-viewer/virtual-tour-plugin": "^5.2.0", | ||
| 17 | "@videojs-player/vue": "^1.0.0", | 18 | "@videojs-player/vue": "^1.0.0", |
| 18 | "@vitejs/plugin-legacy": "^1.8.2", | 19 | "@vitejs/plugin-legacy": "^1.8.2", |
| 19 | "@vueuse/core": "^8.5.0", | 20 | "@vueuse/core": "^8.5.0", | ... | ... |
| 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-16 10:33:43 | 4 | + * @LastEditTime: 2023-08-16 15:16:06 |
| 5 | * @FilePath: /map-demo/src/components/VRViewer/index.vue | 5 | * @FilePath: /map-demo/src/components/VRViewer/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -20,11 +20,33 @@ | ... | @@ -20,11 +20,33 @@ |
| 20 | </template> | 20 | </template> |
| 21 | 21 | ||
| 22 | <script> | 22 | <script> |
| 23 | +import $ from 'jquery'; | ||
| 23 | import { Viewer } from '@photo-sphere-viewer/core' // 引入插件 | 24 | import { Viewer } from '@photo-sphere-viewer/core' // 引入插件 |
| 24 | 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'; | ||
| 25 | import '@photo-sphere-viewer/core/index.css' //引入CSS样式 | 27 | import '@photo-sphere-viewer/core/index.css' //引入CSS样式 |
| 26 | import '@photo-sphere-viewer/markers-plugin/index.css' | 28 | import '@photo-sphere-viewer/markers-plugin/index.css' |
| 27 | import temp_img from './temp1.jpg' | 29 | import temp_img from './temp1.jpg' |
| 30 | +import temp_img2 from './temp2.webp' | ||
| 31 | +import temp_img3 from './temp3.webp' | ||
| 32 | +import { showDialog } from 'vant'; | ||
| 33 | + | ||
| 34 | +const markerLighthouse = { | ||
| 35 | + // polygon marker | ||
| 36 | + id: 'polygon', | ||
| 37 | + polygon: [ | ||
| 38 | + [6.2208, 0.0906], [0.0443, 0.1028], [0.2322, 0.0849], [0.4531, 0.0387], | ||
| 39 | + [0.5022, -0.0056], [0.4587, -0.0396], [0.252, -0.0453], [0.0434, -0.0575], | ||
| 40 | + [6.1302, -0.0623], [6.0094, -0.0169], [6.0471, 0.032], [6.2208, 0.0906], | ||
| 41 | + ], | ||
| 42 | + svgStyle: { | ||
| 43 | + fill: 'rgba(200, 0, 0, 0.2)', | ||
| 44 | + stroke: 'rgba(200, 0, 50, 0.8)', | ||
| 45 | + strokeWidth: '2px', | ||
| 46 | + }, | ||
| 47 | + tooltip: { | ||
| 48 | + }, | ||
| 49 | +}; | ||
| 28 | 50 | ||
| 29 | export default { | 51 | export default { |
| 30 | props: { | 52 | props: { |
| ... | @@ -39,6 +61,61 @@ export default { | ... | @@ -39,6 +61,61 @@ export default { |
| 39 | if (val && !this.panoramaViewer) { | 61 | if (val && !this.panoramaViewer) { |
| 40 | this.$nextTick(() => { | 62 | this.$nextTick(() => { |
| 41 | this.initViewer(); | 63 | this.initViewer(); |
| 64 | + if ($('.psv-zoom-button').css('display') === 'none') { | ||
| 65 | + $('.psv-zoom-button').css('display', '') | ||
| 66 | + // $('.psv-zoom-range').css('display', '') | ||
| 67 | + $('.psv-move-button').css('display', '') | ||
| 68 | + } | ||
| 69 | + const markersPlugin = this.panoramaViewer.getPlugin(MarkersPlugin); | ||
| 70 | + markersPlugin.addEventListener('select-marker', ({ marker }) => { | ||
| 71 | + // | ||
| 72 | + if (marker.id === 'polygon') { | ||
| 73 | + showDialog({ | ||
| 74 | + title: '温馨提示', | ||
| 75 | + message: '这是一副来自中世纪的古画。', | ||
| 76 | + theme: 'round-button', | ||
| 77 | + }).then(() => { | ||
| 78 | + // on close | ||
| 79 | + }); | ||
| 80 | + } | ||
| 81 | + }); | ||
| 82 | + const virtualTour = this.panoramaViewer.getPlugin(VirtualTourPlugin); | ||
| 83 | + virtualTour.setNodes([ | ||
| 84 | + { | ||
| 85 | + id: '1', | ||
| 86 | + panorama: temp_img, | ||
| 87 | + links: [ | ||
| 88 | + { | ||
| 89 | + nodeId: '2', | ||
| 90 | + // position: { textureX: 2000, textureY: 1000 }, | ||
| 91 | + position: { yaw: -300, pitch: 0 }, | ||
| 92 | + }, | ||
| 93 | + ], | ||
| 94 | + markers: [markerLighthouse], | ||
| 95 | + }, | ||
| 96 | + { | ||
| 97 | + id: '2', | ||
| 98 | + panorama: temp_img2, | ||
| 99 | + links: [ | ||
| 100 | + { | ||
| 101 | + nodeId: '3', | ||
| 102 | + // position: { textureX: 1000, textureY: 1000 }, | ||
| 103 | + position: { yaw: 0, pitch: 0 }, | ||
| 104 | + }, | ||
| 105 | + ], | ||
| 106 | + }, | ||
| 107 | + { | ||
| 108 | + id: '3', | ||
| 109 | + panorama: temp_img3, | ||
| 110 | + links: [ | ||
| 111 | + { | ||
| 112 | + nodeId: '1', | ||
| 113 | + // position: { textureX: 1000, textureY: 1000 }, | ||
| 114 | + position: { yaw: 0, pitch: 0 }, | ||
| 115 | + }, | ||
| 116 | + ], | ||
| 117 | + }, | ||
| 118 | + ]) | ||
| 42 | }) | 119 | }) |
| 43 | } | 120 | } |
| 44 | } | 121 | } |
| ... | @@ -51,6 +128,7 @@ export default { | ... | @@ -51,6 +128,7 @@ export default { |
| 51 | this.panoramaViewer = new Viewer({ | 128 | this.panoramaViewer = new Viewer({ |
| 52 | container: document.querySelector('#viewer'), // 容器 | 129 | container: document.querySelector('#viewer'), // 容器 |
| 53 | panorama: temp_img, | 130 | panorama: temp_img, |
| 131 | + defaultZoomLvl: 0, | ||
| 54 | navbar: [ | 132 | navbar: [ |
| 55 | 'zoom', | 133 | 'zoom', |
| 56 | 'move', | 134 | 'move', |
| ... | @@ -74,12 +152,11 @@ export default { | ... | @@ -74,12 +152,11 @@ export default { |
| 74 | strokeWidth: '2px', | 152 | strokeWidth: '2px', |
| 75 | }, | 153 | }, |
| 76 | tooltip: { | 154 | tooltip: { |
| 77 | - content: 'A dynamic polygon marker', | ||
| 78 | - position: 'bottom right', | ||
| 79 | }, | 155 | }, |
| 80 | }, | 156 | }, |
| 81 | ], | 157 | ], |
| 82 | }], | 158 | }], |
| 159 | + VirtualTourPlugin, | ||
| 83 | ], // 标记点 | 160 | ], // 标记点 |
| 84 | size: { | 161 | size: { |
| 85 | width: '100%', | 162 | width: '100%', |
| ... | @@ -96,6 +173,12 @@ export default { | ... | @@ -96,6 +173,12 @@ export default { |
| 96 | onClose () { | 173 | onClose () { |
| 97 | console.warn(1); | 174 | console.warn(1); |
| 98 | this.$emit('close', false) | 175 | this.$emit('close', false) |
| 176 | + }, | ||
| 177 | + onClick () { | ||
| 178 | + | ||
| 179 | + // this.panoramaViewer.addEventListener('click', ({ data }) => { | ||
| 180 | + // console.log(`${data.rightclick ? 'right ' : ''}clicked at yaw: ${data.yaw} pitch: ${data.pitch}`); | ||
| 181 | + // }); | ||
| 99 | } | 182 | } |
| 100 | } | 183 | } |
| 101 | } | 184 | } | ... | ... |
src/components/VRViewer/temp2.webp
0 → 100644
No preview for this file type
src/components/VRViewer/temp3.webp
0 → 100644
No preview for this file type
| ... | @@ -120,6 +120,15 @@ | ... | @@ -120,6 +120,15 @@ |
| 120 | "@nodelib/fs.scandir" "2.1.5" | 120 | "@nodelib/fs.scandir" "2.1.5" |
| 121 | fastq "^1.6.0" | 121 | fastq "^1.6.0" |
| 122 | 122 | ||
| 123 | +"@photo-sphere-viewer/compass-plugin@5.2.0": | ||
| 124 | + version "5.2.0" | ||
| 125 | + resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/compass-plugin/-/compass-plugin-5.2.0.tgz#7e9d2be1901dc0a18c17684918b96b8e140470b4" | ||
| 126 | + integrity sha512-CrBftHR7iTK7a8PK2cJd4ndnS+6bfTiXN8u5BjaYLl0u2RSj3YLxPHC74Y/N/GuaocT+zFzmyR3TKckEs4hJWg== | ||
| 127 | + dependencies: | ||
| 128 | + "@photo-sphere-viewer/core" "5.2.0" | ||
| 129 | + optionalDependencies: | ||
| 130 | + "@photo-sphere-viewer/markers-plugin" "5.2.0" | ||
| 131 | + | ||
| 123 | "@photo-sphere-viewer/core@5.2.0", "@photo-sphere-viewer/core@^5.2.0": | 132 | "@photo-sphere-viewer/core@5.2.0", "@photo-sphere-viewer/core@^5.2.0": |
| 124 | version "5.2.0" | 133 | version "5.2.0" |
| 125 | resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/core/-/core-5.2.0.tgz#70cd3904d39f0ff1b24319c0f4685c959d15de66" | 134 | resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/core/-/core-5.2.0.tgz#70cd3904d39f0ff1b24319c0f4685c959d15de66" |
| ... | @@ -127,13 +136,31 @@ | ... | @@ -127,13 +136,31 @@ |
| 127 | dependencies: | 136 | dependencies: |
| 128 | three "^0.155.0" | 137 | three "^0.155.0" |
| 129 | 138 | ||
| 130 | -"@photo-sphere-viewer/markers-plugin@^5.2.0": | 139 | +"@photo-sphere-viewer/gallery-plugin@5.2.0": |
| 140 | + version "5.2.0" | ||
| 141 | + resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/gallery-plugin/-/gallery-plugin-5.2.0.tgz#c4f8a8a998b2a15f310538d4c3a9cb52cfd7c407" | ||
| 142 | + integrity sha512-JQHJNTYcF0JER2N1eiVMzN5uc/Fbi2GdsYFtEOaQQc2cs/pO4v/KKrotvE4ZTFLSieg57moSxDnEm82o4gz4nw== | ||
| 143 | + dependencies: | ||
| 144 | + "@photo-sphere-viewer/core" "5.2.0" | ||
| 145 | + | ||
| 146 | +"@photo-sphere-viewer/markers-plugin@5.2.0", "@photo-sphere-viewer/markers-plugin@^5.2.0": | ||
| 131 | version "5.2.0" | 147 | version "5.2.0" |
| 132 | resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/markers-plugin/-/markers-plugin-5.2.0.tgz#709a4a0848aa86496d2334557c94ac7b05ccc3b5" | 148 | resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/markers-plugin/-/markers-plugin-5.2.0.tgz#709a4a0848aa86496d2334557c94ac7b05ccc3b5" |
| 133 | integrity sha512-/0MSl86aNhjWrXpwtnqSkxa5C6UbfiB37/G35qrH7WOx32eQg2R9DIqCrSg1npzxkcr+Cmve57FrCa+WuA3wwQ== | 149 | integrity sha512-/0MSl86aNhjWrXpwtnqSkxa5C6UbfiB37/G35qrH7WOx32eQg2R9DIqCrSg1npzxkcr+Cmve57FrCa+WuA3wwQ== |
| 134 | dependencies: | 150 | dependencies: |
| 135 | "@photo-sphere-viewer/core" "5.2.0" | 151 | "@photo-sphere-viewer/core" "5.2.0" |
| 136 | 152 | ||
| 153 | +"@photo-sphere-viewer/virtual-tour-plugin@^5.2.0": | ||
| 154 | + 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" | ||
| 156 | + integrity sha512-57jwrv/wBRbsPxNMp09CVNwbJkBNoO2xryM8sCfP6jF2iNydgMnhKL0KRcAFxwdQTb+cmSRJIcadiugaK+rilQ== | ||
| 157 | + dependencies: | ||
| 158 | + "@photo-sphere-viewer/core" "5.2.0" | ||
| 159 | + optionalDependencies: | ||
| 160 | + "@photo-sphere-viewer/compass-plugin" "5.2.0" | ||
| 161 | + "@photo-sphere-viewer/gallery-plugin" "5.2.0" | ||
| 162 | + "@photo-sphere-viewer/markers-plugin" "5.2.0" | ||
| 163 | + | ||
| 137 | "@rollup/pluginutils@^4.1.2", "@rollup/pluginutils@^4.2.1": | 164 | "@rollup/pluginutils@^4.1.2", "@rollup/pluginutils@^4.2.1": |
| 138 | version "4.2.1" | 165 | version "4.2.1" |
| 139 | resolved "https://mirrors.cloud.tencent.com/npm/@rollup/pluginutils/-/pluginutils-4.2.1.tgz" | 166 | resolved "https://mirrors.cloud.tencent.com/npm/@rollup/pluginutils/-/pluginutils-4.2.1.tgz" | ... | ... |
-
Please register or login to post a comment