@qispace/vue3-player 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/components/apartmentChooser/QiApartmentChooser.vue.d.ts +4 -0
- package/dist/components/apartmentChooser/QiApartmentChooser.vue.d.ts.map +1 -0
- package/dist/components/apartmentChooser/QiApartmentChooserNavigation.vue.d.ts +4 -0
- package/dist/components/apartmentChooser/QiApartmentChooserNavigation.vue.d.ts.map +1 -0
- package/dist/components/apartmentChooser/QiApartmentChooserRaster.vue.d.ts +4 -0
- package/dist/components/apartmentChooser/QiApartmentChooserRaster.vue.d.ts.map +1 -0
- package/dist/components/apartmentChooser/QiApartmentChooserRotator.vue.d.ts +4 -0
- package/dist/components/apartmentChooser/QiApartmentChooserRotator.vue.d.ts.map +1 -0
- package/dist/components/apartmentChooser/QiApartmentChooserSvg.vue.d.ts +4 -0
- package/dist/components/apartmentChooser/QiApartmentChooserSvg.vue.d.ts.map +1 -0
- package/dist/components/buildingPicker/QiBuildingChooser.vue.d.ts +3 -0
- package/dist/components/buildingPicker/QiBuildingChooser.vue.d.ts.map +1 -0
- package/dist/components/buildingPicker/QiBuildingChooserRaster.vue.d.ts +4 -0
- package/dist/components/buildingPicker/QiBuildingChooserRaster.vue.d.ts.map +1 -0
- package/dist/components/buildingPicker/QiBuildingChooserRasterOverlay.vue.d.ts +4 -0
- package/dist/components/buildingPicker/QiBuildingChooserRasterOverlay.vue.d.ts.map +1 -0
- package/dist/components/buildingPicker/QiBuildingChooserSceneImageStack.vue.d.ts +4 -0
- package/dist/components/buildingPicker/QiBuildingChooserSceneImageStack.vue.d.ts.map +1 -0
- package/dist/components/buildingPicker/QiBuildingChooserSunSimControl.vue.d.ts +5 -0
- package/dist/components/buildingPicker/QiBuildingChooserSunSimControl.vue.d.ts.map +1 -0
- package/dist/components/buildingPicker/QiBuildingChooserSvg.vue.d.ts +4 -0
- package/dist/components/buildingPicker/QiBuildingChooserSvg.vue.d.ts.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/shared/QiFloatingCard.vue.d.ts +4 -0
- package/dist/components/shared/QiFloatingCard.vue.d.ts.map +1 -0
- package/dist/components/shared/QiHoverProbe.vue.d.ts +4 -0
- package/dist/components/shared/QiHoverProbe.vue.d.ts.map +1 -0
- package/dist/components/shared/QiNorthDirection.vue.d.ts +3 -0
- package/dist/components/shared/QiNorthDirection.vue.d.ts.map +1 -0
- package/dist/components/shared/QiZoomBox.vue.d.ts +4 -0
- package/dist/components/shared/QiZoomBox.vue.d.ts.map +1 -0
- package/dist/components/virtualTourV2/Disclaimer.vue.d.ts +4 -0
- package/dist/components/virtualTourV2/Disclaimer.vue.d.ts.map +1 -0
- package/dist/components/virtualTourV2/FullScreenButton.vue.d.ts +3 -0
- package/dist/components/virtualTourV2/FullScreenButton.vue.d.ts.map +1 -0
- package/dist/components/virtualTourV2/ManualSlideShow.vue.d.ts +4 -0
- package/dist/components/virtualTourV2/ManualSlideShow.vue.d.ts.map +1 -0
- package/dist/components/virtualTourV2/ManualSlideShowPlayer.vue.d.ts +4 -0
- package/dist/components/virtualTourV2/ManualSlideShowPlayer.vue.d.ts.map +1 -0
- package/dist/components/virtualTourV2/SingleImage.vue.d.ts +4 -0
- package/dist/components/virtualTourV2/SingleImage.vue.d.ts.map +1 -0
- package/dist/components/virtualTourV2/SocialShare.vue.d.ts +4 -0
- package/dist/components/virtualTourV2/SocialShare.vue.d.ts.map +1 -0
- package/dist/components/virtualTourV2/WaypointCarousel.vue.d.ts +4 -0
- package/dist/components/virtualTourV2/WaypointCarousel.vue.d.ts.map +1 -0
- package/dist/lib/virtualTour__/ApartmentConfig.d.ts +27 -0
- package/dist/lib/virtualTour__/ApartmentFiles.d.ts +7 -0
- package/dist/lib/virtualTour__/MinimapConfig.d.ts +23 -0
- package/dist/lib/virtualTour__/impl/HttpApartmentFiles.d.ts +19 -0
- package/dist/vue3-player.cjs.js +2 -0
- package/dist/vue3-player.esm.js +2992 -0
- package/dist/vue3-player.iife.js +3 -0
- package/dist/vue3-player.umd.js +3 -0
- package/package.json +65 -0
- package/src/components/apartmentChooser/QiApartmentChooser.vue +319 -0
- package/src/components/apartmentChooser/QiApartmentChooserNavigation.vue +88 -0
- package/src/components/apartmentChooser/QiApartmentChooserRaster.vue +408 -0
- package/src/components/apartmentChooser/QiApartmentChooserRotator.vue +202 -0
- package/src/components/apartmentChooser/QiApartmentChooserSvg.vue +257 -0
- package/src/components/apartmentChooser/index.js +5 -0
- package/src/components/buildingPicker/QiBuildingChooser.vue +61 -0
- package/src/components/buildingPicker/QiBuildingChooserRaster.vue +312 -0
- package/src/components/buildingPicker/QiBuildingChooserRasterOverlay.vue +96 -0
- package/src/components/buildingPicker/QiBuildingChooserSceneImageStack.vue +89 -0
- package/src/components/buildingPicker/QiBuildingChooserSunSimControl.vue +257 -0
- package/src/components/buildingPicker/QiBuildingChooserSvg.vue +414 -0
- package/src/components/buildingPicker/index.js +6 -0
- package/src/components/index.ts +4 -0
- package/src/components/shared/QiFloatingCard.vue +76 -0
- package/src/components/shared/QiHoverProbe.vue +22 -0
- package/src/components/shared/QiNorthDirection.vue +27 -0
- package/src/components/shared/QiZoomBox.vue +322 -0
- package/src/components/shared/index.js +4 -0
- package/src/components/virtualTourV2/Compass.vue +37 -0
- package/src/components/virtualTourV2/Disclaimer.vue +41 -0
- package/src/components/virtualTourV2/FloorLevel.vue +73 -0
- package/src/components/virtualTourV2/FullScreenButton.vue +23 -0
- package/src/components/virtualTourV2/InteriorSelector.vue +90 -0
- package/src/components/virtualTourV2/ManualSlideShow.vue +198 -0
- package/src/components/virtualTourV2/ManualSlideShowPlayer.vue +159 -0
- package/src/components/virtualTourV2/PlayerV2.vue +300 -0
- package/src/components/virtualTourV2/ScrollHelper.vue +74 -0
- package/src/components/virtualTourV2/SettingsUI.vue +355 -0
- package/src/components/virtualTourV2/SingleImage.vue +36 -0
- package/src/components/virtualTourV2/SocialShare.vue +163 -0
- package/src/components/virtualTourV2/TimeOfDay.vue +50 -0
- package/src/components/virtualTourV2/Tutorial.vue +690 -0
- package/src/components/virtualTourV2/ViewModeToggle.vue +24 -0
- package/src/components/virtualTourV2/VirtualTourV2.vue +876 -0
- package/src/components/virtualTourV2/WaypointCarousel.vue +162 -0
- package/src/components/virtualTourV2/index.js +1 -0
- package/src/components/virtualTourV2/minimapv2/MiniMapMap.vue +262 -0
- package/src/components/virtualTourV2/minimapv2/MiniMapV2.vue +110 -0
- package/src/components/virtualTourV2/minimapv2/MinimapCompass.vue +39 -0
- package/src/components/virtualTourV2/minimapv2/Moveable.vue +208 -0
- package/src/components/virtualTourV2/minimapv2/RotationMarkerV2.vue +79 -0
- package/src/components/virtualTourV2/minimapv2/SunsimulationSlider.vue +203 -0
- package/src/components/virtualTourV2/minimapv2/index.js +1 -0
- package/src/entry.esm.js +17 -0
- package/src/entry.js +13 -0
- package/src/entry.ts_ +17 -0
- package/src/lib/apartmentChooser/BuildingViewerModel.js +60 -0
- package/src/lib/apartmentChooser/CircularSlideshow.js +66 -0
- package/src/lib/apartmentChooser/RotationStep.js +31 -0
- package/src/lib/apartmentChooser/SceneRotator.js +25 -0
- package/src/lib/apartmentChooser/index.js +3 -0
- package/src/lib/apartmentChooser/throttle.js +15 -0
- package/src/lib/buildingPicker/BuildingMap.js +24 -0
- package/src/lib/buildingPicker/BuildingPickerResourceProvider.js +97 -0
- package/src/lib/buildingPicker/CanvasRaster.js +29 -0
- package/src/lib/buildingPicker/DayOfYearSelector.js +36 -0
- package/src/lib/buildingPicker/SampleRaster.js +14 -0
- package/src/lib/buildingPicker/index.js +5 -0
- package/src/lib/index.js +4 -0
- package/src/lib/shared/BatchLoadTracker.js +52 -0
- package/src/lib/shared/I18N.js +65 -0
- package/src/lib/shared/ResourceLoader.js +33 -0
- package/src/lib/shared/index.js +3 -0
- package/src/lib/virtualTour/CameraSnapshot.js +42 -0
- package/src/lib/virtualTour/FullscreenModel.js +69 -0
- package/src/lib/virtualTour/textures/arrow.png +0 -0
- package/src/lib/virtualTour/textures/compass-bg.png +0 -0
- package/src/lib/virtualTour/textures/compass-needle.png +0 -0
- package/src/lib/virtualTour/textures/compass-north.png +0 -0
- package/src/lib/virtualTour/textures/floor-1.svg +4 -0
- package/src/lib/virtualTour/textures/floor-2.svg +4 -0
- package/src/lib/virtualTour/textures/marker.png +0 -0
- package/src/lib/virtualTour/textures/tod-sun.png +0 -0
- package/src/lib/virtualTour__/ApartmentConfig.ts +80 -0
- package/src/lib/virtualTour__/ApartmentFiles.ts +8 -0
- package/src/lib/virtualTour__/CameraNavigator.js_ +74 -0
- package/src/lib/virtualTour__/CameraSnapshot.js +42 -0
- package/src/lib/virtualTour__/CoordConversions.js +43 -0
- package/src/lib/virtualTour__/FullscreenModel.js +69 -0
- package/src/lib/virtualTour__/MinimapConfig.ts +46 -0
- package/src/lib/virtualTour__/PlayerViewModel.js +423 -0
- package/src/lib/virtualTour__/config/ApartmentConfig.js +92 -0
- package/src/lib/virtualTour__/config/CameraConfig.js +97 -0
- package/src/lib/virtualTour__/config/Interaction.js +393 -0
- package/src/lib/virtualTour__/config/Panorama.js +78 -0
- package/src/lib/virtualTour__/config/PlayerConfig.js +812 -0
- package/src/lib/virtualTour__/config/rawinflate.export.js +833 -0
- package/src/lib/virtualTour__/config/shaders.js +24 -0
- package/src/lib/virtualTour__/impl/HttpApartmentFiles.ts +57 -0
- package/src/lib/virtualTour__/index.js +1 -0
- package/src/lib/virtualTour__/textures/arrow.png +0 -0
- package/src/lib/virtualTour__/textures/compass-bg.png +0 -0
- package/src/lib/virtualTour__/textures/compass-needle.png +0 -0
- package/src/lib/virtualTour__/textures/compass-north.png +0 -0
- package/src/lib/virtualTour__/textures/floor-1.svg +4 -0
- package/src/lib/virtualTour__/textures/floor-2.svg +4 -0
- package/src/lib/virtualTour__/textures/marker.png +0 -0
- package/src/lib/virtualTour__/textures/tod-sun.png +0 -0
- package/src/main.ts_ +24 -0
- package/src/shims-png.d.ts +4 -0
- package/src/shims-tsx.d.ts +11 -0
- package/src/shims-vue.d.ts +4 -0
- package/src/style.css +0 -0
- package/src/vite-env.d.ts +5 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="virtual-tour-v2-wrapper">
|
|
3
|
+
<div class="player-and-components-wrapper">
|
|
4
|
+
<div>
|
|
5
|
+
<manual-slide-show-player :isFullScreen="fullScreen.isActive">
|
|
6
|
+
<template v-slot:slideshow-image>
|
|
7
|
+
<single-image :image="currentImage" />
|
|
8
|
+
</template>
|
|
9
|
+
<template v-slot:top-left></template>
|
|
10
|
+
<template v-slot:top-center>
|
|
11
|
+
<disclaimer :return-url="websiteUrl" />
|
|
12
|
+
</template>
|
|
13
|
+
<template v-slot:top-right></template>
|
|
14
|
+
<template v-slot:center-left>
|
|
15
|
+
<transition name="slide-x-transition">
|
|
16
|
+
<v-btn elevation="1" rounded plain icon @click="previousImage">
|
|
17
|
+
<v-icon color="black darken-1">mdi-chevron-left</v-icon>
|
|
18
|
+
</v-btn>
|
|
19
|
+
</transition>
|
|
20
|
+
</template>
|
|
21
|
+
<template v-slot:center-center></template>
|
|
22
|
+
<template v-slot:center-right>
|
|
23
|
+
<transition name="slide-x-reverse-transition">
|
|
24
|
+
<v-btn elevation="1" rounded plain icon @click="nextImage">
|
|
25
|
+
<v-icon color="black darken-1">mdi-chevron-right</v-icon>
|
|
26
|
+
</v-btn>
|
|
27
|
+
</transition>
|
|
28
|
+
</template>
|
|
29
|
+
<template v-slot:bottom-left>
|
|
30
|
+
<full-screen-button
|
|
31
|
+
v-if="showFullScreen"
|
|
32
|
+
:isFullScreen="fullScreen.isActive"
|
|
33
|
+
class="btn-fullscreen"
|
|
34
|
+
@toggle-fullscreen="toggleFullscreen"
|
|
35
|
+
/>
|
|
36
|
+
<div v-if="showShare" class="btn-placeholder">
|
|
37
|
+
<social-share />
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
<template v-slot:bottom-center>
|
|
41
|
+
<div>
|
|
42
|
+
<waypoint-carousel
|
|
43
|
+
v-if="fullScreen.isActive"
|
|
44
|
+
:class="[fullScreen.isActive ? 'full-screen' : '']"
|
|
45
|
+
:thumbnails="imagesWithThumbnails"
|
|
46
|
+
:active="currentIndex"
|
|
47
|
+
@next="nextImage"
|
|
48
|
+
@previous="previousImage"
|
|
49
|
+
@goto="goToImage"
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
<template v-slot:bottom-right></template>
|
|
54
|
+
</manual-slide-show-player>
|
|
55
|
+
<waypoint-carousel
|
|
56
|
+
:thumbnails="imagesWithThumbnails"
|
|
57
|
+
:active="currentIndex"
|
|
58
|
+
@next="nextImage"
|
|
59
|
+
@previous="previousImage"
|
|
60
|
+
@goto="goToImage"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
<script>
|
|
67
|
+
import WaypointCarousel from './WaypointCarousel.vue'
|
|
68
|
+
import SocialShare from './SocialShare.vue'
|
|
69
|
+
import { I18N } from '@/lib/shared/I18N'
|
|
70
|
+
import { FullscreenModel } from '@/lib/virtualTour/FullscreenModel'
|
|
71
|
+
import FullScreenButton from './FullScreenButton.vue'
|
|
72
|
+
import Disclaimer from './Disclaimer.vue'
|
|
73
|
+
import ManualSlideShowPlayer from './ManualSlideShowPlayer.vue'
|
|
74
|
+
import SingleImage from './SingleImage.vue'
|
|
75
|
+
|
|
76
|
+
export default {
|
|
77
|
+
name: 'ManualSlideShow',
|
|
78
|
+
components: {
|
|
79
|
+
WaypointCarousel,
|
|
80
|
+
SingleImage,
|
|
81
|
+
SocialShare,
|
|
82
|
+
FullScreenButton,
|
|
83
|
+
Disclaimer,
|
|
84
|
+
ManualSlideShowPlayer,
|
|
85
|
+
},
|
|
86
|
+
provide() {
|
|
87
|
+
const localizer = this.i18n
|
|
88
|
+
? new I18N(this.i18n.labels, this.i18n.language)
|
|
89
|
+
: new I18N()
|
|
90
|
+
return {
|
|
91
|
+
i18n: localizer,
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
props: {
|
|
95
|
+
images: { type: Array, required: true },
|
|
96
|
+
websiteUrl: { type: String, default: () => undefined },
|
|
97
|
+
i18n: { type: Object, default: undefined },
|
|
98
|
+
showFullScreen: { type: Boolean, default: () => true },
|
|
99
|
+
showShare: { type: Boolean, default: () => true },
|
|
100
|
+
defaultWaypointIndex: { type: Number, default: () => 0 },
|
|
101
|
+
},
|
|
102
|
+
data() {
|
|
103
|
+
return {
|
|
104
|
+
loading: true,
|
|
105
|
+
error: false,
|
|
106
|
+
currentIndex: 0,
|
|
107
|
+
currentImageId: undefined,
|
|
108
|
+
fullScreen: new FullscreenModel(document, 'player-wrapper'),
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
computed: {
|
|
112
|
+
imagesWithThumbnails() {
|
|
113
|
+
return this.images.map((item) => {
|
|
114
|
+
return { ...item, thumbnailUrl: item.url }
|
|
115
|
+
})
|
|
116
|
+
},
|
|
117
|
+
currentImage() {
|
|
118
|
+
return this.images[this.currentIndex].url
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
mounted() {
|
|
122
|
+
this.fullScreen.setup()
|
|
123
|
+
},
|
|
124
|
+
methods: {
|
|
125
|
+
toggleFullscreen() {
|
|
126
|
+
this.fullScreen.toggle()
|
|
127
|
+
window.scrollTo({ top: 150, behavior: 'smooth' })
|
|
128
|
+
},
|
|
129
|
+
nextImage() {
|
|
130
|
+
let newIndex = this.currentIndex + 1
|
|
131
|
+
if (newIndex >= this.images.length) newIndex = 0
|
|
132
|
+
this.currentIndex = newIndex
|
|
133
|
+
},
|
|
134
|
+
previousImage() {
|
|
135
|
+
let newIndex = this.currentIndex - 1
|
|
136
|
+
if (newIndex < 0) newIndex = this.images.length - 1
|
|
137
|
+
this.currentIndex = newIndex
|
|
138
|
+
},
|
|
139
|
+
goToImage(imageId, updatePlayerImage = true) {
|
|
140
|
+
let newIndex = this.images.findIndex((item) => item.id === imageId)
|
|
141
|
+
|
|
142
|
+
if (newIndex != -1) {
|
|
143
|
+
this.currentIndex = newIndex
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
}
|
|
148
|
+
</script>
|
|
149
|
+
<style scoped>
|
|
150
|
+
.compass-wrapper {
|
|
151
|
+
width: 50px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.player-and-components-wrapper {
|
|
155
|
+
position: relative;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.static-image {
|
|
159
|
+
position: absolute;
|
|
160
|
+
top: 0;
|
|
161
|
+
left: 0;
|
|
162
|
+
width: 100%;
|
|
163
|
+
height: auto;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
button.v-btn {
|
|
167
|
+
background: #fff;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.waypoint-carousel.full-screen {
|
|
171
|
+
scale: 0.5;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
div#controls-bottom-center > div {
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-direction: column;
|
|
177
|
+
align-items: center;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.player-error {
|
|
181
|
+
min-height: 400px;
|
|
182
|
+
display: flex;
|
|
183
|
+
align-items: center;
|
|
184
|
+
justify-content: space-around;
|
|
185
|
+
background: #ededed;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@media only screen and (max-width: 600px) {
|
|
189
|
+
#btn-fullscreen {
|
|
190
|
+
display: none;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
@media all and (orientation: landscape) and (max-height: 499px) {
|
|
194
|
+
#btn-fullscreen {
|
|
195
|
+
display: none;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
</style>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="player-wrapper">
|
|
3
|
+
<div id="player-sizer">
|
|
4
|
+
<slot name="slideshow-image"></slot>
|
|
5
|
+
<div class="player-control" id="controls-top-left">
|
|
6
|
+
<slot name="top-left"></slot>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="player-control" id="controls-top-center">
|
|
9
|
+
<slot name="top-center"></slot>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="player-control" id="controls-top-right">
|
|
12
|
+
<slot name="top-right"></slot>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="player-control" id="controls-center-left">
|
|
15
|
+
<slot name="center-left"></slot>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="player-control" id="controls-center-center">
|
|
18
|
+
<slot name="center-center"></slot>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="player-control" id="controls-center-right">
|
|
21
|
+
<slot name="center-right"></slot>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="player-control" id="controls-bottom-left">
|
|
24
|
+
<slot name="bottom-left"></slot>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="player-control" id="controls-bottom-center">
|
|
27
|
+
<slot name="bottom-center"></slot>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="player-control" id="controls-bottom-right">
|
|
30
|
+
<slot name="bottom-right"></slot>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
<script>
|
|
36
|
+
export default {
|
|
37
|
+
name: 'ManualSlideShowImage',
|
|
38
|
+
props: {
|
|
39
|
+
isFullScreen: { type: Boolean, required: true },
|
|
40
|
+
},
|
|
41
|
+
data() {
|
|
42
|
+
return {}
|
|
43
|
+
},
|
|
44
|
+
watch: {},
|
|
45
|
+
mounted() {
|
|
46
|
+
window.addEventListener('resize', this.setPlayerSize)
|
|
47
|
+
this.setPlayerSize()
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
findClosestAncestor(element, className) {
|
|
51
|
+
let el = element
|
|
52
|
+
let returnElement = element
|
|
53
|
+
while ((el = el.parentNode) && el.className.indexOf(className) < 0);
|
|
54
|
+
returnElement = el
|
|
55
|
+
|
|
56
|
+
return returnElement
|
|
57
|
+
},
|
|
58
|
+
setPlayerSize() {
|
|
59
|
+
let AR = 16 / 9
|
|
60
|
+
let element = document.querySelector('#player-sizer')
|
|
61
|
+
if (!element) return
|
|
62
|
+
|
|
63
|
+
let width = element.offsetWidth
|
|
64
|
+
let height = width * (1 / AR)
|
|
65
|
+
|
|
66
|
+
if (window.innerWidth <= 600 || width <= 600) {
|
|
67
|
+
height = window.innerHeight * 0.75
|
|
68
|
+
width = height * (1 / AR)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
element.style.height = height + 'px'
|
|
72
|
+
element.style.width = width + 'px'
|
|
73
|
+
this.$emit('new-size-callback', width, height)
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
<style scoped>
|
|
79
|
+
#player-wrapper {
|
|
80
|
+
position: relative;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#player-sizer {
|
|
85
|
+
display: flex;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
align-items: center;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.player-control {
|
|
92
|
+
display: flex;
|
|
93
|
+
position: absolute;
|
|
94
|
+
z-index: 3;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#controls-top-left {
|
|
98
|
+
top: 10px;
|
|
99
|
+
left: 10px;
|
|
100
|
+
}
|
|
101
|
+
#controls-top-center {
|
|
102
|
+
top: 10px;
|
|
103
|
+
left: 50%;
|
|
104
|
+
transform: translateX(-50%);
|
|
105
|
+
z-index: 4;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
#controls-top-right {
|
|
109
|
+
top: 10px;
|
|
110
|
+
right: 10px;
|
|
111
|
+
justify-content: flex-end;
|
|
112
|
+
align-content: flex-end;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
#controls-center-left {
|
|
116
|
+
left: 10px;
|
|
117
|
+
top: 50%;
|
|
118
|
+
transform: translateY(-50%);
|
|
119
|
+
}
|
|
120
|
+
#controls-center-center {
|
|
121
|
+
top: 50%;
|
|
122
|
+
left: 50%;
|
|
123
|
+
transform: translate(-50%, -50%);
|
|
124
|
+
align-items: center;
|
|
125
|
+
justify-content: space-around;
|
|
126
|
+
z-index: 20;
|
|
127
|
+
}
|
|
128
|
+
#controls-center-right {
|
|
129
|
+
top: 50%;
|
|
130
|
+
right: 10px;
|
|
131
|
+
transform: translateY(-50%);
|
|
132
|
+
justify-content: flex-end;
|
|
133
|
+
align-items: center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
#controls-bottom-left {
|
|
137
|
+
bottom: 10px;
|
|
138
|
+
left: 10px;
|
|
139
|
+
z-index: 5;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
#controls-bottom-center {
|
|
143
|
+
bottom: 10px;
|
|
144
|
+
left: 50%;
|
|
145
|
+
transform: translateX(-50%);
|
|
146
|
+
align-items: flex-end;
|
|
147
|
+
justify-content: space-around;
|
|
148
|
+
z-index: 4;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
#controls-bottom-right {
|
|
152
|
+
bottom: 10px;
|
|
153
|
+
right: 10px;
|
|
154
|
+
justify-content: flex-end;
|
|
155
|
+
align-content: flex-end;
|
|
156
|
+
align-items: flex-end;
|
|
157
|
+
z-index: 5;
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="player-wrapper">
|
|
3
|
+
<div id="player-sizer">
|
|
4
|
+
<slot name="slideshow-image"></slot>
|
|
5
|
+
<div class="player-control" id="controls-top-left">
|
|
6
|
+
<slot name="top-left"></slot>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="player-control" id="controls-top-center">
|
|
9
|
+
<slot name="top-center"></slot>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="player-control" id="controls-top-right">
|
|
12
|
+
<slot name="top-right"></slot>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="player-control" id="controls-center-left">
|
|
15
|
+
<slot name="center-left"></slot>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="player-control" id="controls-center-center">
|
|
18
|
+
<slot name="center-center"></slot>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="player-control" id="controls-center-right">
|
|
21
|
+
<slot name="center-right"></slot>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="player-control" id="controls-bottom-left">
|
|
24
|
+
<slot name="bottom-left"></slot>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="player-control" id="controls-bottom-center">
|
|
27
|
+
<slot name="bottom-center"></slot>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="player-control" id="controls-bottom-right">
|
|
30
|
+
<slot name="bottom-right"></slot>
|
|
31
|
+
</div>
|
|
32
|
+
<div id="main-canvas">
|
|
33
|
+
<canvas
|
|
34
|
+
id="qpc"
|
|
35
|
+
:style="showStaticImage ? 'visibility:hidden' : 'visibility:visible'"
|
|
36
|
+
></canvas>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
<script>
|
|
42
|
+
import { PlayerV2 } from "@qispace/player-core";
|
|
43
|
+
import { isBrowser } from "browser-or-node";
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
name: "PlayerV2",
|
|
47
|
+
emits: [
|
|
48
|
+
"new-camera-callback",
|
|
49
|
+
"new-rotation-callback",
|
|
50
|
+
"new-floor-callback",
|
|
51
|
+
"new-fov-callback",
|
|
52
|
+
"playerApi-callback",
|
|
53
|
+
"new-size-callback",
|
|
54
|
+
],
|
|
55
|
+
props: {
|
|
56
|
+
fileLoader: {
|
|
57
|
+
type: Object,
|
|
58
|
+
default: undefined,
|
|
59
|
+
},
|
|
60
|
+
rootUrl: { type: String, required: true },
|
|
61
|
+
currentCameraId: { type: String, default: () => undefined },
|
|
62
|
+
showStaticImage: { type: Boolean, required: true },
|
|
63
|
+
isFullScreen: { type: Boolean, required: true },
|
|
64
|
+
mouseSensitivity: { type: Number, default: () => 1 },
|
|
65
|
+
isInIframe: { type: Boolean, default: () => false },
|
|
66
|
+
},
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
playerAPI: undefined,
|
|
70
|
+
playerCamera: undefined,
|
|
71
|
+
playerRotation: 0,
|
|
72
|
+
playerFoV: 0,
|
|
73
|
+
playerWidth: 0,
|
|
74
|
+
playerHeight: 0,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
watch: {
|
|
78
|
+
async rootUrl(newValue) {
|
|
79
|
+
if (this.playerAPI) {
|
|
80
|
+
await this.playerAPI.loadInterior(newValue, this.playerCamera, false);
|
|
81
|
+
this.setPlayerSize();
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
fileLoader: {
|
|
85
|
+
async handler(newValue) {
|
|
86
|
+
if (this.playerAPI) {
|
|
87
|
+
await this.playerAPI.loadInterior(this.rootUrl, undefined, false);
|
|
88
|
+
this.setPlayerSize();
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
deep: true,
|
|
92
|
+
},
|
|
93
|
+
currentCameraId(newCameraId) {
|
|
94
|
+
if (this.playerAPI) {
|
|
95
|
+
this.playerCamera = newCameraId;
|
|
96
|
+
this.playerAPI.goToCamera(newCameraId, true);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
playerAPI(playerAPI) {
|
|
100
|
+
this.$emit("playerApi-callback", playerAPI);
|
|
101
|
+
const firstCamera = playerAPI.getCurrentCamera();
|
|
102
|
+
if (firstCamera) {
|
|
103
|
+
this.playerCamera = firstCamera.id;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
async mounted() {
|
|
108
|
+
window.addEventListener("resize", this.setPlayerSize);
|
|
109
|
+
this.setPlayerSize();
|
|
110
|
+
|
|
111
|
+
const newRotation = (newRotation) => {
|
|
112
|
+
const rot = newRotation + 0;
|
|
113
|
+
|
|
114
|
+
this.$emit("new-rotation-callback", rot);
|
|
115
|
+
this.playerRotation = rot;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const newFOV = (newFov) => {
|
|
119
|
+
this.$emit("new-fov-callback", newFov);
|
|
120
|
+
this.playerFoV = newFov;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const newCamera = (newCamera) => {
|
|
124
|
+
this.$emit("new-camera-callback", newCamera.id);
|
|
125
|
+
this.$emit("new-floor-callback", newCamera.floorLevel);
|
|
126
|
+
|
|
127
|
+
if (this.playerAPI) {
|
|
128
|
+
this.playerAPI.resetMarkerBehaviour(0);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
this.playerCamera = newCamera.id;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const callbacks = {
|
|
135
|
+
initialized: () => {
|
|
136
|
+
this.playerAPI = PlayerV2.Main.getPlayerAPI();
|
|
137
|
+
const firstCamera = this.playerAPI.getCurrentCamera();
|
|
138
|
+
if (firstCamera) this.playerCamera = firstCamera.id;
|
|
139
|
+
this.$emit("new-camera-callback", this.playerCamera);
|
|
140
|
+
},
|
|
141
|
+
newCamera,
|
|
142
|
+
newFOV,
|
|
143
|
+
newRotation,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// constructor(public rootUrl: string, public target:string = 'qiplayerCanvas', events:EventManager, apartmentJson: string = undefined, startCameraId:string=undefined, fileLoader: LocalFileLoader | undefined) {
|
|
147
|
+
if (!isBrowser) return;
|
|
148
|
+
|
|
149
|
+
const mainScene = await new PlayerV2.Main(
|
|
150
|
+
this.rootUrl,
|
|
151
|
+
"qpc",
|
|
152
|
+
callbacks,
|
|
153
|
+
undefined,
|
|
154
|
+
this.currentCameraId,
|
|
155
|
+
this.fileLoader
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
if (mainScene) {
|
|
159
|
+
mainScene.handleWindowResize();
|
|
160
|
+
window.addEventListener(
|
|
161
|
+
"resize",
|
|
162
|
+
mainScene.handleWindowResize.bind(mainScene)
|
|
163
|
+
);
|
|
164
|
+
mainScene.animate();
|
|
165
|
+
|
|
166
|
+
this.playerAPI = PlayerV2.Main.getPlayerAPI();
|
|
167
|
+
|
|
168
|
+
if (this.playerAPI)
|
|
169
|
+
this.playerAPI.setLookSensitivity(this.mouseSensitivity);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
beforeUnmount() {
|
|
173
|
+
if (this.playerAPI) {
|
|
174
|
+
this.playerAPI.destroy();
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
methods: {
|
|
178
|
+
findClosestAncestor(element, className) {
|
|
179
|
+
let el = element;
|
|
180
|
+
let returnElement = element;
|
|
181
|
+
while ((el = el.parentNode) && el.className.indexOf(className) < 0);
|
|
182
|
+
returnElement = el;
|
|
183
|
+
|
|
184
|
+
return returnElement;
|
|
185
|
+
},
|
|
186
|
+
setPlayerSize() {
|
|
187
|
+
let AR = 16 / 9;
|
|
188
|
+
let element = document.querySelector("#player-sizer");
|
|
189
|
+
if (!element) return;
|
|
190
|
+
|
|
191
|
+
let width = element.offsetWidth;
|
|
192
|
+
let height = width * (1 / AR);
|
|
193
|
+
|
|
194
|
+
if (window.innerWidth <= 600 || width <= 600) {
|
|
195
|
+
height = window.innerHeight * 0.75;
|
|
196
|
+
|
|
197
|
+
if (this.isInIframe) {
|
|
198
|
+
height = screen.height * 0.65;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
width = height * (1 / AR);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
element.style.height = height + "px";
|
|
205
|
+
element.style.width = width + "px";
|
|
206
|
+
this.$emit("new-size-callback", width, height);
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
</script>
|
|
211
|
+
<style scoped>
|
|
212
|
+
#player-wrapper {
|
|
213
|
+
position: relative;
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
#player-sizer {
|
|
218
|
+
display: flex;
|
|
219
|
+
justify-content: center;
|
|
220
|
+
align-items: center;
|
|
221
|
+
overflow: hidden;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
div#main-canvas {
|
|
225
|
+
top: 50%;
|
|
226
|
+
left: 50%;
|
|
227
|
+
position: absolute;
|
|
228
|
+
transform: translate(-50%, -50%);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.player-control {
|
|
232
|
+
display: flex;
|
|
233
|
+
position: absolute;
|
|
234
|
+
z-index: 3;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
#controls-top-left {
|
|
238
|
+
top: 10px;
|
|
239
|
+
left: 10px;
|
|
240
|
+
}
|
|
241
|
+
#controls-top-center {
|
|
242
|
+
top: 10px;
|
|
243
|
+
left: 50%;
|
|
244
|
+
transform: translateX(-50%);
|
|
245
|
+
z-index: 4;
|
|
246
|
+
flex-direction: column;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
#controls-top-right {
|
|
250
|
+
top: 10px;
|
|
251
|
+
right: 10px;
|
|
252
|
+
justify-content: flex-end;
|
|
253
|
+
align-content: flex-end;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
#controls-center-left {
|
|
257
|
+
left: 10px;
|
|
258
|
+
top: 50%;
|
|
259
|
+
transform: translateY(-50%);
|
|
260
|
+
}
|
|
261
|
+
#controls-center-center {
|
|
262
|
+
top: 50%;
|
|
263
|
+
left: 50%;
|
|
264
|
+
transform: translate(-50%, -50%);
|
|
265
|
+
align-items: center;
|
|
266
|
+
justify-content: space-around;
|
|
267
|
+
z-index: 20;
|
|
268
|
+
}
|
|
269
|
+
#controls-center-right {
|
|
270
|
+
top: 50%;
|
|
271
|
+
right: 10px;
|
|
272
|
+
transform: translateY(-50%);
|
|
273
|
+
justify-content: flex-end;
|
|
274
|
+
align-items: center;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
#controls-bottom-left {
|
|
278
|
+
bottom: 10px;
|
|
279
|
+
left: 10px;
|
|
280
|
+
z-index: 5;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
#controls-bottom-center {
|
|
284
|
+
bottom: 10px;
|
|
285
|
+
left: 50%;
|
|
286
|
+
transform: translateX(-50%);
|
|
287
|
+
align-items: flex-end;
|
|
288
|
+
justify-content: space-around;
|
|
289
|
+
z-index: 4;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
#controls-bottom-right {
|
|
293
|
+
bottom: 10px;
|
|
294
|
+
right: 10px;
|
|
295
|
+
justify-content: flex-end;
|
|
296
|
+
align-content: flex-end;
|
|
297
|
+
align-items: flex-end;
|
|
298
|
+
z-index: 5;
|
|
299
|
+
}
|
|
300
|
+
</style>
|