@realsee/vreo 0.2.0-alpha.3 → 0.2.0-alpha.6

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.
Files changed (55) hide show
  1. package/README.md +20 -3
  2. package/docs/assets/custom.css +2 -2
  3. package/docs/assets/search.js +1 -1
  4. package/docs/classes/Player.Controller.html +3 -3
  5. package/docs/classes/Player.Player-1.html +3 -3
  6. package/docs/classes/Player.VideoAgentMesh.html +11 -11
  7. package/docs/classes/Player.VideoAgentScene.html +1 -1
  8. package/docs/enums/Player.InfoPanelStyleEnum.html +1 -0
  9. package/docs/enums/Player.InfoPanelTypeEnum.html +1 -1
  10. package/docs/enums/Player.PanoEffectEnum.html +1 -1
  11. package/docs/enums/Player.PanoTagEnum.html +1 -1
  12. package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
  13. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  14. package/docs/enums/fivePlugins.Rotation.html +1 -1
  15. package/docs/index.html +6 -2
  16. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
  17. package/docs/interfaces/Player.PlayerConfigs.html +2 -2
  18. package/docs/interfaces/Player.Vertex.html +1 -1
  19. package/docs/interfaces/Player.VideoAgentMeshOptions.html +1 -1
  20. package/docs/interfaces/Player.VreoKeyframe.html +1 -1
  21. package/docs/interfaces/Player.VreoUnit.html +1 -1
  22. package/docs/interfaces/Player.VreoVideo.html +1 -1
  23. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
  24. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
  25. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  26. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  27. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  28. package/docs/interfaces/react.VreoActionCallbacks.html +6 -6
  29. package/docs/interfaces/react.VreoProviderProps.html +1 -1
  30. package/docs/modules/Player.html +13 -13
  31. package/docs/modules/custom.html +1 -1
  32. package/docs/modules/fivePlugins.html +2 -2
  33. package/docs/modules/react.html +1 -1
  34. package/lib/Player/Controller.d.ts +2 -0
  35. package/lib/Player/Controller.js +14 -0
  36. package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -2
  37. package/lib/Player/custom/SpatialScenePanel/index.js +14 -14
  38. package/lib/Player/index.js +3 -1
  39. package/lib/Player/modules/PopUp/index.d.ts +2 -0
  40. package/lib/Player/modules/PopUp/index.js +43 -0
  41. package/lib/Player/modules/keyframes/InfoPanel/index.js +73 -35
  42. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +4 -12
  43. package/lib/fivePlugins/CameraMovementPlugin/index.js +3 -2
  44. package/lib/typings/VreoUnit.d.ts +5 -0
  45. package/lib/typings/VreoUnit.js +14 -6
  46. package/package.json +1 -1
  47. package/resources/Player/Controller.ts +12 -0
  48. package/resources/Player/custom/SpatialScenePanel/index.tsx +68 -41
  49. package/resources/Player/index.tsx +2 -0
  50. package/resources/Player/modules/PopUp/index.tsx +26 -0
  51. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +79 -34
  52. package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +2 -2
  53. package/resources/fivePlugins/CameraMovementPlugin/index.ts +1 -0
  54. package/resources/typings/VreoUnit.ts +6 -0
  55. package/stylesheets/default.css +66 -0
