@ray-js/ipc-player-integration 0.0.71-beta.0 → 0.0.72-beta.0
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 +0 -6
- package/lib/ctx/ctx.composition.d.ts +5 -1
- package/lib/ctx/ctx.composition.js +4 -1
- package/lib/ctx/ctx.js +17 -12
- package/lib/ctx/ctx.test.js +19 -54
- package/lib/features/initPlayerWidgets/index.d.ts +3 -0
- package/lib/features/initPlayerWidgets/index.js +4 -0
- package/lib/index.d.ts +0 -4
- package/lib/index.js +1 -3
- package/lib/interface.d.ts +1 -1
- package/lib/ui/bottomControlLayout.d.ts +11 -0
- package/lib/ui/bottomControlLayout.js +19 -0
- package/lib/ui/bottomControlLayout.test.js +64 -0
- package/lib/ui/bottomLeftContent.js +73 -180
- package/lib/ui/bottomLeftContent.test.js +138 -0
- package/lib/ui/bottomRightContent.d.ts +2 -2
- package/lib/ui/bottomRightContent.js +24 -16
- package/lib/ui/bottomRightContent.test.js +144 -0
- package/lib/ui/constant.d.ts +2 -0
- package/lib/ui/constant.js +4 -1
- package/lib/ui/topLeftContent.js +2 -4
- package/lib/ui/topRightContent.js +2 -4
- package/lib/ui/ui.d.ts +0 -5
- package/lib/ui/ui.js +33 -86
- package/lib/ui/ui.less +24 -59
- package/lib/widgets/battery/battery.js +5 -7
- package/lib/widgets/battery/batteryFull.js +5 -7
- package/lib/widgets/captureResult/captureResult.js +1 -2
- package/lib/widgets/floatWindow/floatWindow.d.ts +13 -0
- package/lib/widgets/floatWindow/floatWindow.js +93 -0
- package/lib/widgets/floatWindow/floatWindow.less +14 -0
- package/lib/widgets/floatWindow/floatWindow.test.d.ts +1 -0
- package/lib/widgets/floatWindow/floatWindow.test.js +164 -0
- package/lib/widgets/floatWindow/icon.d.ts +1 -0
- package/lib/widgets/floatWindow/icon.js +4 -0
- package/lib/widgets/floatWindow/index.d.ts +1 -0
- package/lib/widgets/floatWindow/index.js +1 -0
- package/lib/widgets/floodlight/floodlight.js +1 -2
- package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
- package/lib/widgets/fullScreen/fullScreen.js +1 -2
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
- package/lib/widgets/fullScreen/verticalScreen.js +1 -2
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.js +2 -1
- package/lib/widgets/moveInteractiveControl/controlButton.js +1 -2
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +5 -16
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
- package/lib/widgets/multiCamera/landscapeTip.js +2 -8
- package/lib/widgets/multiCamera/moveablePtzControl.js +3 -5
- package/lib/widgets/multiCamera/multiPtz.js +1 -2
- package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -8
- package/lib/widgets/multiCamera/switchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileMultiPtz.js +1 -2
- package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileTip.js +2 -8
- package/lib/widgets/muted/muted.js +1 -2
- package/lib/widgets/muted/muted.test.js +52 -66
- package/lib/widgets/ptz/ptz.js +1 -2
- package/lib/widgets/ptz/ptzControl.js +3 -4
- package/lib/widgets/ptzControlTip/ptzControlTip.js +4 -9
- package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
- package/lib/widgets/recordVideo/recordVideo.js +169 -47
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +2 -4
- package/lib/widgets/recordVideo/recordVideo.test.js +2 -169
- package/lib/widgets/resolution/fullResolutionControl.js +19 -29
- package/lib/widgets/resolution/resolution.js +2 -3
- package/lib/widgets/screenshot/screenshot.js +122 -48
- package/lib/widgets/screenshot/screenshot.test.js +113 -108
- package/lib/widgets/signal4G/signal4G.js +1 -4
- package/lib/widgets/siren/siren.js +1 -2
- package/lib/widgets/tempHumidity/tempHumidity.js +1 -2
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +1 -2
- package/lib/widgets/trialBadge/index.js +3 -8
- package/lib/widgets/trialBadge/index.less +0 -24
- package/lib/widgets/tryExperience/tryExperience.js +1 -2
- package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
- package/lib/widgets/voiceIntercom/voiceIntercom.js +81 -57
- package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -35
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +7 -5
- package/lib/widgets/zoomTurntable/turntable/index.js +1 -3
- package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +3 -5
- package/lib/widgets/zoomTurntable/zoomTurntableDock.js +4 -4
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +19 -32
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +3 -17
- package/package.json +7 -15
- package/lib/ctx/intercom.test.js +0 -85
- package/lib/renderer/capabilities.d.ts +0 -8
- package/lib/renderer/capabilities.js +0 -19
- package/lib/renderer/context.d.ts +0 -5
- package/lib/renderer/context.js +0 -6
- package/lib/renderer/directionControl.d.ts +0 -6
- package/lib/renderer/directionControl.js +0 -3
- package/lib/renderer/font-manifest.json +0 -9
- package/lib/renderer/font.less +0 -5
- package/lib/renderer/glyphs.d.ts +0 -1
- package/lib/renderer/glyphs.js +0 -256
- package/lib/renderer/index.module.less +0 -48
- package/lib/renderer/overlay.d.ts +0 -6
- package/lib/renderer/overlay.js +0 -18
- package/lib/renderer/ptzZoom.d.ts +0 -6
- package/lib/renderer/ptzZoom.js +0 -3
- package/lib/renderer/text.d.ts +0 -4
- package/lib/renderer/text.js +0 -32
- package/lib/renderer/text.module.less +0 -4
- package/lib/renderer/viewport.d.ts +0 -7
- package/lib/renderer/viewport.js +0 -24
- package/lib/res/lynx-signal/index.d.ts +0 -1
- package/lib/res/lynx-signal/index.js +0 -22
- package/lib/res/lynx-signal/signalFour0.png +0 -0
- package/lib/res/lynx-signal/signalFour1.png +0 -0
- package/lib/res/lynx-signal/signalFour2.png +0 -0
- package/lib/res/lynx-signal/signalFour3.png +0 -0
- package/lib/res/lynx-signal/signalFour4.png +0 -0
- package/lib/res/lynx-signal/signalThree0.png +0 -0
- package/lib/res/lynx-signal/signalThree1.png +0 -0
- package/lib/res/lynx-signal/signalThree2.png +0 -0
- package/lib/res/lynx-signal/signalThree3.png +0 -0
- package/lib/res/player-charging.png +0 -0
- package/lib/res/player-more-arrow.png +0 -0
- package/lib/res/player-solar.png +0 -0
- package/lib/ui/scrollHintArrow.d.ts +0 -23
- package/lib/ui/scrollHintArrow.js +0 -83
- package/lib/widgets/battery/statusIcon.d.ts +0 -6
- package/lib/widgets/battery/statusIcon.js +0 -36
- package/lib/widgets/battery/statusIcon.less +0 -24
- package/lib/widgets/captureToast/captureToast.d.ts +0 -10
- package/lib/widgets/captureToast/captureToast.js +0 -58
- package/lib/widgets/recordVideo/recordVideoTimer.d.ts +0 -3
- package/lib/widgets/recordVideo/recordVideoTimer.js +0 -26
- package/lib/widgets/screenshot/screenshot.permissions.test.js +0 -137
- package/lib/widgets/voiceIntercom/voiceIntercom.test.js +0 -135
- package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +0 -6
- package/lib/widgets/zoomTurntable/lynxDockLayout.js +0 -30
- package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +0 -5
- package/lib/widgets/zoomTurntable/turntable/lynx.js +0 -273
- package/lib/widgets/zoomTurntable/turntable/lynx.less +0 -9
- package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +0 -37
- package/lib/widgets/zoomTurntable/turntable/lynxModel.js +0 -122
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +0 -3
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +0 -36
- /package/lib/{ctx/intercom.test.d.ts → ui/bottomControlLayout.test.d.ts} +0 -0
- /package/lib/{widgets/screenshot/screenshot.permissions.test.d.ts → ui/bottomLeftContent.test.d.ts} +0 -0
- /package/lib/{widgets/voiceIntercom/voiceIntercom.test.d.ts → ui/bottomRightContent.test.d.ts} +0 -0
package/lib/ui/ui.less
CHANGED
|
@@ -219,37 +219,29 @@
|
|
|
219
219
|
opacity: 1;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
//
|
|
222
|
+
// Apply alpha to the fixed viewport, leaving the independently rendered arrow unaffected.
|
|
223
223
|
.ipc-player-bottom-left-scroll-fademask {
|
|
224
|
+
--ipc-left-fade-width: 72px;
|
|
225
|
+
--ipc-left-fade-end: 0px;
|
|
224
226
|
-webkit-mask-image: linear-gradient(
|
|
225
227
|
to right,
|
|
226
|
-
#000 calc(100% -
|
|
227
|
-
|
|
228
|
-
transparent 100%
|
|
228
|
+
#000 calc(100% - var(--ipc-left-fade-width)),
|
|
229
|
+
transparent calc(100% - var(--ipc-left-fade-end))
|
|
229
230
|
);
|
|
230
231
|
mask-image: linear-gradient(
|
|
231
232
|
to right,
|
|
232
|
-
#000 calc(100% -
|
|
233
|
-
|
|
234
|
-
transparent 100%
|
|
233
|
+
#000 calc(100% - var(--ipc-left-fade-width)),
|
|
234
|
+
transparent calc(100% - var(--ipc-left-fade-end))
|
|
235
235
|
);
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
// 竖屏滚动档:可视区被收窄到“前 4 项 + 露一角”,渐变区同步收窄到只覆盖那一角,
|
|
239
|
-
// 否则 72px 的渐变会把第 4 项也淡掉一大半
|
|
240
238
|
.ipc-player-bottom-left-scroll-fademask--narrow {
|
|
241
|
-
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
mask-image: linear-gradient(
|
|
248
|
-
to right,
|
|
249
|
-
#000 calc(100% - 34px),
|
|
250
|
-
rgba(0, 0, 0, 0.3) calc(100% - 14px),
|
|
251
|
-
transparent 100%
|
|
252
|
-
);
|
|
239
|
+
--ipc-left-fade-width: 56px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Finish fading underneath the leading edge of the 26px arrow button.
|
|
243
|
+
.ipc-player-bottom-left-scroll-fademask--arrow {
|
|
244
|
+
--ipc-left-fade-end: 24px;
|
|
253
245
|
}
|
|
254
246
|
|
|
255
247
|
@keyframes ipc-player-bottom-left-scroll-hint-pulse {
|
|
@@ -311,85 +303,58 @@
|
|
|
311
303
|
padding: 0 16px 0 0;
|
|
312
304
|
}
|
|
313
305
|
|
|
314
|
-
//
|
|
306
|
+
// 相邻控件的内容边缘统一间隔 22px;两侧各分配 11px。
|
|
307
|
+
// 首尾保留既有外侧留白,横竖屏只改变外侧留白,不改变内部间距。
|
|
315
308
|
.bottom-left-item-container {
|
|
316
|
-
padding: 0
|
|
309
|
+
padding: 0 11px;
|
|
317
310
|
display: flex;
|
|
318
311
|
justify-content: center;
|
|
319
312
|
align-items: center;
|
|
320
|
-
// 左下角支持横向滚动;不允许子项被压缩,否则在 width:100% 的滚动容器里
|
|
321
|
-
// 子项会被挤而不是触发横滑
|
|
322
313
|
flex-shrink: 0;
|
|
323
314
|
}
|
|
324
315
|
|
|
325
316
|
.bottom-left-item-container:first-of-type {
|
|
326
|
-
padding: 0
|
|
317
|
+
padding: 0 11px 0 16px;
|
|
327
318
|
}
|
|
328
319
|
|
|
329
320
|
.bottom-left-item-container:last-of-type {
|
|
330
|
-
padding: 0 0 0
|
|
321
|
+
padding: 0 0 0 11px;
|
|
331
322
|
}
|
|
332
323
|
|
|
333
324
|
.bottom-left-item-container:only-of-type {
|
|
334
325
|
padding: 0 0 0 16px;
|
|
335
326
|
}
|
|
336
327
|
|
|
337
|
-
// 收紧态:左右各 10px(默认 12px)。
|
|
338
|
-
//
|
|
339
|
-
// 只有窄屏上「前 4 项 + 34 露出区」放不下、且收紧后刚好放得下时才挂这个类
|
|
340
|
-
// (判定见 bottomLeftContent.tsx 的 tightened)。宽屏本来就放得下,
|
|
341
|
-
// 保持 12px 的宽松间距,不为个别机型让全量机型变紧。
|
|
342
|
-
//
|
|
343
|
-
// 中间项左右各省 2px = 4px;首项只省右侧 2px —— 左侧 16px 是内容起始留白,
|
|
344
|
-
// 要和其余三个角落对齐,不能动。10px 是不显挤的下限。
|
|
345
|
-
//
|
|
346
|
-
// 横屏叠的 .bottom-left-item-full-container 带 !important,优先级更高,不受影响。
|
|
347
|
-
.ipc-player-bottom-left-content-container-tight {
|
|
348
|
-
.bottom-left-item-container {
|
|
349
|
-
padding: 0 10px;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.bottom-left-item-container:first-of-type {
|
|
353
|
-
padding: 0 10px 0 16px;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.bottom-left-item-container:last-of-type {
|
|
357
|
-
padding: 0 0 0 10px;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// 左下角全屏子元素容器
|
|
362
328
|
.bottom-left-item-full-container {
|
|
363
|
-
padding: 0
|
|
329
|
+
padding: 0 11px !important;
|
|
364
330
|
flex-shrink: 0;
|
|
365
331
|
}
|
|
366
332
|
|
|
367
333
|
.bottom-left-item-full-container:first-of-type {
|
|
368
|
-
padding: 0
|
|
334
|
+
padding: 0 11px 0 12px !important;
|
|
369
335
|
}
|
|
370
336
|
|
|
371
337
|
.bottom-left-item-full-container:last-of-type {
|
|
372
|
-
padding: 0 0 0
|
|
338
|
+
padding: 0 0 0 11px !important;
|
|
373
339
|
}
|
|
374
340
|
|
|
375
341
|
.bottom-left-item-full-container:only-of-type {
|
|
376
342
|
padding: 0 0 0 12px !important;
|
|
377
343
|
}
|
|
378
344
|
|
|
379
|
-
// 右下角子元素容器
|
|
380
345
|
.bottom-right-item-container {
|
|
381
|
-
padding: 0
|
|
346
|
+
padding: 0 11px;
|
|
382
347
|
display: flex;
|
|
383
348
|
justify-content: center;
|
|
384
349
|
align-items: center;
|
|
385
350
|
}
|
|
386
351
|
|
|
387
352
|
.bottom-right-item-container:first-of-type {
|
|
388
|
-
padding: 0
|
|
353
|
+
padding: 0 11px 0 0;
|
|
389
354
|
}
|
|
390
355
|
|
|
391
356
|
.bottom-right-item-container:last-of-type {
|
|
392
|
-
padding: 0 16px 0
|
|
357
|
+
padding: 0 16px 0 11px;
|
|
393
358
|
}
|
|
394
359
|
|
|
395
360
|
.bottom-right-item-container:only-of-type {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import { PowerMode } from '../../ports.output';
|
|
7
|
-
import { BatteryStatusIcon } from './statusIcon';
|
|
8
6
|
import './battery.less';
|
|
9
7
|
export const createBattery = _ref => {
|
|
10
8
|
let {
|
|
@@ -46,8 +44,8 @@ export const createBattery = _ref => {
|
|
|
46
44
|
className: clsx(className)
|
|
47
45
|
}, /*#__PURE__*/React.createElement(View, {
|
|
48
46
|
className: "ipc-player-plugin-battery"
|
|
49
|
-
}, !isSolar && batteryCharging ? /*#__PURE__*/React.createElement(
|
|
50
|
-
|
|
47
|
+
}, !isSolar && batteryCharging ? /*#__PURE__*/React.createElement(View, {
|
|
48
|
+
className: "icon-panel icon-panel-charging ipc-player-plugin-battery-charging"
|
|
51
49
|
}) : /*#__PURE__*/React.createElement(View, {
|
|
52
50
|
className: "ipc-player-plugin-battery-border"
|
|
53
51
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -60,8 +58,8 @@ export const createBattery = _ref => {
|
|
|
60
58
|
backgroundColor: batteryColor
|
|
61
59
|
},
|
|
62
60
|
className: "ipc-player-plugin-battery-value-value"
|
|
63
|
-
})), isSolar && /*#__PURE__*/React.createElement(
|
|
64
|
-
|
|
61
|
+
})), isSolar && /*#__PURE__*/React.createElement(View, {
|
|
62
|
+
className: "icon-panel icon-panel-solar ipc-player-plugin-battery-solar"
|
|
65
63
|
})), /*#__PURE__*/React.createElement(Text, {
|
|
66
64
|
className: "ipc-player-plugin-battery-text"
|
|
67
65
|
}, batteryValue, "%")));
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import { PowerMode } from '../../ports.output';
|
|
7
|
-
import { BatteryStatusIcon } from './statusIcon';
|
|
8
6
|
import './battery.less';
|
|
9
7
|
export const createBattery = _ref => {
|
|
10
8
|
let {
|
|
@@ -46,8 +44,8 @@ export const createBattery = _ref => {
|
|
|
46
44
|
className: clsx(className)
|
|
47
45
|
}, /*#__PURE__*/React.createElement(View, {
|
|
48
46
|
className: "ipc-player-plugin-battery"
|
|
49
|
-
}, !isSolar && batteryCharging ? /*#__PURE__*/React.createElement(
|
|
50
|
-
|
|
47
|
+
}, !isSolar && batteryCharging ? /*#__PURE__*/React.createElement(View, {
|
|
48
|
+
className: "icon-panel icon-panel-charging ipc-player-plugin-battery-charging"
|
|
51
49
|
}) : /*#__PURE__*/React.createElement(View, {
|
|
52
50
|
className: "ipc-player-plugin-battery-border"
|
|
53
51
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -60,8 +58,8 @@ export const createBattery = _ref => {
|
|
|
60
58
|
backgroundColor: batteryColor
|
|
61
59
|
},
|
|
62
60
|
className: "ipc-player-plugin-battery-value-value"
|
|
63
|
-
})), isSolar && /*#__PURE__*/React.createElement(
|
|
64
|
-
|
|
61
|
+
})), isSolar && /*#__PURE__*/React.createElement(View, {
|
|
62
|
+
className: "icon-panel icon-panel-solar ipc-player-plugin-battery-solar"
|
|
65
63
|
})), /*#__PURE__*/React.createElement(Text, {
|
|
66
64
|
className: "ipc-player-plugin-battery-text"
|
|
67
65
|
}, batteryValue, "%")));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Image, View } from '@ray-js/ray';
|
|
2
|
+
import { Image, Text, View } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import Strings from '../../i18n';
|
|
6
5
|
import './captureResult.less';
|
|
7
6
|
const BACKDROP_LAYERS = ['back', 'middle'];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentConfigProps } from '../../interface';
|
|
3
|
+
import './floatWindow.less';
|
|
4
|
+
/** Business eligibility and native actions belong to the consuming panel. */
|
|
5
|
+
export type FloatWindowOptions = {
|
|
6
|
+
visible: boolean;
|
|
7
|
+
onClick: (deviceId: string) => void | Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
type Props = ComponentConfigProps & Partial<FloatWindowOptions> & {
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function FloatWindow(props: Props): React.JSX.Element | null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/esnext.iterator.some.js";
|
|
3
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { View } from '@ray-js/ray';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useStore } from '../../ctx/store';
|
|
7
|
+
import { UIEventContext } from '../../ui/context';
|
|
8
|
+
import { bottomRightContentResize, fullTravelRouteControlId, ptzControlId, widgetClick } from '../../ui/constant';
|
|
9
|
+
import { floatWindowIcon } from './icon';
|
|
10
|
+
import './floatWindow.less';
|
|
11
|
+
|
|
12
|
+
/** Business eligibility and native actions belong to the consuming panel. */
|
|
13
|
+
|
|
14
|
+
export function FloatWindow(props) {
|
|
15
|
+
const {
|
|
16
|
+
visible = false,
|
|
17
|
+
onClick,
|
|
18
|
+
devId,
|
|
19
|
+
event,
|
|
20
|
+
className
|
|
21
|
+
} = props;
|
|
22
|
+
const {
|
|
23
|
+
screenType
|
|
24
|
+
} = useStore({
|
|
25
|
+
screenType: props.screenType
|
|
26
|
+
});
|
|
27
|
+
const {
|
|
28
|
+
absoluteContent
|
|
29
|
+
} = useStore({
|
|
30
|
+
absoluteContent: props.absoluteContent
|
|
31
|
+
});
|
|
32
|
+
const {
|
|
33
|
+
componentHideState,
|
|
34
|
+
refreshElement
|
|
35
|
+
} = useContext(UIEventContext);
|
|
36
|
+
const [ptzActive, setPtzActive] = useState(false);
|
|
37
|
+
const [busy, setBusy] = useState(false);
|
|
38
|
+
const opening = useRef(false);
|
|
39
|
+
const mounted = useRef(false);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
mounted.current = true;
|
|
42
|
+
return () => {
|
|
43
|
+
mounted.current = false;
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setPtzActive(false);
|
|
48
|
+
const show = () => setPtzActive(true);
|
|
49
|
+
const hide = () => setPtzActive(false);
|
|
50
|
+
event.on('ptzControlShow', show);
|
|
51
|
+
event.on('ptzControlHide', hide);
|
|
52
|
+
return () => {
|
|
53
|
+
event.off('ptzControlShow', show);
|
|
54
|
+
event.off('ptzControlHide', hide);
|
|
55
|
+
};
|
|
56
|
+
}, [event, devId]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (screenType === 'vertical') setPtzActive(false);
|
|
59
|
+
}, [screenType]);
|
|
60
|
+
|
|
61
|
+
// Console containers stay registered after closing; their presence alone is insufficient.
|
|
62
|
+
const consoleVisible = screenType === 'full' && !componentHideState && !refreshElement && absoluteContent.some(item => !item.hidden && (item.id === ptzControlId && ptzActive || item.id === fullTravelRouteControlId && !ptzActive));
|
|
63
|
+
const shown = visible && typeof onClick === 'function' && !consoleVisible;
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
event.emit(bottomRightContentResize);
|
|
66
|
+
}, [event, shown]);
|
|
67
|
+
if (!shown) return null;
|
|
68
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
69
|
+
className: clsx(className, {
|
|
70
|
+
'ipc-player-float-window-busy': busy
|
|
71
|
+
}),
|
|
72
|
+
onClick: async () => {
|
|
73
|
+
if (opening.current) return;
|
|
74
|
+
opening.current = true;
|
|
75
|
+
setBusy(true);
|
|
76
|
+
event.emit(widgetClick, {
|
|
77
|
+
widgetId: 'FloatWindow'
|
|
78
|
+
});
|
|
79
|
+
try {
|
|
80
|
+
await onClick(devId);
|
|
81
|
+
} finally {
|
|
82
|
+
opening.current = false;
|
|
83
|
+
if (mounted.current) setBusy(false);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
className: "ipc-player-float-window-icon",
|
|
88
|
+
style: {
|
|
89
|
+
WebkitMaskImage: `url("${floatWindowIcon}")`,
|
|
90
|
+
maskImage: `url("${floatWindowIcon}")`
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.ipc-player-float-window-icon {
|
|
2
|
+
width: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1));
|
|
3
|
+
height: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1));
|
|
4
|
+
background-color: var(--iconColor);
|
|
5
|
+
-webkit-mask-size: contain;
|
|
6
|
+
mask-size: contain;
|
|
7
|
+
-webkit-mask-repeat: no-repeat;
|
|
8
|
+
mask-repeat: no-repeat;
|
|
9
|
+
-webkit-mask-position: center;
|
|
10
|
+
mask-position: center;
|
|
11
|
+
}
|
|
12
|
+
.ipc-player-float-window-busy {
|
|
13
|
+
opacity: 0.5;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import ReactDOM from 'react-dom';
|
|
5
|
+
import { act, Simulate } from 'react-dom/test-utils';
|
|
6
|
+
import { atom, getDefaultStore } from 'jotai';
|
|
7
|
+
import { FloatWindow } from './floatWindow';
|
|
8
|
+
import { UIEventContext } from '../../ui/context';
|
|
9
|
+
import { bottomRightContentResize, fullTravelRouteControlId, ptzControlId } from '../../ui/constant';
|
|
10
|
+
jest.mock('@ray-js/ray', () => ({
|
|
11
|
+
View: 'div',
|
|
12
|
+
Text: 'span'
|
|
13
|
+
}));
|
|
14
|
+
describe('FloatWindow widget', () => {
|
|
15
|
+
let container;
|
|
16
|
+
let listeners;
|
|
17
|
+
let event;
|
|
18
|
+
let props;
|
|
19
|
+
const store = getDefaultStore();
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
container = document.createElement('div');
|
|
22
|
+
document.body.appendChild(container);
|
|
23
|
+
listeners = new Map();
|
|
24
|
+
event = {
|
|
25
|
+
on: jest.fn((name, cb) => {
|
|
26
|
+
if (!listeners.has(name)) listeners.set(name, new Set());
|
|
27
|
+
listeners.get(name).add(cb);
|
|
28
|
+
}),
|
|
29
|
+
off: jest.fn((name, cb) => {
|
|
30
|
+
var _listeners$get;
|
|
31
|
+
return (_listeners$get = listeners.get(name)) === null || _listeners$get === void 0 ? void 0 : _listeners$get.delete(cb);
|
|
32
|
+
}),
|
|
33
|
+
emit: jest.fn(name => {
|
|
34
|
+
var _listeners$get2;
|
|
35
|
+
return (_listeners$get2 = listeners.get(name)) === null || _listeners$get2 === void 0 ? void 0 : _listeners$get2.forEach(cb => cb());
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
props = {
|
|
39
|
+
devId: 'camera',
|
|
40
|
+
event,
|
|
41
|
+
screenType: atom('vertical'),
|
|
42
|
+
absoluteContent: atom([]),
|
|
43
|
+
visible: true,
|
|
44
|
+
onClick: jest.fn(),
|
|
45
|
+
className: 'bottom-right-item-container'
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
afterEach(() => {
|
|
49
|
+
act(() => {
|
|
50
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
51
|
+
});
|
|
52
|
+
container.remove();
|
|
53
|
+
});
|
|
54
|
+
const render = function () {
|
|
55
|
+
let hide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
56
|
+
return act(() => {
|
|
57
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(UIEventContext.Provider, {
|
|
58
|
+
value: {
|
|
59
|
+
event,
|
|
60
|
+
componentHideState: hide,
|
|
61
|
+
refreshElement: false
|
|
62
|
+
}
|
|
63
|
+
}, /*#__PURE__*/React.createElement(FloatWindow, props)), container);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const button = () => container.querySelector('.bottom-right-item-container');
|
|
67
|
+
it('uses the panel visibility flag and callback; omitted flags are hidden', () => {
|
|
68
|
+
props.visible = undefined;
|
|
69
|
+
render();
|
|
70
|
+
expect(button()).toBeNull();
|
|
71
|
+
props.visible = true;
|
|
72
|
+
render();
|
|
73
|
+
expect(button()).not.toBeNull();
|
|
74
|
+
props.visible = false;
|
|
75
|
+
render();
|
|
76
|
+
expect(button()).toBeNull();
|
|
77
|
+
expect(event.emit).toHaveBeenCalledWith(bottomRightContentResize);
|
|
78
|
+
});
|
|
79
|
+
it('hides an entry without a click implementation', () => {
|
|
80
|
+
props.onClick = undefined;
|
|
81
|
+
render();
|
|
82
|
+
expect(button()).toBeNull();
|
|
83
|
+
});
|
|
84
|
+
it('passes the device id and prevents duplicate requests until completion', async () => {
|
|
85
|
+
let resolve;
|
|
86
|
+
props.onClick = jest.fn(() => new Promise(r => {
|
|
87
|
+
resolve = r;
|
|
88
|
+
}));
|
|
89
|
+
render();
|
|
90
|
+
act(() => {
|
|
91
|
+
Simulate.click(button());
|
|
92
|
+
Simulate.click(button());
|
|
93
|
+
});
|
|
94
|
+
expect(props.onClick).toHaveBeenCalledTimes(1);
|
|
95
|
+
expect(props.onClick).toHaveBeenCalledWith('camera');
|
|
96
|
+
await act(async () => {
|
|
97
|
+
resolve();
|
|
98
|
+
});
|
|
99
|
+
act(() => Simulate.click(button()));
|
|
100
|
+
expect(props.onClick).toHaveBeenCalledTimes(2);
|
|
101
|
+
await act(async () => {
|
|
102
|
+
resolve();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
it('hides for expanded landscape PTZ and restores after close', () => {
|
|
106
|
+
act(() => {
|
|
107
|
+
store.set(props.screenType, 'full');
|
|
108
|
+
store.set(props.absoluteContent, [{
|
|
109
|
+
id: ptzControlId
|
|
110
|
+
}]);
|
|
111
|
+
});
|
|
112
|
+
render();
|
|
113
|
+
expect(button()).not.toBeNull();
|
|
114
|
+
act(() => event.emit('ptzControlShow'));
|
|
115
|
+
expect(button()).toBeNull();
|
|
116
|
+
act(() => event.emit('ptzControlHide'));
|
|
117
|
+
expect(button()).not.toBeNull();
|
|
118
|
+
});
|
|
119
|
+
it('hides for a visible landscape cruise console but not in portrait', () => {
|
|
120
|
+
act(() => {
|
|
121
|
+
store.set(props.screenType, 'full');
|
|
122
|
+
store.set(props.absoluteContent, [{
|
|
123
|
+
id: fullTravelRouteControlId
|
|
124
|
+
}]);
|
|
125
|
+
});
|
|
126
|
+
render();
|
|
127
|
+
expect(button()).toBeNull();
|
|
128
|
+
act(() => store.set(props.absoluteContent, [{
|
|
129
|
+
id: fullTravelRouteControlId,
|
|
130
|
+
hidden: true
|
|
131
|
+
}]));
|
|
132
|
+
expect(button()).not.toBeNull();
|
|
133
|
+
act(() => {
|
|
134
|
+
store.set(props.absoluteContent, [{
|
|
135
|
+
id: fullTravelRouteControlId
|
|
136
|
+
}]);
|
|
137
|
+
store.set(props.screenType, 'vertical');
|
|
138
|
+
});
|
|
139
|
+
expect(button()).not.toBeNull();
|
|
140
|
+
});
|
|
141
|
+
it('coexists with the voice intercom and ignores hidden controls', () => {
|
|
142
|
+
act(() => {
|
|
143
|
+
store.set(props.screenType, 'full');
|
|
144
|
+
store.set(props.absoluteContent, [{
|
|
145
|
+
id: 'voiceIntercom'
|
|
146
|
+
}]);
|
|
147
|
+
});
|
|
148
|
+
render();
|
|
149
|
+
expect(button()).not.toBeNull();
|
|
150
|
+
act(() => store.set(props.absoluteContent, [{
|
|
151
|
+
id: fullTravelRouteControlId
|
|
152
|
+
}]));
|
|
153
|
+
render(true);
|
|
154
|
+
expect(button()).not.toBeNull();
|
|
155
|
+
});
|
|
156
|
+
it('unsubscribes from console events', () => {
|
|
157
|
+
render();
|
|
158
|
+
act(() => {
|
|
159
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
160
|
+
});
|
|
161
|
+
expect(listeners.get('ptzControlShow').size).toBe(0);
|
|
162
|
+
expect(listeners.get('ptzControlHide').size).toBe(0);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const floatWindowIcon: string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Source: 432 panel src/res/svg.js, SvgImage.floatWindow (24 × 24).
|
|
2
|
+
// Preserve the 432 path as an opaque mask; the widget uses the player icon color.
|
|
3
|
+
const path = 'M3.5 4H20.5V10.5C20.5 10.7761 20.7239 11 21 11H22C22.2761 11 22.5 10.7761 22.5 10.5V4C22.5 2.89543 21.6046 2 20.5 2H3.5C2.39543 2 1.5 2.89543 1.5 4V20C1.5 21.1046 2.39543 22 3.5 22H10.5C10.7761 22 11 21.7761 11 21.5V20.5C11 20.2239 10.7761 20 10.5 20H3.5V4ZM20.5 20V15H15L15 20H20.5ZM22.5 15C22.5 13.8954 21.6046 13 20.5 13H15C13.8954 13 13 13.8954 13 15V20C13 21.1046 13.8954 22 15 22H20.5C21.6046 22 22.5 21.1046 22.5 20V15ZM5.64645 7.56066C5.45118 7.3654 5.45118 7.04882 5.64645 6.85355L6.35355 6.14645C6.54882 5.95118 6.8654 5.95118 7.06066 6.14645L10.2929 9.37868V8C10.2929 7.72386 10.5168 7.5 10.7929 7.5H11.7929C12.069 7.5 12.2929 7.72386 12.2929 8V12.2929C12.2929 12.569 12.069 12.7929 11.7929 12.7929H7.49992C7.22378 12.7929 6.99992 12.569 6.99992 12.2929V11.2929C6.99992 11.0167 7.22378 10.7929 7.49992 10.7929H8.87868L5.64645 7.56066Z';
|
|
4
|
+
export const floatWindowIcon = `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="${path}" fill="#fff"/></svg>`)}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './floatWindow';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './floatWindow';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { View } from '@ray-js/ray';
|
|
1
|
+
import { View, Text } from '@ray-js/ray';
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useDpState } from '../../hooks';
|
|
6
5
|
import { useStore } from '../../ctx/store';
|
|
7
6
|
import { UIEventContext } from '../../ui/context';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { View } from '@ray-js/ray';
|
|
1
|
+
import { View, Text } from '@ray-js/ray';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { getServiceUrl } from '@ray-js/ray-ipc-utils';
|
|
5
5
|
import { useMemoizedFn } from 'ahooks';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import Strings from '../../i18n';
|
|
8
7
|
import { useStore } from '../../ctx/store';
|
|
9
8
|
import { showFlowLowTipId } from '../../ui/constant';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import React, { useContext, useEffect } from 'react';
|
|
3
|
-
import { View, setPageOrientation, hideMenuButton, showMenuButton, showStatusBar, hideStatusBar, setNavigationBarBack } from '@ray-js/ray';
|
|
3
|
+
import { View, setPageOrientation, Text, hideMenuButton, showMenuButton, showStatusBar, hideStatusBar, setNavigationBarBack } from '@ray-js/ray';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { unstable_batchedUpdates as batchedUpdates } from '@ray-core/ray';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import { UIEventContext } from '../../ui/context';
|
|
8
7
|
import { showAllComponent, voiceIntercomId, verticalScreenId, fullTravelRouteControlId, ptzControlId, fullResolutionId, fullSmallIntercomId, pauseTimeToHideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
9
8
|
import { useStore } from '../../ctx/store';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 全屏状态下要添加的摄像机行进路线控件
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import RectDirectionControl from '
|
|
5
|
+
import RectDirectionControl from '@ray-js/direction-control';
|
|
6
6
|
import type { ComponentConfigProps } from '../../interface';
|
|
7
7
|
type RectDirectionControlProps = React.ComponentProps<typeof RectDirectionControl>;
|
|
8
8
|
export type FullTravelRouteControlProps = ComponentConfigProps & {
|
|
@@ -6,8 +6,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
6
6
|
import React, { useEffect, useContext, useState, useRef } from 'react';
|
|
7
7
|
import { View } from '@ray-js/ray';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
+
import RectDirectionControl from '@ray-js/direction-control';
|
|
9
10
|
import { useMemoizedFn } from 'ahooks';
|
|
10
|
-
import RectDirectionControl from '../../renderer/directionControl';
|
|
11
11
|
import { UIEventContext } from '../../ui/context';
|
|
12
12
|
import { useDpState } from '../../hooks';
|
|
13
13
|
import { useComponentHideState } from '../../ui/hooks';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import './verticalScreen.less';
|
|
6
5
|
const NILL = () => null;
|
|
7
6
|
export function VerticalScreen(_ref) {
|
package/lib/widgets/index.d.ts
CHANGED
package/lib/widgets/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import { UIEventContext } from '../../ui/context';
|
|
7
6
|
import { hideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|