@ray-js/ipc-player-integration 0.0.28 → 0.0.29-beta.1
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/lib/ctx/ctx.js +10 -2
- package/lib/ctx/multiCameraCtx.d.ts +73 -0
- package/lib/ctx/multiCameraCtx.js +176 -0
- package/lib/features/initPlayerWidgets/index.d.ts +5 -4
- package/lib/features/initPlayerWidgets/index.js +7 -0
- package/lib/features/initPlayerWidgets/multiCamera.d.ts +8 -0
- package/lib/features/initPlayerWidgets/multiCamera.js +78 -0
- package/lib/i18n/index.d.ts +20 -0
- package/lib/i18n/strings.d.ts +10 -0
- package/lib/i18n/strings.js +12 -2
- package/lib/iconfont/iconfont.css +197 -4
- package/lib/iconfont/iconfont.js +13 -13
- package/lib/iconfont/iconfont.json +336 -0
- package/lib/iconfont/iconfont.ttf +0 -0
- package/lib/iconfont/iconfont.woff +0 -0
- package/lib/iconfont/iconfont.woff2 +0 -0
- package/lib/interface.d.ts +90 -4
- package/lib/interface.js +56 -1
- package/lib/ui/constant.d.ts +6 -0
- package/lib/ui/constant.js +6 -0
- package/lib/ui/ui.js +187 -17
- package/lib/ui/ui.less +19 -21
- package/lib/utils/storage/index.d.ts +1 -0
- package/lib/utils/storage/index.js +8 -1
- package/lib/widgets/battery/battery.composition.d.ts +60 -4
- package/lib/widgets/fullScreen/fullScreen.js +5 -3
- package/lib/widgets/index.d.ts +2 -0
- package/lib/widgets/index.js +3 -1
- package/lib/widgets/multiCamera/constants.d.ts +1 -0
- package/lib/widgets/multiCamera/constants.js +1 -0
- package/lib/widgets/multiCamera/index.d.ts +8 -0
- package/lib/widgets/multiCamera/index.js +8 -0
- package/lib/widgets/multiCamera/index.less +214 -0
- package/lib/widgets/multiCamera/landscapeTip.d.ts +6 -0
- package/lib/widgets/multiCamera/landscapeTip.js +40 -0
- package/lib/widgets/multiCamera/moveView/index.d.ts +9 -0
- package/lib/widgets/multiCamera/moveView/index.js +22 -0
- package/lib/widgets/multiCamera/moveView/tyComponent/index.d.ts +1 -0
- package/lib/widgets/multiCamera/moveView/tyComponent/index.js +42 -0
- package/lib/widgets/multiCamera/moveView/tyComponent/index.json +3 -0
- package/lib/widgets/multiCamera/moveView/tyComponent/index.tyml +8 -0
- package/lib/widgets/multiCamera/moveView/tyComponent/index.tyss +4 -0
- package/lib/widgets/multiCamera/moveView/utils.d.ts +1 -0
- package/lib/widgets/multiCamera/moveView/utils.js +29 -0
- package/lib/widgets/multiCamera/moveablePtzControl.d.ts +22 -0
- package/lib/widgets/multiCamera/moveablePtzControl.js +302 -0
- package/lib/widgets/multiCamera/multiPtz.d.ts +11 -0
- package/lib/widgets/multiCamera/multiPtz.js +46 -0
- package/lib/widgets/multiCamera/ptzMoveableTip.d.ts +8 -0
- package/lib/widgets/multiCamera/ptzMoveableTip.js +66 -0
- package/lib/widgets/multiCamera/switchLayout.d.ts +8 -0
- package/lib/widgets/multiCamera/switchLayout.js +57 -0
- package/lib/widgets/multiCamera/tileActions.d.ts +6 -0
- package/lib/widgets/multiCamera/tileActions.js +15 -0
- package/lib/widgets/multiCamera/tileMultiPtz.d.ts +11 -0
- package/lib/widgets/multiCamera/tileMultiPtz.js +48 -0
- package/lib/widgets/multiCamera/tileSwitchLayout.d.ts +8 -0
- package/lib/widgets/multiCamera/tileSwitchLayout.js +38 -0
- package/lib/widgets/multiCamera/tileTip.d.ts +6 -0
- package/lib/widgets/multiCamera/tileTip.js +50 -0
- package/lib/widgets/ptz/ptz.less +15 -8
- package/lib/widgets/smallIntercom/index.d.ts +8 -0
- package/lib/widgets/smallIntercom/index.js +38 -0
- package/lib/widgets/smallIntercom/index.less +4 -0
- package/lib/widgets/voiceIntercom/voiceIntercom.d.ts +33 -2
- package/package.json +6 -5
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import { CoverView, View } from '@ray-js/ray';
|
|
4
|
+
import { getDpIdByCode, publishDps } from '@ray-js/ray-ipc-utils';
|
|
5
|
+
import _find from 'lodash/find';
|
|
6
|
+
import _get from 'lodash/get';
|
|
7
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
8
|
+
import IpcPtzZoom from '@ray-js/ipc-ptz-zoom';
|
|
9
|
+
import { useStore } from '../../ctx/store';
|
|
10
|
+
import { useMemoizedFn } from '../../hooks';
|
|
11
|
+
import { MultiCameraScreenMode } from '../../interface';
|
|
12
|
+
import { pauseTimeToHideAllComponent, startTimeToHideAllComponent } from '../../ui/constant';
|
|
13
|
+
import { UIEventContext } from '../../ui/context';
|
|
14
|
+
import { getEnumRangeIsValid } from '../../utils/device';
|
|
15
|
+
import Styles from '../ptz/ptz.less';
|
|
16
|
+
import { multiPrefix } from './constants';
|
|
17
|
+
import './index.less';
|
|
18
|
+
import MoveView from './moveView';
|
|
19
|
+
const getPtzData = devId => {
|
|
20
|
+
return [{
|
|
21
|
+
type: 'top',
|
|
22
|
+
show: getEnumRangeIsValid(devId, 'ptz_control', '0'),
|
|
23
|
+
dpValue: '0',
|
|
24
|
+
icon: 'ptz-arrow'
|
|
25
|
+
}, {
|
|
26
|
+
type: 'right',
|
|
27
|
+
show: getEnumRangeIsValid(devId, 'ptz_control', '2'),
|
|
28
|
+
dpValue: '2',
|
|
29
|
+
icon: 'ptz-arrow'
|
|
30
|
+
}, {
|
|
31
|
+
type: 'left',
|
|
32
|
+
show: getEnumRangeIsValid(devId, 'ptz_control', '6'),
|
|
33
|
+
dpValue: '6',
|
|
34
|
+
icon: 'ptz-arrow'
|
|
35
|
+
}, {
|
|
36
|
+
type: 'bottom',
|
|
37
|
+
show: getEnumRangeIsValid(devId, 'ptz_control', '4'),
|
|
38
|
+
dpValue: '4',
|
|
39
|
+
icon: 'ptz-arrow'
|
|
40
|
+
}];
|
|
41
|
+
};
|
|
42
|
+
const getZoomData = devId => {
|
|
43
|
+
return [{
|
|
44
|
+
type: 'zoomIn',
|
|
45
|
+
show: getEnumRangeIsValid(devId, 'zoom_control', '1'),
|
|
46
|
+
dpValue: '1',
|
|
47
|
+
icon: 'zoom-in'
|
|
48
|
+
}, {
|
|
49
|
+
type: 'zoomOut',
|
|
50
|
+
show: getEnumRangeIsValid(devId, 'zoom_control', '0'),
|
|
51
|
+
dpValue: '0',
|
|
52
|
+
icon: 'zoom-out'
|
|
53
|
+
}];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* 可移动的 PTZ 控制器,目前仅在多目使用
|
|
57
|
+
*/
|
|
58
|
+
export const MoveablePtzControlItem = props => {
|
|
59
|
+
const {
|
|
60
|
+
devId,
|
|
61
|
+
multiCameraCtx,
|
|
62
|
+
positionLeft = 24,
|
|
63
|
+
positionBottom = 90,
|
|
64
|
+
height = 172,
|
|
65
|
+
onDragStart,
|
|
66
|
+
onDragEnd
|
|
67
|
+
} = props;
|
|
68
|
+
const {
|
|
69
|
+
brandColor,
|
|
70
|
+
selectedLenInfo,
|
|
71
|
+
screenMode
|
|
72
|
+
} = useStore({
|
|
73
|
+
brandColor: props.brandColor,
|
|
74
|
+
selectedLenInfo: multiCameraCtx.selectedLenInfo,
|
|
75
|
+
screenMode: multiCameraCtx.screenMode
|
|
76
|
+
});
|
|
77
|
+
const [style, setStyle] = useState({
|
|
78
|
+
positionLeft,
|
|
79
|
+
positionBottom,
|
|
80
|
+
height
|
|
81
|
+
});
|
|
82
|
+
const moveDomRef = useRef();
|
|
83
|
+
const pageStartRef = useRef({
|
|
84
|
+
pageX: 0,
|
|
85
|
+
pageY: 0
|
|
86
|
+
});
|
|
87
|
+
const canMoveRef = useRef(false);
|
|
88
|
+
const {
|
|
89
|
+
event
|
|
90
|
+
} = useContext(UIEventContext);
|
|
91
|
+
const ptzTimeId = useRef(null);
|
|
92
|
+
const ptzData = useRef(getPtzData(devId));
|
|
93
|
+
const zoomData = useRef(getZoomData(devId));
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
const pages = getCurrentPages();
|
|
96
|
+
const page = pages[pages.length - 1];
|
|
97
|
+
const compTime = page.selectComponent('#moveable-ptz-control-move-view');
|
|
98
|
+
moveDomRef.current = compTime;
|
|
99
|
+
}, []);
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
return () => {
|
|
102
|
+
if (ptzTimeId.current) {
|
|
103
|
+
clearInterval(ptzTimeId.current);
|
|
104
|
+
ptzTimeId.current = null;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}, []);
|
|
108
|
+
const onTouchPtzStart = useMemoizedFn(async data => {
|
|
109
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
110
|
+
const {
|
|
111
|
+
type,
|
|
112
|
+
event: touchEvent
|
|
113
|
+
} = data;
|
|
114
|
+
touchEvent.stopPropagation();
|
|
115
|
+
const dpData = await getDpIdByCode(devId, 'ipc_multi_ptz_control');
|
|
116
|
+
if (dpData.code === 0) {
|
|
117
|
+
const ptzControlId = dpData.data;
|
|
118
|
+
const direction = _get(_find(ptzData.current, {
|
|
119
|
+
type
|
|
120
|
+
}), 'dpValue', null);
|
|
121
|
+
const sndDpValue = JSON.stringify({
|
|
122
|
+
index: selectedLenInfo.index,
|
|
123
|
+
direction
|
|
124
|
+
});
|
|
125
|
+
publishDps(devId, {
|
|
126
|
+
[ptzControlId]: sndDpValue
|
|
127
|
+
});
|
|
128
|
+
ptzTimeId.current = setInterval(() => {
|
|
129
|
+
publishDps(devId, {
|
|
130
|
+
[ptzControlId]: sndDpValue
|
|
131
|
+
});
|
|
132
|
+
}, 1000);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
const onTouchZoomStart = useMemoizedFn(async data => {
|
|
136
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
137
|
+
const {
|
|
138
|
+
type,
|
|
139
|
+
event: touchEvent
|
|
140
|
+
} = data;
|
|
141
|
+
touchEvent.stopPropagation();
|
|
142
|
+
const dpData = await getDpIdByCode(devId, 'ipc_multi_zoom_control');
|
|
143
|
+
if (dpData.code === 0) {
|
|
144
|
+
const ptzControlId = dpData.data;
|
|
145
|
+
const control = _get(_find(ptzData.current, {
|
|
146
|
+
type
|
|
147
|
+
}), 'dpValue', null);
|
|
148
|
+
const sndDpValue = JSON.stringify({
|
|
149
|
+
index: selectedLenInfo.index,
|
|
150
|
+
control
|
|
151
|
+
});
|
|
152
|
+
publishDps(devId, {
|
|
153
|
+
[ptzControlId]: sndDpValue
|
|
154
|
+
});
|
|
155
|
+
ptzTimeId.current = setInterval(() => {
|
|
156
|
+
publishDps(devId, {
|
|
157
|
+
[ptzControlId]: sndDpValue
|
|
158
|
+
});
|
|
159
|
+
}, 1000);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return /*#__PURE__*/React.createElement(CoverView, {
|
|
163
|
+
style: {
|
|
164
|
+
position: 'absolute',
|
|
165
|
+
zIndex: 89,
|
|
166
|
+
left: `${style.positionLeft}px`,
|
|
167
|
+
bottom: `${style.positionBottom}px`,
|
|
168
|
+
height: `${style.height}px`
|
|
169
|
+
}
|
|
170
|
+
}, /*#__PURE__*/React.createElement(MoveView, {
|
|
171
|
+
instanceId: "moveable-ptz-control-move-view"
|
|
172
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
173
|
+
onTouchMove: event => {
|
|
174
|
+
var _moveDomRef$current;
|
|
175
|
+
if (!canMoveRef.current || !moveDomRef.current) return;
|
|
176
|
+
const {
|
|
177
|
+
pageX,
|
|
178
|
+
pageY
|
|
179
|
+
} = event.changedTouches[0];
|
|
180
|
+
(_moveDomRef$current = moveDomRef.current) === null || _moveDomRef$current === void 0 || _moveDomRef$current.setStyle({
|
|
181
|
+
transform: `translateY(${pageY - pageStartRef.current.pageY}px) translateX(${pageX - pageStartRef.current.pageX}px)`
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
onTouchStart: event => {
|
|
185
|
+
onDragStart === null || onDragStart === void 0 || onDragStart({
|
|
186
|
+
positionLeft: style.positionLeft,
|
|
187
|
+
positionBottom: style.positionBottom
|
|
188
|
+
});
|
|
189
|
+
const {
|
|
190
|
+
pageX,
|
|
191
|
+
pageY
|
|
192
|
+
} = event.changedTouches[0];
|
|
193
|
+
pageStartRef.current = {
|
|
194
|
+
pageX,
|
|
195
|
+
pageY
|
|
196
|
+
};
|
|
197
|
+
canMoveRef.current = true;
|
|
198
|
+
ty.nativeDisabled(true);
|
|
199
|
+
},
|
|
200
|
+
onTouchEnd: event => {
|
|
201
|
+
if (!canMoveRef.current || !moveDomRef.current) return;
|
|
202
|
+
canMoveRef.current = false;
|
|
203
|
+
const {
|
|
204
|
+
pageX,
|
|
205
|
+
pageY
|
|
206
|
+
} = event.changedTouches[0];
|
|
207
|
+
const deltaX = pageX - pageStartRef.current.pageX;
|
|
208
|
+
const deltaY = pageY - pageStartRef.current.pageY;
|
|
209
|
+
const newPositionLeft = deltaX + style.positionLeft;
|
|
210
|
+
const newPositionBottom = style.positionBottom - deltaY;
|
|
211
|
+
onDragEnd === null || onDragEnd === void 0 || onDragEnd({
|
|
212
|
+
positionLeft: newPositionLeft,
|
|
213
|
+
positionBottom: newPositionBottom
|
|
214
|
+
});
|
|
215
|
+
ty.nativeDisabled(false);
|
|
216
|
+
}
|
|
217
|
+
}, /*#__PURE__*/React.createElement(IpcPtzZoom, {
|
|
218
|
+
className: `${multiPrefix}-moveable-ptz-control`,
|
|
219
|
+
ptzSize: "172px",
|
|
220
|
+
zoomSize: "66px",
|
|
221
|
+
zoomData: selectedLenInfo.supportZoom ? zoomData.current : [],
|
|
222
|
+
ptzData: selectedLenInfo.supportPTZ ? ptzData.current : [],
|
|
223
|
+
onTouchPtzStart: onTouchPtzStart,
|
|
224
|
+
onTouchPtzEnd: async () => {
|
|
225
|
+
screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
|
|
226
|
+
const ptzStopData = await getDpIdByCode(devId, 'ipc_multi_ptz_stop');
|
|
227
|
+
if (ptzStopData.code === 0) {
|
|
228
|
+
const ptzStopId = ptzStopData.data;
|
|
229
|
+
const sendDpValue = JSON.stringify({
|
|
230
|
+
index: selectedLenInfo.index
|
|
231
|
+
});
|
|
232
|
+
publishDps(devId, {
|
|
233
|
+
[ptzStopId]: sendDpValue
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
if (ptzTimeId.current) {
|
|
237
|
+
clearInterval(ptzTimeId.current);
|
|
238
|
+
ptzTimeId.current = null;
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
onTouchZoomStart: onTouchZoomStart,
|
|
242
|
+
onTouchZoomEnd: async () => {
|
|
243
|
+
screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
|
|
244
|
+
const ptzStopData = await getDpIdByCode(devId, 'ipc_multi_zoom_stop');
|
|
245
|
+
if (ptzStopData.code === 0) {
|
|
246
|
+
const ptzStopId = ptzStopData.data;
|
|
247
|
+
const sendDpValue = JSON.stringify({
|
|
248
|
+
index: selectedLenInfo.index
|
|
249
|
+
});
|
|
250
|
+
publishDps(devId, {
|
|
251
|
+
[ptzStopId]: sendDpValue
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
if (ptzTimeId.current) {
|
|
255
|
+
clearInterval(ptzTimeId.current);
|
|
256
|
+
ptzTimeId.current = null;
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
brandColor: brandColor,
|
|
260
|
+
iconClassName: Styles['arrow-icon-wrapper']
|
|
261
|
+
}))));
|
|
262
|
+
};
|
|
263
|
+
export const MoveablePtzControl = props => {
|
|
264
|
+
const {
|
|
265
|
+
event,
|
|
266
|
+
multiCameraCtx,
|
|
267
|
+
positionLeft = 24,
|
|
268
|
+
positionBottom = 90,
|
|
269
|
+
height = 172
|
|
270
|
+
} = props;
|
|
271
|
+
const [style, setStyle] = useState({
|
|
272
|
+
positionLeft,
|
|
273
|
+
positionBottom,
|
|
274
|
+
height
|
|
275
|
+
});
|
|
276
|
+
const {
|
|
277
|
+
screenMode
|
|
278
|
+
} = useStore({
|
|
279
|
+
screenMode: multiCameraCtx.screenMode
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// 处理因为状态更新不同步导致的闪烁问题
|
|
283
|
+
const activeViewRef = useRef(0);
|
|
284
|
+
const onDragStart = () => {
|
|
285
|
+
screenMode === MultiCameraScreenMode.landscape && event.emit(pauseTimeToHideAllComponent);
|
|
286
|
+
};
|
|
287
|
+
const onDragEnd = data => {
|
|
288
|
+
screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
|
|
289
|
+
activeViewRef.current = activeViewRef.current === 0 ? 1 : 0;
|
|
290
|
+
setStyle(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
291
|
+
positionLeft: data.positionLeft,
|
|
292
|
+
positionBottom: data.positionBottom
|
|
293
|
+
}));
|
|
294
|
+
};
|
|
295
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, activeViewRef.current === 0 && /*#__PURE__*/React.createElement(MoveablePtzControlItem, _extends({}, props, style, {
|
|
296
|
+
onDragStart: onDragStart,
|
|
297
|
+
onDragEnd: onDragEnd
|
|
298
|
+
})), activeViewRef.current === 1 && /*#__PURE__*/React.createElement(MoveablePtzControlItem, _extends({}, props, style, {
|
|
299
|
+
onDragStart: onDragStart,
|
|
300
|
+
onDragEnd: onDragEnd
|
|
301
|
+
})));
|
|
302
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentConfigProps } from '../../interface';
|
|
3
|
+
import './index.less';
|
|
4
|
+
type Props = ComponentConfigProps & {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* 多目ptz
|
|
9
|
+
*/
|
|
10
|
+
export declare const MultiPtz: (props: Props) => React.JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useMemoizedFn } from 'ahooks';
|
|
6
|
+
import { useStore } from '../../ctx/store';
|
|
7
|
+
import './index.less';
|
|
8
|
+
/**
|
|
9
|
+
* 多目ptz
|
|
10
|
+
*/
|
|
11
|
+
export const MultiPtz = props => {
|
|
12
|
+
const {
|
|
13
|
+
multiCameraCtx,
|
|
14
|
+
className
|
|
15
|
+
} = props;
|
|
16
|
+
const {
|
|
17
|
+
brandColor
|
|
18
|
+
} = useStore({
|
|
19
|
+
brandColor: props.brandColor
|
|
20
|
+
});
|
|
21
|
+
const {
|
|
22
|
+
ptzStatus,
|
|
23
|
+
selectedLenInfo
|
|
24
|
+
} = useStore({
|
|
25
|
+
ptzStatus: multiCameraCtx.ptzStatus,
|
|
26
|
+
selectedLenInfo: multiCameraCtx.selectedLenInfo
|
|
27
|
+
});
|
|
28
|
+
const onPtz = useMemoizedFn(() => {
|
|
29
|
+
multiCameraCtx.setPtzStatus(!ptzStatus);
|
|
30
|
+
});
|
|
31
|
+
if (!selectedLenInfo.supportPTZ && !selectedLenInfo.supportZoom) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
35
|
+
className: clsx('ipc-player-plugin-ptz-text-icon', className),
|
|
36
|
+
style: _objectSpread({}, ptzStatus && {
|
|
37
|
+
borderColor: brandColor
|
|
38
|
+
}),
|
|
39
|
+
onClick: onPtz
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
41
|
+
className: clsx('icon-panel', 'icon-panel-ptz', 'ipc-player-plugin-ptz-text-icon'),
|
|
42
|
+
style: _objectSpread({}, ptzStatus && {
|
|
43
|
+
color: brandColor
|
|
44
|
+
})
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentConfigProps } from '../../interface';
|
|
3
|
+
import './index.less';
|
|
4
|
+
type Props = ComponentConfigProps & {
|
|
5
|
+
positionLeft?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const PtzMoveableTip: (props: Props) => React.JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { View, CoverView, Text } from '@ray-js/ray';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useStore } from '../../ctx/store';
|
|
5
|
+
import { ptzMoveableTipId } from '../../ui/constant';
|
|
6
|
+
import { PlayState } from '../../interface';
|
|
7
|
+
import Strings from '../../i18n';
|
|
8
|
+
import { multiPrefix } from './constants';
|
|
9
|
+
import { Storage } from '../../utils/storage';
|
|
10
|
+
import './index.less';
|
|
11
|
+
export const PtzMoveableTip = props => {
|
|
12
|
+
const {
|
|
13
|
+
devId,
|
|
14
|
+
positionLeft = 24,
|
|
15
|
+
multiCameraCtx,
|
|
16
|
+
deleteContent
|
|
17
|
+
} = props;
|
|
18
|
+
const [showTipModal, setShowTipModal] = useState(true);
|
|
19
|
+
const {
|
|
20
|
+
playState,
|
|
21
|
+
selectedLenInfo
|
|
22
|
+
} = useStore({
|
|
23
|
+
playState: props.playState,
|
|
24
|
+
selectedLenInfo: multiCameraCtx.selectedLenInfo
|
|
25
|
+
});
|
|
26
|
+
const positionInfo = useMemo(() => {
|
|
27
|
+
if (selectedLenInfo.supportPTZ && selectedLenInfo.supportZoom) {
|
|
28
|
+
return {
|
|
29
|
+
content: `${positionLeft + 70}px`,
|
|
30
|
+
tip: `${positionLeft + 120}px`
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
content: `${positionLeft - 15}px`,
|
|
35
|
+
tip: `${positionLeft + 40}px`
|
|
36
|
+
};
|
|
37
|
+
}, [selectedLenInfo]);
|
|
38
|
+
|
|
39
|
+
// 获取缓存状态
|
|
40
|
+
const hideTipModal = () => {
|
|
41
|
+
setShowTipModal(false);
|
|
42
|
+
deleteContent('absolute', ptzMoveableTipId);
|
|
43
|
+
const storage = new Storage(devId);
|
|
44
|
+
storage.set(ptzMoveableTipId, true);
|
|
45
|
+
};
|
|
46
|
+
if (showTipModal && playState === PlayState.PLAYING) {
|
|
47
|
+
return /*#__PURE__*/React.createElement(CoverView, null, /*#__PURE__*/React.createElement(View, {
|
|
48
|
+
className: clsx(`${multiPrefix}-tile-tip-content`, `${multiPrefix}-ptz-tip`),
|
|
49
|
+
style: {
|
|
50
|
+
left: positionInfo.content
|
|
51
|
+
}
|
|
52
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
53
|
+
className: clsx(`${multiPrefix}-tile-tip-text`, `${multiPrefix}-ptz-tip`),
|
|
54
|
+
style: {
|
|
55
|
+
left: positionInfo.tip
|
|
56
|
+
}
|
|
57
|
+
}, Strings.getLang(`ipc_player_ptz_moveable_tip_text`)), /*#__PURE__*/React.createElement(View, {
|
|
58
|
+
className: clsx(`${multiPrefix}-tile-tip-button`, `${multiPrefix}-ptz-tip`),
|
|
59
|
+
style: {
|
|
60
|
+
left: positionInfo.tip
|
|
61
|
+
},
|
|
62
|
+
onClick: hideTipModal
|
|
63
|
+
}, Strings.getLang('ipc_player_tip_confirm')));
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ComponentConfigProps } from '../../interface';
|
|
3
|
+
import './index.less';
|
|
4
|
+
type Props = ComponentConfigProps & {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function SwitchLayout(props: Props): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Text, View } from '@ray-js/ray';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { useStore } from '../../ctx/store';
|
|
5
|
+
import { MultiCameraLayoutStyle, MultiCameraScreenMode } from '../../interface';
|
|
6
|
+
import { multiPrefix } from './constants';
|
|
7
|
+
import './index.less';
|
|
8
|
+
export function SwitchLayout(props) {
|
|
9
|
+
const {
|
|
10
|
+
className,
|
|
11
|
+
multiCameraCtx
|
|
12
|
+
} = props;
|
|
13
|
+
const {
|
|
14
|
+
layoutStyle,
|
|
15
|
+
screenMode,
|
|
16
|
+
nextLayoutStyle
|
|
17
|
+
} = useStore({
|
|
18
|
+
layoutStyle: multiCameraCtx.layoutStyle,
|
|
19
|
+
screenMode: multiCameraCtx.screenMode,
|
|
20
|
+
nextLayoutStyle: multiCameraCtx.nextLayoutStyle
|
|
21
|
+
});
|
|
22
|
+
const iconClassName = useMemo(() => {
|
|
23
|
+
if (screenMode === MultiCameraScreenMode.short) return 'icon-panel-expand';
|
|
24
|
+
if (screenMode === MultiCameraScreenMode.full) return 'icon-panel-collapse';
|
|
25
|
+
if (screenMode === MultiCameraScreenMode.landscape) {
|
|
26
|
+
if (layoutStyle === MultiCameraLayoutStyle.pip) return 'icon-panel-pip';
|
|
27
|
+
if (layoutStyle === MultiCameraLayoutStyle.tile) return 'icon-panel-landscape-tile';
|
|
28
|
+
if (layoutStyle === MultiCameraLayoutStyle.grid) return 'icon-panel-landscape-grid';
|
|
29
|
+
if (layoutStyle === MultiCameraLayoutStyle.thumbnail) return 'icon-panel-landscape-thumbnail';
|
|
30
|
+
}
|
|
31
|
+
return '';
|
|
32
|
+
}, [layoutStyle, screenMode]);
|
|
33
|
+
|
|
34
|
+
// 点击事件处理函数
|
|
35
|
+
|
|
36
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
37
|
+
className: clsx(className),
|
|
38
|
+
onTouchStart: () => {
|
|
39
|
+
if (screenMode !== MultiCameraScreenMode.landscape) {
|
|
40
|
+
// 非横屏模式下,本组件只负责切换屏幕模式
|
|
41
|
+
const nextScreenMode = screenMode === MultiCameraScreenMode.short ? MultiCameraScreenMode.full : MultiCameraScreenMode.short;
|
|
42
|
+
|
|
43
|
+
// 避免闪烁,直接重置 ptz
|
|
44
|
+
if (nextScreenMode === MultiCameraScreenMode.short) {
|
|
45
|
+
multiCameraCtx.setPtzStatus(false);
|
|
46
|
+
// hideContent('absolute', tileActionsId);
|
|
47
|
+
}
|
|
48
|
+
multiCameraCtx.setScreenMode(nextScreenMode);
|
|
49
|
+
} else {
|
|
50
|
+
// 横屏模式下,本组件负责切换布局样式
|
|
51
|
+
multiCameraCtx.setLayoutStyle(nextLayoutStyle);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
55
|
+
className: clsx(['icon-panel', iconClassName, multiPrefix])
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { View } from '@ray-js/ray';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { TileSwitchLayout } from './tileSwitchLayout';
|
|
6
|
+
import { multiPrefix } from './constants';
|
|
7
|
+
import { TileMultiPtz } from './tileMultiPtz';
|
|
8
|
+
import './index.less';
|
|
9
|
+
export function TileActions(props) {
|
|
10
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
11
|
+
className: clsx(`${multiPrefix}-actions`)
|
|
12
|
+
}, /*#__PURE__*/React.createElement(TileSwitchLayout, props), /*#__PURE__*/React.createElement(TileMultiPtz, _extends({}, props, {
|
|
13
|
+
className: `${multiPrefix}-action-wrap`
|
|
14
|
+
})));
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentConfigProps } from '../../interface';
|
|
3
|
+
import './index.less';
|
|
4
|
+
type Props = ComponentConfigProps & {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* 多目竖屏平铺ptz
|
|
9
|
+
*/
|
|
10
|
+
export declare const TileMultiPtz: (props: Props) => React.JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useMemoizedFn } from 'ahooks';
|
|
6
|
+
import Color from 'color';
|
|
7
|
+
import { useStore } from '../../ctx/store';
|
|
8
|
+
import { multiPrefix } from './constants';
|
|
9
|
+
import './index.less';
|
|
10
|
+
/**
|
|
11
|
+
* 多目竖屏平铺ptz
|
|
12
|
+
*/
|
|
13
|
+
export const TileMultiPtz = props => {
|
|
14
|
+
const {
|
|
15
|
+
multiCameraCtx,
|
|
16
|
+
className,
|
|
17
|
+
devId
|
|
18
|
+
} = props;
|
|
19
|
+
const {
|
|
20
|
+
brandColor,
|
|
21
|
+
ptzStatus,
|
|
22
|
+
selectedLenInfo
|
|
23
|
+
} = useStore({
|
|
24
|
+
brandColor: props.brandColor,
|
|
25
|
+
ptzStatus: multiCameraCtx.ptzStatus,
|
|
26
|
+
selectedLenInfo: multiCameraCtx.selectedLenInfo
|
|
27
|
+
});
|
|
28
|
+
const lighterBrandColor = new Color(brandColor).alpha(0.2).hexa();
|
|
29
|
+
const onPtz = useMemoizedFn(() => {
|
|
30
|
+
multiCameraCtx.setPtzStatus(!ptzStatus);
|
|
31
|
+
});
|
|
32
|
+
if (!selectedLenInfo.supportPTZ && !selectedLenInfo.supportZoom) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
36
|
+
className: clsx(`${multiPrefix}-action-wrap`, className),
|
|
37
|
+
style: _objectSpread({}, ptzStatus && {
|
|
38
|
+
borderColor: brandColor,
|
|
39
|
+
backgroundColor: lighterBrandColor
|
|
40
|
+
}),
|
|
41
|
+
onClick: onPtz
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
43
|
+
className: clsx('icon-panel', 'icon-panel-ptz', multiPrefix),
|
|
44
|
+
style: _objectSpread({}, ptzStatus && {
|
|
45
|
+
color: brandColor
|
|
46
|
+
})
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ComponentConfigProps } from '../../interface';
|
|
3
|
+
import './index.less';
|
|
4
|
+
type Props = ComponentConfigProps & {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function TileSwitchLayout(props: Props): React.JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { View, Text } from '@ray-js/ray';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { MultiCameraLayoutStyle } from '../../interface';
|
|
5
|
+
import { multiPrefix } from './constants';
|
|
6
|
+
import { useStore } from '../../ctx/store';
|
|
7
|
+
import './index.less';
|
|
8
|
+
export function TileSwitchLayout(props) {
|
|
9
|
+
const {
|
|
10
|
+
className,
|
|
11
|
+
multiCameraCtx
|
|
12
|
+
} = props;
|
|
13
|
+
const {
|
|
14
|
+
layoutStyle,
|
|
15
|
+
screenMode,
|
|
16
|
+
nextLayoutStyle
|
|
17
|
+
} = useStore({
|
|
18
|
+
layoutStyle: multiCameraCtx.layoutStyle,
|
|
19
|
+
screenMode: multiCameraCtx.screenMode,
|
|
20
|
+
nextLayoutStyle: multiCameraCtx.nextLayoutStyle
|
|
21
|
+
});
|
|
22
|
+
const iconClassName = useMemo(() => {
|
|
23
|
+
if (layoutStyle === MultiCameraLayoutStyle.tile) return 'icon-panel-tile';
|
|
24
|
+
if (layoutStyle === MultiCameraLayoutStyle.pip) return 'icon-panel-pip';
|
|
25
|
+
if (layoutStyle === MultiCameraLayoutStyle.grid) return 'icon-panel-pin';
|
|
26
|
+
if (layoutStyle === MultiCameraLayoutStyle.thumbnail) return 'icon-panel-thumbnail';
|
|
27
|
+
return '';
|
|
28
|
+
}, [layoutStyle, screenMode]);
|
|
29
|
+
if (nextLayoutStyle === MultiCameraLayoutStyle.invalid) return null;
|
|
30
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
31
|
+
className: clsx(`${multiPrefix}-action-wrap`, className),
|
|
32
|
+
onClick: () => {
|
|
33
|
+
multiCameraCtx.setLayoutStyle(nextLayoutStyle);
|
|
34
|
+
}
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
36
|
+
className: clsx('icon-panel', iconClassName, multiPrefix)
|
|
37
|
+
}));
|
|
38
|
+
}
|