@@ -75,49 +75,87 @@ function InfoPanel() {
75
75
  data = keyframe.data;
76
76
  var infoPanelData = data;
77
77
  var title = infoPanelData.title,
78
- subTitle = infoPanelData.subTitle;
79
-
80
- if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
81
- controller.openDrawer({
82
- content: /*#__PURE__*/React.createElement(InfoPanelImg, {
83
- url: infoPanelData.url
84
- }, /*#__PURE__*/React.createElement(Title, {
85
- title: title,
86
- subTitle: subTitle
87
- })),
88
- height: '60vh'
89
- });
90
- } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
91
- controller.openDrawer({
92
- content: /*#__PURE__*/React.createElement(InfoPanelVideo, {
93
- url: infoPanelData.url
94
- }, /*#__PURE__*/React.createElement(Title, {
95
- title: title,
96
- subTitle: subTitle
97
- })),
98
- height: '60vh'
99
- });
100
- }
78
+ subTitle = infoPanelData.subTitle,
79
+ style = infoPanelData.style;
80
+
81
+ do {
82
+ if (style === _VreoUnit.InfoPanelStyleEnum.PopUp) {
83
+ if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
84
+ controller.openPopUp( /*#__PURE__*/React.createElement(InfoPanelImg, {
85
+ url: infoPanelData.url
86
+ }, /*#__PURE__*/React.createElement(Title, {
87
+ title: title,
88
+ subTitle: subTitle
89
+ })));
90
+ } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
91
+ controller.openPopUp( /*#__PURE__*/React.createElement(InfoPanelVideo, {
92
+ url: infoPanelData.url
93
+ }, /*#__PURE__*/React.createElement(Title, {
94
+ title: title,
95
+ subTitle: subTitle
96
+ })));
97
+ }
98
+
99
+ break;
100
+ }
101
+
102
+ if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
103
+ controller.openDrawer({
104
+ content: /*#__PURE__*/React.createElement(InfoPanelImg, {
105
+ url: infoPanelData.url
106
+ }, /*#__PURE__*/React.createElement(Title, {
107
+ title: title,
108
+ subTitle: subTitle
109
+ })),
110
+ height: '60vh'
111
+ });
112
+ } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
113
+ controller.openDrawer({
114
+ content: /*#__PURE__*/React.createElement(InfoPanelVideo, {
115
+ url: infoPanelData.url
116
+ }, /*#__PURE__*/React.createElement(Title, {
117
+ title: title,
118
+ subTitle: subTitle
119
+ })),
120
+ height: '60vh'
121
+ });
122
+ }
123
+ } while (false);
101
124
 
102
125
  timeoutRef.current = setTimeout(function () {
103
- return controller.openDrawer(false);
126
+ controller.openDrawer(false);
127
+ controller.openPopUp(false);
104
128
  }, end - start);
105
129
  };
106
130
 
107
131
  controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback); // Object.assign(window, {
108
132
  // $setInfoPanel: () => {
109
- // controller.openDrawer({
110
- // content: (
111
- // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif'>
112
- // // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
113
- // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
114
- // // </InfoPanelImg>
115
- // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
133
+ // controller.openPopUp(
134
+ // // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
135
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
136
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
137
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
138
+ // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
116
139
  // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
117
- // </InfoPanelVideo>
118
- // ),
119
- // height: '60vh',
120
- // })
140
+ // </InfoPanelImg>
141
+ // // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
142
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
143
+ // // </InfoPanelVideo>
144
+ // )
145
+ // },
146
+ // $setInfoPanel2: () => {
147
+ // controller.openPopUp(
148
+ // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
149
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
150
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
151
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
152
+ // // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
153
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
154
+ // // </InfoPanelImg>
155
+ // // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
156
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
157
+ // // </InfoPanelVideo>
158
+ // )
121
159
  // },
122
160
  // })
123
161
 
@@ -63,12 +63,8 @@ function PanoTextLabel() {
63
63
  var res = project2d(new _three.Vector3(x, y, z));
64
64
  if (!res) return;
65
65
  var left = res.x,
66
- top = res.y;
67
- Object.assign(window, {
68
- $PanoTextLabel: {
69
- setState: setState
70
- }
71
- });
66
+ top = res.y; // Object.assign(window, { $PanoTextLabel: { setState } })
67
+
72
68
  setState({
73
69
  left: left,
74
70
  top: top,
@@ -80,12 +76,8 @@ function PanoTextLabel() {
80
76
  }, end - start);
81
77
  };
82
78
 
83
- controller.on(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
84
- Object.assign(window, {
85
- $panoTextLabel: {
86
- setState: setState
87
- }
88
- });
79
+ controller.on(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback); // Object.assign(window, { $panoTextLabel: { setState } })
80
+
89
81
  return function () {
90
82
  controller.off(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
91
83
 
@@ -241,8 +241,9 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
241
241
  // 移动结束
242
242
  moveCancelCallback: function moveCancelCallback() {
243
243
  return reject(false);
244
- } // 移动开始
245
-
244
+ },
245
+ // 移动开始
246
+ effect: 'fade'
246
247
  });
247
248
  });
