@ray-js/ipc-player-integration 0.0.1-beta-33 → 0.0.1-beta-35
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.composition.d.ts +9 -0
- package/lib/ctx/ctx.composition.js +10 -9
- package/lib/ctx/ctx.js +57 -16
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +2 -1
- package/lib/hooks/useDpState/useDpState.d.ts +6 -1
- package/lib/hooks/useDpState/useDpState.js +33 -5
- package/lib/hooks/useMemoizedFn/index.d.ts +1 -0
- package/lib/hooks/useMemoizedFn/index.js +1 -0
- package/lib/i18n/index.d.ts +4 -0
- package/lib/i18n/strings.d.ts +2 -0
- package/lib/i18n/strings.js +4 -2
- package/lib/iconfont/iconfont.css +67 -8
- package/lib/iconfont/iconfont.js +13 -13
- package/lib/iconfont/iconfont.json +112 -7
- 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 +9 -9
- package/lib/plugins/battery/battery.composition.d.ts +14 -18
- package/lib/plugins/battery/battery.js +2 -2
- package/lib/plugins/battery/battery.less +3 -3
- package/lib/plugins/fullScreen/constant.d.ts +1 -0
- package/lib/plugins/fullScreen/constant.js +1 -0
- package/lib/plugins/fullScreen/fullScreen.d.ts +3 -1
- package/lib/plugins/fullScreen/fullScreen.js +49 -32
- package/lib/plugins/fullScreen/fullScreen.less +6 -1
- package/lib/plugins/fullScreen/fullTravelRouteControl.d.ts +8 -0
- package/lib/plugins/fullScreen/fullTravelRouteControl.js +73 -0
- package/lib/plugins/fullScreen/fullVoiceIntercom.d.ts +3 -0
- package/lib/plugins/fullScreen/fullVoiceIntercom.js +22 -13
- package/lib/plugins/fullScreen/verticalScreen.d.ts +1 -0
- package/lib/plugins/fullSmallIntercom/fullSmallIntercom.d.ts +3 -1
- package/lib/plugins/fullSmallIntercom/fullSmallIntercom.js +2 -4
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/index.js +2 -1
- package/lib/plugins/moveInteractiveControl/controlButton.d.ts +8 -0
- package/lib/plugins/moveInteractiveControl/controlButton.js +44 -0
- package/lib/plugins/moveInteractiveControl/controlButton.less +4 -0
- package/lib/plugins/moveInteractiveControl/index.d.ts +2 -0
- package/lib/plugins/moveInteractiveControl/index.js +2 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControl.d.ts +6 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControl.js +50 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControl.less +38 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControlUI.d.ts +28 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControlUI.js +103 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControlUI.less +71 -0
- package/lib/plugins/ptz/ptz.d.ts +5 -1
- package/lib/plugins/ptz/ptz.js +21 -7
- package/lib/plugins/ptz/ptz.less +26 -6
- package/lib/plugins/ptz/ptzControl.js +16 -7
- package/lib/plugins/resolution/fullResolutionControl.js +32 -11
- package/lib/plugins/resolution/resolution.d.ts +8 -2
- package/lib/plugins/resolution/resolution.js +25 -23
- package/lib/plugins/resolution/resolution.less +2 -3
- package/lib/plugins/verticalSmallIntercom/verticalSmallIntercom.d.ts +3 -1
- package/lib/plugins/verticalSmallIntercom/verticalSmallIntercom.js +0 -1
- package/lib/plugins/videoBitKBP/videoBitKBP.d.ts +3 -1
- package/lib/ui/bottomLeftContent.js +5 -7
- package/lib/ui/bottomRightContent.js +5 -7
- package/lib/ui/constant.d.ts +1 -0
- package/lib/ui/constant.js +1 -0
- package/lib/ui/context.d.ts +1 -0
- package/lib/ui/context.js +2 -1
- package/lib/ui/hooks.d.ts +1 -1
- package/lib/ui/hooks.js +3 -21
- package/lib/ui/index.d.ts +1 -0
- package/lib/ui/topLeftContent.d.ts +2 -2
- package/lib/ui/topLeftContent.js +6 -8
- package/lib/ui/topRightContent.js +5 -7
- package/lib/ui/ui.d.ts +2 -0
- package/lib/ui/ui.js +57 -40
- package/lib/ui/ui.less +49 -12
- package/lib/utils/device/index.d.ts +4 -0
- package/lib/utils/device/index.js +27 -1
- package/lib/utils/plugins/index.d.ts +4 -0
- package/lib/utils/plugins/index.js +20 -0
- package/package.json +7 -2
- package/lib/iconfont/demo.css +0 -539
- package/lib/iconfont/demo_index.html +0 -1062
|
@@ -3,11 +3,15 @@ import React, { useContext } from 'react';
|
|
|
3
3
|
import { View, setPageOrientation, Text } from '@ray-js/ray';
|
|
4
4
|
import { useUpdateEffect } from 'ahooks';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
+
import { unstable_batchedUpdates as batchedUpdates } from '@ray-core/ray';
|
|
6
7
|
import { UIEventContext } from '../../ui/context';
|
|
7
|
-
import { showAllComponent, voiceIntercomId, verticalScreenId, ptzControlId, fullResolutionId, pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
8
|
+
import { showAllComponent, voiceIntercomId, verticalScreenId, fullTravelRouteControlId, ptzControlId, fullResolutionId, pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
8
9
|
import { useStore } from '../../ctx/store';
|
|
9
10
|
import { VerticalScreen } from './verticalScreen';
|
|
10
11
|
import { FullVoiceIntercom } from './fullVoiceIntercom';
|
|
12
|
+
import { FullTravelRouteControl } from './fullTravelRouteControl';
|
|
13
|
+
import { hasDpCode } from '../../utils/device';
|
|
14
|
+
import { DIRECTION_CONTROL_DP_CODE } from './constant';
|
|
11
15
|
import './fullScreen.less';
|
|
12
16
|
export function FullScreen(props) {
|
|
13
17
|
const {
|
|
@@ -15,9 +19,9 @@ export function FullScreen(props) {
|
|
|
15
19
|
setScreenType,
|
|
16
20
|
addContent,
|
|
17
21
|
deleteContent,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
className,
|
|
23
|
+
showContent,
|
|
24
|
+
devId
|
|
21
25
|
} = props;
|
|
22
26
|
const {
|
|
23
27
|
screenType
|
|
@@ -36,33 +40,48 @@ export function FullScreen(props) {
|
|
|
36
40
|
* 全屏统一操作
|
|
37
41
|
*/
|
|
38
42
|
const handleFull = () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
hasDpCode(devId, DIRECTION_CONTROL_DP_CODE).then(hasDirectionControlDpCode => {
|
|
44
|
+
ty.hideMenuButton();
|
|
45
|
+
ty.hideStatusBar();
|
|
46
|
+
ty.setNavigationBarBack({
|
|
47
|
+
type: 'custom'
|
|
48
|
+
});
|
|
49
|
+
batchedUpdates(() => {
|
|
50
|
+
// 添加全屏后,返回竖屏的控件
|
|
51
|
+
addContent('topLeft', {
|
|
52
|
+
id: verticalScreenId,
|
|
53
|
+
content: VerticalScreen,
|
|
54
|
+
absoluteContentClassName: 'ipc-player-plugin-vertical-screen-wrap',
|
|
55
|
+
initProps: _objectSpread(_objectSpread({}, props), {}, {
|
|
56
|
+
onClick: () => {
|
|
57
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
58
|
+
event.emit(showAllComponent);
|
|
59
|
+
handClick('vertical');
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
});
|
|
44
63
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
// 如果 dp DIRECTION_CONTROL_DP_CODE 存在,添加摄像机方向移动控件 否则 添加语音对讲控件
|
|
65
|
+
// 全屏后,添加语音对讲控件 显示全屏状态下的 小的语音对讲组件
|
|
66
|
+
if (hasDirectionControlDpCode) {
|
|
67
|
+
addContent('absolute', {
|
|
68
|
+
id: fullTravelRouteControlId,
|
|
69
|
+
content: props => /*#__PURE__*/React.createElement(FullTravelRouteControl, props),
|
|
70
|
+
absoluteContentClassName: 'ipc-player-plugin-full-screen-voice-wrap',
|
|
71
|
+
initProps: _objectSpread({}, props)
|
|
72
|
+
});
|
|
73
|
+
showContent('bottomLeft', 'FullSmallIntercom');
|
|
74
|
+
} else {
|
|
75
|
+
addContent('absolute', {
|
|
76
|
+
id: voiceIntercomId,
|
|
77
|
+
content: props => {
|
|
78
|
+
return /*#__PURE__*/React.createElement(FullVoiceIntercom, props);
|
|
79
|
+
},
|
|
80
|
+
absoluteContentClassName: 'ipc-player-plugin-full-screen-voice-wrap',
|
|
81
|
+
initProps: _objectSpread({}, props)
|
|
82
|
+
});
|
|
55
83
|
}
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
// 全屏后,添加语音对讲控件
|
|
59
|
-
addContent('absolute', {
|
|
60
|
-
id: voiceIntercomId,
|
|
61
|
-
content: props => {
|
|
62
|
-
return /*#__PURE__*/React.createElement(FullVoiceIntercom, props);
|
|
63
|
-
},
|
|
64
|
-
absoluteContentClassName: 'ipc-player-plugin-full-screen-voice-wrap',
|
|
65
|
-
initProps: _objectSpread({}, props)
|
|
84
|
+
}, null);
|
|
66
85
|
});
|
|
67
86
|
};
|
|
68
87
|
|
|
@@ -85,10 +104,8 @@ export function FullScreen(props) {
|
|
|
85
104
|
deleteContent('absolute', voiceIntercomId);
|
|
86
105
|
deleteContent('absolute', ptzControlId);
|
|
87
106
|
deleteContent('absolute', fullResolutionId);
|
|
88
|
-
|
|
89
|
-
setPtzActive(false);
|
|
107
|
+
deleteContent('absolute', fullTravelRouteControlId);
|
|
90
108
|
// 还原全屏清晰度状态值
|
|
91
|
-
setFullResolutionActive(false);
|
|
92
109
|
}
|
|
93
110
|
};
|
|
94
111
|
useUpdateEffect(() => {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
top: 50%;
|
|
13
13
|
transform: translate(0, -50%);
|
|
14
14
|
// transform: translate(180%, 0);
|
|
15
|
-
right: calc(36px * var(--ipc-player-size-scale, 1))
|
|
15
|
+
right: calc(36px * var(--ipc-player-size-scale, 1));
|
|
16
16
|
z-index: 340;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -22,4 +22,9 @@
|
|
|
22
22
|
&.ipc-player-plugin-full-screen-voice-hide {
|
|
23
23
|
transform: translate(180%, 0);
|
|
24
24
|
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ipc-plugin-full-travel-route-control {
|
|
28
|
+
width: calc(172px * var(--ipc-player-size-scale, 1));
|
|
29
|
+
height: calc(172px * var(--ipc-player-size-scale, 1));
|
|
25
30
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 全屏状态下要添加的摄像机行进路线控件
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React, { useEffect, useContext, useState, useRef } from 'react';
|
|
6
|
+
import { View } from '@ray-js/ray';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import RectDirectionControl from '@ray-js/direction-control';
|
|
9
|
+
import { useDebounceFn, useMemoizedFn } from 'ahooks';
|
|
10
|
+
import { UIEventContext } from '../../ui/context';
|
|
11
|
+
import { useDpState } from '../../hooks';
|
|
12
|
+
import { useComponentHideState } from '../../ui/hooks';
|
|
13
|
+
import { pauseTimeToHideAllComponent, startTimeToHideAllComponent } from '../../ui/constant';
|
|
14
|
+
import { DIRECTION_CONTROL_DP_CODE } from './constant';
|
|
15
|
+
export function FullTravelRouteControl(props) {
|
|
16
|
+
const [shouldHide] = useComponentHideState();
|
|
17
|
+
const [isPtzActive, setIsPtzActive] = useState(false);
|
|
18
|
+
const {
|
|
19
|
+
event
|
|
20
|
+
} = useContext(UIEventContext);
|
|
21
|
+
const prevRotate = useRef('-1');
|
|
22
|
+
const [state, _, sendDp] = useDpState({
|
|
23
|
+
devId: props.devId,
|
|
24
|
+
dpCodes: [DIRECTION_CONTROL_DP_CODE],
|
|
25
|
+
listenDpChange: true
|
|
26
|
+
});
|
|
27
|
+
const onPtzControlShow = useMemoizedFn(() => {
|
|
28
|
+
setIsPtzActive(true);
|
|
29
|
+
});
|
|
30
|
+
const onPtzControlHide = useMemoizedFn(() => {
|
|
31
|
+
setIsPtzActive(false);
|
|
32
|
+
});
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
event.on('ptzControlShow', onPtzControlShow);
|
|
35
|
+
event.on('ptzControlHide', onPtzControlHide);
|
|
36
|
+
return () => {
|
|
37
|
+
event.off('ptzControlShow', onPtzControlShow);
|
|
38
|
+
event.off('ptzControlHide', onPtzControlHide);
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
const {
|
|
42
|
+
run: sendDpValue
|
|
43
|
+
} = useDebounceFn(value => {
|
|
44
|
+
if (value === prevRotate.current) return;
|
|
45
|
+
sendDp({
|
|
46
|
+
[DIRECTION_CONTROL_DP_CODE]: value
|
|
47
|
+
});
|
|
48
|
+
prevRotate.current = value;
|
|
49
|
+
}, {
|
|
50
|
+
wait: 50,
|
|
51
|
+
leading: false,
|
|
52
|
+
trailing: false
|
|
53
|
+
});
|
|
54
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
55
|
+
className: clsx('ipc-player-plugin-full-screen-voice', {
|
|
56
|
+
'ipc-player-plugin-full-screen-voice-hide': shouldHide || isPtzActive
|
|
57
|
+
})
|
|
58
|
+
}, /*#__PURE__*/React.createElement(RectDirectionControl, {
|
|
59
|
+
className: "ipc-plugin-full-travel-route-control",
|
|
60
|
+
value: 0,
|
|
61
|
+
onTouchStart: value => {
|
|
62
|
+
sendDpValue(String(value));
|
|
63
|
+
},
|
|
64
|
+
onTouchMove: value => {
|
|
65
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
66
|
+
sendDpValue(String(value));
|
|
67
|
+
},
|
|
68
|
+
onTouchEnd: () => {
|
|
69
|
+
event.emit(startTimeToHideAllComponent);
|
|
70
|
+
sendDpValue('-1');
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
@@ -1,29 +1,38 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 全屏状态下要添加的语音对讲控件
|
|
4
|
+
*/
|
|
5
|
+
import React, { useContext, useState, useEffect } from 'react';
|
|
3
6
|
import { View } from '@ray-js/ray';
|
|
4
7
|
import clsx from 'clsx';
|
|
5
8
|
import { VoiceIntercom } from '../voiceIntercom';
|
|
6
9
|
import { useComponentHideState } from '../../ui/hooks';
|
|
10
|
+
import { useMemoizedFn } from '../../hooks';
|
|
7
11
|
import { UIEventContext } from '../../ui/context';
|
|
8
12
|
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
9
|
-
import { useStore } from '../../ctx/store';
|
|
10
13
|
export function FullVoiceIntercom(props) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
isPtzActive,
|
|
14
|
-
fullResolutionActive
|
|
15
|
-
} = useStore({
|
|
16
|
-
screenType: props.screenType,
|
|
17
|
-
isPtzActive: props.ptzActive,
|
|
18
|
-
fullResolutionActive: props.fullResolutionActive
|
|
19
|
-
});
|
|
20
|
-
const [shouldHide] = useComponentHideState(screenType);
|
|
14
|
+
const [shouldHide] = useComponentHideState();
|
|
15
|
+
const [isPtzActive, setIsPtzActive] = useState(false);
|
|
21
16
|
const {
|
|
22
17
|
event
|
|
23
18
|
} = useContext(UIEventContext);
|
|
19
|
+
const onPtzControlShow = useMemoizedFn(() => {
|
|
20
|
+
setIsPtzActive(true);
|
|
21
|
+
});
|
|
22
|
+
const onPtzControlHide = useMemoizedFn(() => {
|
|
23
|
+
setIsPtzActive(false);
|
|
24
|
+
});
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
event.on('ptzControlShow', onPtzControlShow);
|
|
27
|
+
event.on('ptzControlHide', onPtzControlHide);
|
|
28
|
+
return () => {
|
|
29
|
+
event.off('ptzControlShow', onPtzControlShow);
|
|
30
|
+
event.off('ptzControlHide', onPtzControlHide);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
24
33
|
return /*#__PURE__*/React.createElement(View, {
|
|
25
34
|
className: clsx('ipc-player-plugin-full-screen-voice', {
|
|
26
|
-
'ipc-player-plugin-full-screen-voice-hide': shouldHide || isPtzActive
|
|
35
|
+
'ipc-player-plugin-full-screen-voice-hide': shouldHide || isPtzActive
|
|
27
36
|
})
|
|
28
37
|
}, /*#__PURE__*/React.createElement(VoiceIntercom, _extends({}, props, {
|
|
29
38
|
talkingColor: "#FFFFFF",
|
|
@@ -3,6 +3,7 @@ import './verticalScreen.less';
|
|
|
3
3
|
import type { ComponentConfigProps } from '../../interface';
|
|
4
4
|
type Props = ComponentConfigProps & {
|
|
5
5
|
onClick?: () => void;
|
|
6
|
+
className?: string;
|
|
6
7
|
};
|
|
7
8
|
export declare function VerticalScreen({ onClick, className }: Props): React.JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentConfigProps } from '../../interface';
|
|
3
3
|
import './fullSmallIntercom.less';
|
|
4
|
-
type Props = ComponentConfigProps
|
|
4
|
+
type Props = ComponentConfigProps & {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
5
7
|
export declare function FullSmallIntercom(props: Props): React.JSX.Element | null;
|
|
6
8
|
export {};
|
|
@@ -13,17 +13,15 @@ export function FullSmallIntercom(props) {
|
|
|
13
13
|
} = props;
|
|
14
14
|
const {
|
|
15
15
|
screenType,
|
|
16
|
-
ptzActive,
|
|
17
16
|
brandColor
|
|
18
17
|
} = useStore({
|
|
19
18
|
screenType: props.screenType,
|
|
20
|
-
ptzActive: props.ptzActive,
|
|
21
19
|
brandColor: props.brandColor
|
|
22
20
|
});
|
|
23
21
|
const {
|
|
24
22
|
event
|
|
25
23
|
} = useContext(UIEventContext);
|
|
26
|
-
if (screenType === 'vertical'
|
|
24
|
+
if (screenType === 'vertical') {
|
|
27
25
|
return null;
|
|
28
26
|
}
|
|
29
27
|
const onTouchStart = () => {
|
|
@@ -32,7 +30,7 @@ export function FullSmallIntercom(props) {
|
|
|
32
30
|
const onTouchEnd = () => {
|
|
33
31
|
// event.emit(startTimeToHideAllComponent);
|
|
34
32
|
};
|
|
35
|
-
if (screenType === 'full'
|
|
33
|
+
if (screenType === 'full') {
|
|
36
34
|
return /*#__PURE__*/React.createElement(View, {
|
|
37
35
|
className: clsx(className)
|
|
38
36
|
}, /*#__PURE__*/React.createElement(VoiceIntercom, _extends({}, props, {
|
package/lib/plugins/index.d.ts
CHANGED
package/lib/plugins/index.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentConfigProps } from '../../interface';
|
|
3
|
+
import './controlButton.less';
|
|
4
|
+
type Props = ComponentConfigProps & {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function MoveInteractiveControlButton(props: Props): React.JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useStore } from '../../ctx/store';
|
|
5
|
+
import { UIEventContext } from '../../ui/context';
|
|
6
|
+
import { hideAllComponent } from '../../ui/constant';
|
|
7
|
+
import { MoveInteractiveControl } from './moveInteractiveControl';
|
|
8
|
+
import './controlButton.less';
|
|
9
|
+
const ID = 'MoveInteractiveControl';
|
|
10
|
+
export function MoveInteractiveControlButton(props) {
|
|
11
|
+
const {
|
|
12
|
+
screenType: screenTypeAtom,
|
|
13
|
+
addContent,
|
|
14
|
+
hasContent,
|
|
15
|
+
className
|
|
16
|
+
} = props;
|
|
17
|
+
const {
|
|
18
|
+
event
|
|
19
|
+
} = useContext(UIEventContext);
|
|
20
|
+
const {
|
|
21
|
+
screenType
|
|
22
|
+
} = useStore({
|
|
23
|
+
screenType: screenTypeAtom
|
|
24
|
+
});
|
|
25
|
+
// 竖屏状态下不展示控件按钮
|
|
26
|
+
if (screenType === 'vertical') return null;
|
|
27
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
28
|
+
onClick: () => {
|
|
29
|
+
event.emit(hideAllComponent);
|
|
30
|
+
if (hasContent('absolute', ID)) {
|
|
31
|
+
event.emit('showMoveInteractiveControl');
|
|
32
|
+
} else {
|
|
33
|
+
addContent('absolute', {
|
|
34
|
+
id: ID,
|
|
35
|
+
absoluteContentClassName: 'ipc-player-plugin-move-control-wrap',
|
|
36
|
+
content: () => /*#__PURE__*/React.createElement(MoveInteractiveControl, props)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
className: className
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
42
|
+
className: clsx('icon-panel', 'icon-panel-move-control-interactive', 'ipc-plugin-move-interactive-icon')
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { MoveInterActiveControlUI } from './moveInteractiveControlUI';
|
|
4
|
+
import { playerTap, showAllComponent } from '../../ui/constant';
|
|
5
|
+
import { useDpState } from '../../hooks';
|
|
6
|
+
import { UIEventContext } from '../../ui/context';
|
|
7
|
+
import './moveInteractiveControl.less';
|
|
8
|
+
const TYPE_CODE = 'ipc_manual_petting';
|
|
9
|
+
const STATE_CODE = 'ipc_manual_petting_state';
|
|
10
|
+
export function MoveInteractiveControl(props) {
|
|
11
|
+
const {
|
|
12
|
+
devId
|
|
13
|
+
} = props;
|
|
14
|
+
const [state, _, sendDp] = useDpState({
|
|
15
|
+
devId,
|
|
16
|
+
dpCodes: [TYPE_CODE, STATE_CODE],
|
|
17
|
+
listenDpChange: false
|
|
18
|
+
});
|
|
19
|
+
console.log('state', state);
|
|
20
|
+
const {
|
|
21
|
+
event
|
|
22
|
+
} = useContext(UIEventContext);
|
|
23
|
+
const [hide, setHide] = useState(false);
|
|
24
|
+
const onPlayerTap = useCallback(() => {
|
|
25
|
+
setHide(true);
|
|
26
|
+
event.emit(showAllComponent);
|
|
27
|
+
}, []);
|
|
28
|
+
const onShowMoveInteractiveControl = useCallback(() => {
|
|
29
|
+
setHide(false);
|
|
30
|
+
}, []);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
event.on(playerTap, onPlayerTap);
|
|
33
|
+
event.on('showMoveInteractiveControl', onShowMoveInteractiveControl);
|
|
34
|
+
return () => {
|
|
35
|
+
event.off(playerTap, onPlayerTap);
|
|
36
|
+
event.off('showMoveInteractiveControl', onShowMoveInteractiveControl);
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
return /*#__PURE__*/React.createElement(MoveInterActiveControlUI, {
|
|
40
|
+
wrapClsName: clsx('ipc-player-plugin-move-control', {
|
|
41
|
+
'ipc-player-plugin-move-control-hide': hide
|
|
42
|
+
}),
|
|
43
|
+
onClick: value => {
|
|
44
|
+
sendDp({
|
|
45
|
+
[TYPE_CODE]: value
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
activeKey: state[STATE_CODE] ? state[TYPE_CODE] : undefined
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@animation-time: 0.3s;
|
|
2
|
+
|
|
3
|
+
.ipc-player-plugin-move-control-wrap {
|
|
4
|
+
position: absolute;
|
|
5
|
+
right: 0;
|
|
6
|
+
top: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
display: flex;
|
|
9
|
+
z-index: 345;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@keyframes ipc-player-plugin-move-interactive {
|
|
13
|
+
from {
|
|
14
|
+
transform: translate(200%, 0);
|
|
15
|
+
opacity: 0;
|
|
16
|
+
}
|
|
17
|
+
to {
|
|
18
|
+
transform: translate(0, 0);
|
|
19
|
+
opacity: 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ipc-player-plugin-move-control {
|
|
24
|
+
position: absolute;
|
|
25
|
+
right: 0;
|
|
26
|
+
top: 0;
|
|
27
|
+
bottom: 0;
|
|
28
|
+
transition: transform @animation-time ease-in, opacity @animation-time ease-in;
|
|
29
|
+
animation: ipc-player-plugin-move-interactive 0.3s ease-in-out;
|
|
30
|
+
width: calc(288px * var(--ipc-player-size-scale, 1));
|
|
31
|
+
&.ipc-player-plugin-move-control-hide {
|
|
32
|
+
transform: translate(100%, 0);
|
|
33
|
+
opacity: 0;
|
|
34
|
+
}
|
|
35
|
+
&.ipc-player-plugin-move-control-show {
|
|
36
|
+
transform: translate(0, 0);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './moveInteractiveControlUI.less';
|
|
3
|
+
type CSSVariable = {
|
|
4
|
+
'--bgColor'?: string;
|
|
5
|
+
'--itemBgColor'?: string;
|
|
6
|
+
'--iconBgColor'?: string;
|
|
7
|
+
'--color'?: string;
|
|
8
|
+
'--titleFontSize'?: string;
|
|
9
|
+
'--titleColor'?: string;
|
|
10
|
+
'--itemFontSize'?: string;
|
|
11
|
+
'--iconFontSize'?: string;
|
|
12
|
+
'--activeColor'?: string;
|
|
13
|
+
};
|
|
14
|
+
export type MoveInterActiveControlUIProps = {
|
|
15
|
+
wrapClsName?: string;
|
|
16
|
+
contentClsName?: string;
|
|
17
|
+
CSSVariable?: CSSVariable;
|
|
18
|
+
menu?: MenuItem[];
|
|
19
|
+
onClick?: (key: MenuItem['key']) => void;
|
|
20
|
+
activeKey?: string;
|
|
21
|
+
};
|
|
22
|
+
type MenuItem = {
|
|
23
|
+
key: string;
|
|
24
|
+
label: string | React.ReactElement;
|
|
25
|
+
iconName?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function MoveInterActiveControlUI(props: MoveInterActiveControlUIProps): React.JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View, ScrollView } from '@ray-js/ray';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import './moveInteractiveControlUI.less';
|
|
6
|
+
const defaultMenu = [{
|
|
7
|
+
key: '0',
|
|
8
|
+
label: I18n.t('dp_ipc_manual_petting_0'),
|
|
9
|
+
iconName: 'icon-panel-move-control-rotate-place'
|
|
10
|
+
}, {
|
|
11
|
+
key: '1',
|
|
12
|
+
label: I18n.t('dp_ipc_manual_petting_1'),
|
|
13
|
+
iconName: 'icon-panel-move-control-straight-line'
|
|
14
|
+
}, {
|
|
15
|
+
key: '2',
|
|
16
|
+
label: I18n.t('dp_ipc_manual_petting_2'),
|
|
17
|
+
iconName: 'icon-panel-move-control-8'
|
|
18
|
+
}, {
|
|
19
|
+
key: '3',
|
|
20
|
+
label: I18n.t('dp_ipc_manual_petting_3'),
|
|
21
|
+
iconName: 'icon-panel-move-control-rotation'
|
|
22
|
+
}, {
|
|
23
|
+
key: '4',
|
|
24
|
+
label: I18n.t('dp_ipc_manual_petting_4'),
|
|
25
|
+
iconName: 'icon-panel-move-control-big-rotation'
|
|
26
|
+
}, {
|
|
27
|
+
key: '5',
|
|
28
|
+
label: I18n.t('dp_ipc_manual_petting_5'),
|
|
29
|
+
iconName: 'icon-panel-move-control-z'
|
|
30
|
+
}, {
|
|
31
|
+
key: '6',
|
|
32
|
+
label: I18n.t('dp_ipc_manual_petting_6'),
|
|
33
|
+
iconName: 'icon-panel-move-control-wave'
|
|
34
|
+
}, {
|
|
35
|
+
key: '7',
|
|
36
|
+
label: I18n.t('dp_ipc_manual_petting_7'),
|
|
37
|
+
iconName: 'icon-panel-move-control-p-steering'
|
|
38
|
+
}, {
|
|
39
|
+
key: '8',
|
|
40
|
+
label: I18n.t('dp_ipc_manual_petting_8'),
|
|
41
|
+
iconName: 'icon-panel-move-control-chacha'
|
|
42
|
+
}, {
|
|
43
|
+
key: '9',
|
|
44
|
+
label: I18n.t('dp_ipc_manual_petting_9'),
|
|
45
|
+
iconName: 'icon-panel-tange1'
|
|
46
|
+
}, {
|
|
47
|
+
key: '10',
|
|
48
|
+
label: I18n.t('dp_ipc_manual_petting_10'),
|
|
49
|
+
iconName: 'icon-panel-move-control-waltz'
|
|
50
|
+
}];
|
|
51
|
+
const defaultCSSVariable = {
|
|
52
|
+
'--bgColor': '#1A1A1A',
|
|
53
|
+
'--itemBgColor': 'rgba(255, 255, 255, 0.05)',
|
|
54
|
+
'--iconBgColor': 'rgba(255, 255, 255, 0.05)',
|
|
55
|
+
'--color': 'rgba(255, 255, 255, 0.7)',
|
|
56
|
+
'--titleColor': '#fff',
|
|
57
|
+
'--titleFontSize': '16px',
|
|
58
|
+
'--itemFontSize': '14px',
|
|
59
|
+
'--iconFontSize': '14px',
|
|
60
|
+
'--activeColor': '#FF592A'
|
|
61
|
+
};
|
|
62
|
+
export function MoveInterActiveControlUI(props) {
|
|
63
|
+
const {
|
|
64
|
+
contentClsName,
|
|
65
|
+
wrapClsName,
|
|
66
|
+
CSSVariable = defaultCSSVariable,
|
|
67
|
+
menu = defaultMenu,
|
|
68
|
+
activeKey,
|
|
69
|
+
onClick
|
|
70
|
+
} = props;
|
|
71
|
+
const handClick = item => {
|
|
72
|
+
onClick && onClick(item.key);
|
|
73
|
+
};
|
|
74
|
+
return /*#__PURE__*/React.createElement(View
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
, {
|
|
77
|
+
style: _objectSpread({}, CSSVariable),
|
|
78
|
+
className: clsx('ipc-player-plugin-active-control-wrap', wrapClsName)
|
|
79
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
80
|
+
className: clsx('ipc-player-plugin-active-control-title')
|
|
81
|
+
}, I18n.t('interactive')), /*#__PURE__*/React.createElement(ScrollView, {
|
|
82
|
+
style: {
|
|
83
|
+
flex: 1
|
|
84
|
+
},
|
|
85
|
+
scrollY: true
|
|
86
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
className: clsx('ipc-player-plugin-active-control', contentClsName)
|
|
88
|
+
}, menu.map(item => /*#__PURE__*/React.createElement(View, {
|
|
89
|
+
onClick: () => handClick(item),
|
|
90
|
+
key: item.key,
|
|
91
|
+
className: clsx('ipc-player-plugin-active-control-item', {
|
|
92
|
+
'ipc-player-plugin-active-control-item-active': activeKey === item.key
|
|
93
|
+
})
|
|
94
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
95
|
+
className: clsx('ipc-player-plugin-active-control-item-icon')
|
|
96
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
97
|
+
className: clsx('ipc-player-plugin-active-control-item-icon-mask')
|
|
98
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
99
|
+
className: clsx('icon-panel', item.iconName)
|
|
100
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
101
|
+
className: clsx('ipc-player-plugin-active-control-item-title')
|
|
102
|
+
}, item.label))))));
|
|
103
|
+
}
|