248
249
 
@@ -210,11 +210,16 @@ export declare enum InfoPanelTypeEnum {
210
210
  Image = "Image",
211
211
  Video = "Video"
212
212
  }
213
+ export declare enum InfoPanelStyleEnum {
214
+ Drawer = "Drawer",
215
+ PopUp = "PopUp"
216
+ }
213
217
  /**
214
218
  * 信息面板
215
219
  */
216
220
  export declare type InfoPanelData = {
217
221
  type: InfoPanelTypeEnum;
222
+ style?: InfoPanelStyleEnum;
218
223
  url: string;
219
224
  title?: string;
220
225
  subTitle?: string;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.VreoKeyframeEnum = exports.PanoTagEnum = exports.PanoEffectEnum = exports.InfoPanelTypeEnum = void 0;
6
+ exports.VreoKeyframeEnum = exports.PanoTagEnum = exports.PanoEffectEnum = exports.InfoPanelTypeEnum = exports.InfoPanelStyleEnum = void 0;
7
7
  var VreoKeyframeEnum;
8
8
  /**
9
9
  * 支持自定义剧本关键帧配置项
@@ -55,13 +55,21 @@ exports.PanoEffectEnum = PanoEffectEnum;
55
55
  * 信息面板类型枚举
56
56
  */
57
57
  var InfoPanelTypeEnum;
58
- /**
59
- * 信息面板
60
- */
61
-
62
58
  exports.InfoPanelTypeEnum = InfoPanelTypeEnum;
63
59
 
64
60
  (function (InfoPanelTypeEnum) {
65
61
  InfoPanelTypeEnum["Image"] = "Image";
66
62
  InfoPanelTypeEnum["Video"] = "Video";
67
- })(InfoPanelTypeEnum || (exports.InfoPanelTypeEnum = InfoPanelTypeEnum = {}));
63
+ })(InfoPanelTypeEnum || (exports.InfoPanelTypeEnum = InfoPanelTypeEnum = {}));
64
+
65
+ var InfoPanelStyleEnum;
66
+ /**
67
+ * 信息面板
68
+ */
69
+
70
+ exports.InfoPanelStyleEnum = InfoPanelStyleEnum;
71
+
72
+ (function (InfoPanelStyleEnum) {
73
+ InfoPanelStyleEnum["Drawer"] = "Drawer";
74
+ InfoPanelStyleEnum["PopUp"] = "PopUp";
75
+ })(InfoPanelStyleEnum || (exports.InfoPanelStyleEnum = InfoPanelStyleEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realsee/vreo",
3
- "version": "0.2.0-alpha.3",
3
+ "version": "0.2.0-alpha.6",
4
4
  "description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
5
5
  "keywords": [
6
6
  "realsee",
@@ -24,6 +24,16 @@ export class Controller extends Subscribe<VreoKeyframeEvent> {
24
24
  return !this.videoAgentScene?.videoAgentMesh.videoUrl?.endsWith('.mp4')
25
25
  }
26
26
 
27
+ popUp: string | JSX.Element | null = null
28
+
29
+ openPopUp(popUp: string | JSX.Element | false) {
30
+ if (!popUp) {
31
+ this.popUp = null
32
+ return
33
+ }
34
+ this.popUp = popUp
35
+ }
36
+
27
37
  drawerConfig: {
28
38
  content: string | JSX.Element
29
39
  height?: number | string
@@ -57,6 +67,8 @@ export class Controller extends Subscribe<VreoKeyframeEvent> {
57
67
  setVisible: action,
58
68
  playing: observable,
59
69
  setPlaying: action,
70
+ popUp: observable.ref,
71
+ openPopUp: action,
60
72
  drawerConfig: observable.ref,
61
73
  openDrawer: action,
62
74
  })
@@ -8,6 +8,29 @@ import { CSS3DRenderPlugin, CSS3DRenderPluginExportType } from '@realsee/dnaloge
8
8
  import { VreoKeyframe, VreoKeyframeEnum } from '../../../typings/VreoUnit'
9
9
  import { CustomVreoKeyframeProps } from '../../typings'
10
10
 
11
+ // const mockData: SpatialScenePanelData = {
12
+ // customType: 'SpatialScenePanel',
13
+ // "stateList": [
14
+ // {
15
+ // "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___fc42f951076607a22fd5c54f005ba553.png",
16
+ // "text": "窗帘关闭"
17
+ // },
18
+ // {
19
+ // "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___b331e7ad732debc07250a169a3393b13.png",
20
+ // "text": "摄像头休眠"
21
+ // },
22
+ // {
23
+ // "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___2e425a81ac0ad88232d50d4e52a9abfa.png",
24
+ // "text": "氛围音乐"
25
+ // },
26
+ // {
27
+ // "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___bff48bb81cde37aa6a319d6f5d56e3a4.png",
28
+ // "text": "空调打开"
29
+ // }
30
+ // ],
31
+ // "temperature": "27",
32
+ // "title": "沉浸式回家"
33
+ // }
11
34
  export interface SpatialScenePanelData {
12
35
  customType: 'SpatialScenePanel'
13
36
  title: string
@@ -16,19 +39,27 @@ export interface SpatialScenePanelData {
16
39
  text: string
17
40
  icon: string
18
41
  }[]
19
- position: { x: number; y: number; z: number }
20
- quaternion: [number, number, number, number]
42
+ position?: { x: number; y: number; z: number }
43
+ quaternion?: [number, number, number, number]
21
44
  }
22
45
 
23
46
  interface SearchParams {
24
47
  five: Five
25
- position: Vector3
26
- rotation?: Vector3
27
- quaternion: [number, number, number, number]
28
- dom: HTMLDivElement
48
+ // position: Vector3
49
+ // rotation?: Vector3
50
+ // quaternion: [number, number, number, number]
51
+ dom: HTMLDivElement
29
52
  }
30
53
 
31
- const searchV1 = ({ five, position, rotation, dom }: SearchParams) => {
54
+ // const getSphere = (position: Vector3, color = 0xffff00) => {
55
+ // const geometry = new SphereGeometry(0.05, 32, 16)
56
+ // const material = new MeshBasicMaterial({ color })
57
+ // const sphere = new Mesh(geometry, material)
58
+ // sphere.position.copy(position)
59
+ // return sphere
60
+ // }
61
+
62
+ const searchV1 = ({ five, dom }: SearchParams) => {
32
63
  const cameraDirection = new Vector3()
33
64
  five.camera.getWorldDirection(cameraDirection)
34
65
  const cameraPosition = five.camera.position
@@ -48,16 +79,17 @@ const searchV1 = ({ five, position, rotation, dom }: SearchParams) => {
48
79
  const rightBottom = new Vector3(right, bottom)
49
80
 
50
81
  const points = [leftBottom, rightBottom, rightTop, leftTop].map((point) => {
51
- point.setX((point.x / window.innerWidth) * 2 - 1)
82
+ point.setX((point.x / window.innerWidth) * 2 - 1.25)
52
83
  point.setY(-(point.y / window.innerHeight) * 2 + 1)
53
84
  point.setZ(0.5)
54
85
  return point.unproject(five.camera).addScaledVector(cameraDirection, 0.2)
55
86
  })
56
87
 
88
+ // __debug__
57
89
  // const colors = [0xdc143c, 0xffff00, 0x0000ff, 0x008000]
58
90
  // points.forEach((p, index) => five.scene.add(getSphere(p, colors[index])))
59
91
 
60
- const ratio = leftBottom.distanceTo(rightBottom) / 160
92
+ const ratio = leftBottom.distanceTo(rightBottom) / 150
61
93
  return { points, ratio }
62
94
  }
63
95
 
@@ -71,7 +103,6 @@ export function SpatialScenePanel(props: CustomVreoKeyframeProps) {
71
103
  const rendererRef = React.useRef<CSS3DRenderPluginExportType>(CSS3DRenderPlugin(props.five))
72
104
 
73
105
  React.useEffect(() => {
74
-
75
106
  if (!ref.current) {
76
107
  return
77
108
  }
@@ -82,49 +113,45 @@ export function SpatialScenePanel(props: CustomVreoKeyframeProps) {
82
113
  }
83
114
 
84
115
  const data = keyframe.data as SpatialScenePanelData
85
- // const data = mockData as SpatialScenePanelData
86
116
 
117
+ // const data = mockData
87
118
  const { points, ratio } = searchV1({
88
119
  five: props.five,
89
- position: new Vector3(data.position.x, data.position.y, data.position.z),
90
- quaternion: data.quaternion,
91
- dom: ref.current!
120
+ dom: ref.current!,
92
121
  })
93
122
 
94
- console.log(points, ratio)
95
-
96
123
  const { container, dispose, css3DObject, render } =
97
124
  rendererRef.current.create3DDomContainer(points, { ratio, autoRender: false }) || {}
98
125
 
99
126
  if (!container) return
100
127
 
101
-
102
128
  ReactDOM.render(<Panel ref={(ref) => (panelRef.current = ref)} data={data} />, container)
103
- const startRotateY = -(Math.PI * 2) / 9
104
- let lastRotateY = 0
105
- tweenProgress(1000)
106
- .onUpdate(({ progress }) => {
107
- const needRotateY = (Math.PI / 90) * 11 * progress
108
- const rotateY = needRotateY - lastRotateY
109
- css3DObject?.rotateY(rotateY)
110
- lastRotateY = needRotateY
111
- })
112
- .onStart(() => {
113
- css3DObject?.rotateY(startRotateY)
114
- render!()
115
- })
116
- .onDispose(() => {
117
- panelRef.current?.classList.add('show')
118
- })
119
- .play()
120
- const { start, end } = keyframe
121
- setTimeout(() => {
122
- panelRef.current?.classList.add('hide')
123
- setTimeout(() => dispose?.(), 1500)
124
- }, end - start)
129
+ const startRotateY = -(Math.PI * 2) / 9
130
+ let lastRotateY = 0
131
+ tweenProgress(1000)
132
+ .onUpdate(({ progress }) => {
133
+ const needRotateY = (Math.PI / 90) * 11 * progress
134
+ const rotateY = needRotateY - lastRotateY
135
+ css3DObject?.rotateY(rotateY)
136
+ lastRotateY = needRotateY
137
+ })
138
+ .onStart(() => {
139
+ css3DObject?.rotateY(startRotateY)
140
+ render!()
141
+ })
142
+ .onDispose(() => {
143
+ panelRef.current?.classList.add('show')
144
+ })
145
+ .play()
146
+ const { start, end } = keyframe
147
+
148
+ setTimeout(() => {
149
+ panelRef.current?.classList.add('hide')
150
+ setTimeout(() => dispose?.(), 1500)
151
+ }, end - start)
125
152
  }
126
153
 
127
- Object.assign(window, {$SpatialScenePanelCallback: callback})
154
+ // Object.assign(window, { $callback: callback })
128
155
  props.subscribe.on(VreoKeyframeEnum.Custom, callback)
129
156
 
130
157
  return () => {
@@ -157,5 +184,5 @@ const Panel = React.forwardRef(
157
184
 
158
185
  <div className="SpatialScenePanel-disappear-area"></div>
159
186
  </div>
160
- ),
187
+ )
161
188
  )
@@ -8,6 +8,7 @@ import { VreoKeyframeEvent, VreoUnit } from '../typings/VreoUnit'
8
8
  import { reaction } from 'mobx'
9
9
  import { Drawer } from './modules/Drawer'
10
10
  import { PlayerConfigs } from './typings'
11
+ import { PopUp } from './modules/PopUp'
11
12
 
12
13
  export class Player extends Subscribe<VreoKeyframeEvent> {
13
14
  $five: Five
@@ -42,6 +43,7 @@ export class Player extends Subscribe<VreoKeyframeEvent> {
42
43
  <ControllerContext.Provider value={this.controller}>
43
44
  <App></App>
44
45
  <Drawer />
46
+ <PopUp />
45
47
  {this.configs.customKeyframes &&
46
48
  this.configs.customKeyframes.map((CustomCmpt, key) => (
47
49
  <CustomCmpt
@@ -0,0 +1,26 @@
1
+ import * as React from 'react'
2
+ import classNames from 'classnames'
3
+ import { observer } from 'mobx-react'
4
+ import { Controller } from '../../Controller'
5
+ import { useController } from '../../hooks'
6
+
7
+ const PopUpView = observer(({ controller }: { controller: Controller }) => {
8
+
9
+ return (
10
+ <div
11
+ className={classNames('vreo-PopUp', {
12
+ 'vreo-PopUp-visible': controller.popUp,
13
+ })}
14
+ onClick={() => controller.openPopUp(false)}
15
+ >
16
+ <div className="vreo-PopUp-inner">
17
+ {controller.popUp || ''}
18
+ </div>
19
+ </div>
20
+ )
21
+ })
22
+
23
+ export function PopUp() {
24
+ const controller = useController()
25
+ return <PopUpView controller={controller} />
26
+ }
@@ -1,6 +1,12 @@
1
1
  import * as React from 'react'
2
2
  import { ReactNode } from 'react'
3
- import { InfoPanelData, InfoPanelTypeEnum, VreoKeyframe, VreoKeyframeEnum } from '../../../../typings/VreoUnit'
3
+ import {
4
+ InfoPanelData,
5
+ InfoPanelStyleEnum,
6
+ InfoPanelTypeEnum,
7
+ VreoKeyframe,
8
+ VreoKeyframeEnum,
9
+ } from '../../../../typings/VreoUnit'
4
10
  import { useController } from '../../../hooks'
5
11
 
6
12
  function InfoPanelImg({ url, children }: { url: string; children?: ReactNode }) {
@@ -16,7 +22,9 @@ function InfoPanelVideo({ url, children }: { url: string; children?: ReactNode }
16
22
  return (
17
23
  <div className="vreo-infoPanel vreo-infoPanel--video">
18
24
  {children}
19
- <div className="vreo-infoPanelWrapper"><video playsInline autoPlay className="vreo-infoPanelVideo" src={url} /></div>
25
+ <div className="vreo-infoPanelWrapper">
26
+ <video playsInline autoPlay className="vreo-infoPanelVideo" src={url} />
27
+ </div>
20
28
  </div>
21
29
  )
22
30
  }
@@ -47,49 +55,86 @@ export function InfoPanel() {
47
55
  if (controller.configs?.keyframeMap.InfoPanel === false) {
48
56
  return
49
57
  }
58
+
50
59
  const callback = (keyframe: VreoKeyframe) => {
51
60
  const { start, end, data } = keyframe
52
61
 
53
62
  const infoPanelData = data as InfoPanelData
54
63
 
55
- const { title, subTitle } = infoPanelData
56
- if (infoPanelData.type === InfoPanelTypeEnum.Image) {
57
- controller.openDrawer({
58
- content: (
59
- <InfoPanelImg url={infoPanelData.url}>
60
- <Title title={title} subTitle={subTitle} />
61
- </InfoPanelImg>
62
- ),
63
- height: '60vh',
64
- })
65
- } else if (infoPanelData.type === InfoPanelTypeEnum.Video) {
66
- controller.openDrawer({
67
- content: (
68
- <InfoPanelVideo url={infoPanelData.url}>
69
- <Title title={title} subTitle={subTitle} />
70
- </InfoPanelVideo>
71
- ),
72
- height: '60vh',
73
- })
74
- }
75
- timeoutRef.current = setTimeout(() => controller.openDrawer(false), end - start)
64
+ const { title, subTitle, style } = infoPanelData
65
+ do {
66
+ if (style === InfoPanelStyleEnum.PopUp) {
67
+ if (infoPanelData.type === InfoPanelTypeEnum.Image) {
68
+ controller.openPopUp(
69
+ <InfoPanelImg url={infoPanelData.url}>
70
+ <Title title={title} subTitle={subTitle} />
71
+ </InfoPanelImg>
72
+ )
73
+ } else if (infoPanelData.type === InfoPanelTypeEnum.Video) {
74
+ controller.openPopUp(
75
+ <InfoPanelVideo url={infoPanelData.url}>
76
+ <Title title={title} subTitle={subTitle} />
77
+ </InfoPanelVideo>
78
+ )
79
+ }
80
+ break
81
+ }
82
+ if (infoPanelData.type === InfoPanelTypeEnum.Image) {
83
+ controller.openDrawer({
84
+ content: (
85
+ <InfoPanelImg url={infoPanelData.url}>
86
+ <Title title={title} subTitle={subTitle} />
87
+ </InfoPanelImg>
88
+ ),
89
+ height: '60vh',
90
+ })
91
+ } else if (infoPanelData.type === InfoPanelTypeEnum.Video) {
92
+ controller.openDrawer({
93
+ content: (
94
+ <InfoPanelVideo url={infoPanelData.url}>
95
+ <Title title={title} subTitle={subTitle} />
96
+ </InfoPanelVideo>
97
+ ),
98
+ height: '60vh',
99
+ })
100
+ }
101
+ } while (false)
102
+
103
+ timeoutRef.current = setTimeout(() => {
104
+ controller.openDrawer(false)
105
+ controller.openPopUp(false)
106
+ }, end - start)
76
107
  }
77
108
  controller.on(VreoKeyframeEnum.InfoPanel, callback)
78
109
 
79
110
  // Object.assign(window, {
80
111
  // $setInfoPanel: () => {
81
- // controller.openDrawer({
82
- // content: (
83
- // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif'>
84
- // // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
85
- // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
86
- // // </InfoPanelImg>
87
- // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
112
+ // controller.openPopUp(
113
+ // // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
114
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
115
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
116
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
117
+ // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
88
118
  // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
89
- // </InfoPanelVideo>
90
- // ),
91
- // height: '60vh',
92
- // })
119
+ // </InfoPanelImg>
120
+ // // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
121
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
122
+ // // </InfoPanelVideo>
123
+ // )
124
+ // },
125
+ // $setInfoPanel2: () => {
126
+ // controller.openPopUp(
127
+ // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
128
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
129
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
130
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
131
+ // // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
132
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
133
+ // // </InfoPanelImg>
134
+ // // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
135
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
136
+ // // </InfoPanelVideo>
137
+ // )
93
138
  // },
94
139
  // })
95
140
 
@@ -30,13 +30,13 @@ export function PanoTextLabel() {
30
30
  if (!res) return
31
31
  const { x: left, y: top } = res
32
32
 
33
- Object.assign(window, { $PanoTextLabel: { setState } })
33
+ // Object.assign(window, { $PanoTextLabel: { setState } })
34
34
  setState({ left, top, text: data.text || '', fontSize: data.fontSize || 16 })
35
35
  timeoutRef.current = setTimeout(() => setState(null), end - start)
36
36
  }
37
37
  controller.on(VreoKeyframeEnum.PanoTextLabel, callback)
38
38
 
39
- Object.assign(window, { $panoTextLabel: { setState } })
39
+ // Object.assign(window, { $panoTextLabel: { setState } })
40
40
  return () => {
41
41
  controller.off(VreoKeyframeEnum.PanoTextLabel, callback)
42
42
  if (timeoutRef.current) {
@@ -156,6 +156,7 @@ export const CameraMovementPlugin: FivePlugin<CameraMovementPluginParameterType,
156
156
  five.moveToPano(args.panoIndex, {
157
157
  moveEndCallback: () => resolve(true), // 移动结束
158
158
  moveCancelCallback: () => reject(false), // 移动开始
159
+ effect: 'fade',
159
160
  })
160
161
  })
161
162
  }