@ray-js/ipc-player-integration 0.0.66-beta.0 → 0.0.67-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/README.md +0 -6
- package/lib/ctx/ctx.album.test.d.ts +1 -0
- package/lib/ctx/ctx.album.test.js +197 -0
- package/lib/ctx/ctx.composition.js +13 -3
- package/lib/ctx/ctx.js +48 -35
- package/lib/ctx/multiCameraCtx.d.ts +2 -0
- package/lib/ctx/multiCameraCtx.js +17 -1
- package/lib/ctx/multiCameraCtx.test.d.ts +1 -0
- package/lib/ctx/multiCameraCtx.test.js +65 -0
- package/lib/i18n/index.d.ts +12 -0
- package/lib/i18n/strings.d.ts +6 -0
- package/lib/i18n/strings.js +6 -0
- package/lib/index.d.ts +0 -4
- package/lib/index.js +1 -3
- package/lib/interface.d.ts +18 -3
- package/lib/ui/absoluteContent.d.ts +2 -0
- package/lib/ui/absoluteContent.js +3 -0
- package/lib/ui/bottomLeftContent.js +55 -119
- package/lib/ui/bottomRightContent.js +3 -6
- package/lib/ui/ui.d.ts +0 -5
- package/lib/ui/ui.js +98 -89
- package/lib/utils/captureResult.d.ts +12 -0
- package/lib/utils/captureResult.js +70 -0
- package/lib/utils/captureResult.test.d.ts +1 -0
- package/lib/utils/captureResult.test.js +223 -0
- package/lib/utils/fullLinkTracking.d.ts +5 -0
- package/lib/utils/fullLinkTracking.js +71 -0
- package/lib/utils/navigation.d.ts +2 -1
- package/lib/utils/navigation.js +13 -3
- package/lib/widgets/battery/battery.js +5 -7
- package/lib/widgets/battery/batteryFull.js +5 -7
- package/lib/widgets/captureResult/captureResult.d.ts +16 -0
- package/lib/widgets/captureResult/captureResult.js +85 -0
- package/lib/widgets/captureResult/captureResult.less +144 -0
- package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
- package/lib/widgets/captureResult/captureResult.test.js +84 -0
- package/lib/widgets/captureResult/index.d.ts +2 -0
- package/lib/widgets/captureResult/index.js +2 -0
- package/lib/widgets/floodlight/floodlight.js +1 -2
- package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
- package/lib/widgets/fullScreen/fullScreen.js +4 -18
- 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 +3 -12
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
- package/lib/widgets/multiCamera/index.less +1 -0
- package/lib/widgets/multiCamera/landscapeTip.js +1 -2
- package/lib/widgets/multiCamera/moveablePtzControl.js +5 -5
- package/lib/widgets/multiCamera/multiPtz.js +2 -3
- package/lib/widgets/multiCamera/ptzMoveableTip.js +1 -2
- package/lib/widgets/multiCamera/switchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileMultiPtz.js +2 -3
- package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileTip.js +1 -2
- 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 +1 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +3 -6
- package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
- package/lib/widgets/recordVideo/recordVideo.js +58 -54
- package/lib/widgets/recordVideo/recordVideo.less +17 -74
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +1 -0
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +106 -0
- package/lib/widgets/recordVideo/recordVideo.test.js +1 -0
- package/lib/widgets/resolution/fullResolutionControl.js +19 -29
- package/lib/widgets/resolution/resolution.js +2 -3
- package/lib/widgets/screenshot/screenshot.js +67 -45
- package/lib/widgets/screenshot/screenshot.less +1 -40
- package/lib/widgets/screenshot/screenshot.test.d.ts +1 -0
- package/lib/widgets/screenshot/screenshot.test.js +135 -0
- 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.d.ts +2 -1
- package/lib/widgets/trialBadge/index.js +20 -17
- package/lib/widgets/trialBadge/index.less +0 -24
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +3 -2
- package/lib/widgets/trialBadge/useTrialBadge.js +21 -3
- package/lib/widgets/tryExperience/tryExperience.js +1 -2
- package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
- package/lib/widgets/voiceIntercom/voiceIntercom.js +24 -50
- package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -16
- 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 +0 -2
- package/lib/widgets/zoomTurntable/zoomTurntableDock.js +1 -1
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +18 -31
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +3 -23
- package/package.json +7 -15
- 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.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/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 -82
- 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/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
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/res/player-solar.png
DELETED
|
Binary file
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare function usesNativeHintImage(renderMode: string, platform: string): boolean;
|
|
3
|
-
/** Android cannot paint the WebView fade mask: end its viewport at the hint's left edge.
|
|
4
|
-
* Layout width and hint position still use the original measured WebView budget.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getHintViewport(renderMode: string, platform: string, scrollMode: boolean, lockedWidth: number, availableWidth: number, hintSize: number, hintEdgeGap: number, atEnd?: boolean): {
|
|
7
|
-
layoutWidth: number;
|
|
8
|
-
visibleWidth: number;
|
|
9
|
-
width: string;
|
|
10
|
-
};
|
|
11
|
-
/** Consume a Lynx control tap before paging can remove its native hit target. */
|
|
12
|
-
export declare function ScrollHintButton({ renderMode, platform, onPress, ...props }: {
|
|
13
|
-
renderMode: string;
|
|
14
|
-
platform?: string;
|
|
15
|
-
onPress?: () => void;
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
}): React.JSX.Element;
|
|
18
|
-
/** Keep legacy/iOS geometry; Android Lynx paints a real image rather than CSS URL/borders. */
|
|
19
|
-
export declare function ScrollHintArrow({ renderMode, platform, button, }: {
|
|
20
|
-
renderMode: string;
|
|
21
|
-
platform: string;
|
|
22
|
-
button: boolean;
|
|
23
|
-
}): React.JSX.Element;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["renderMode", "platform", "onPress"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { CoverView, Image, View } from '@ray-js/ray';
|
|
6
|
-
import clsx from 'clsx';
|
|
7
|
-
import moreArrow from '../res/player-more-arrow.png';
|
|
8
|
-
export function usesNativeHintImage(renderMode, platform) {
|
|
9
|
-
return renderMode === 'lynx' && platform === 'android';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/** Android cannot paint the WebView fade mask: end its viewport at the hint's left edge.
|
|
13
|
-
* Layout width and hint position still use the original measured WebView budget.
|
|
14
|
-
*/
|
|
15
|
-
export function getHintViewport(renderMode, platform, scrollMode, lockedWidth, availableWidth, hintSize, hintEdgeGap) {
|
|
16
|
-
let atEnd = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
17
|
-
const layoutWidth = lockedWidth > 0 ? lockedWidth : availableWidth;
|
|
18
|
-
const reservedHintWidth = usesNativeHintImage(renderMode, platform) && scrollMode && !atEnd ? hintSize + hintEdgeGap : 0;
|
|
19
|
-
const visibleWidth = Math.max(0, layoutWidth - reservedHintWidth);
|
|
20
|
-
return {
|
|
21
|
-
layoutWidth,
|
|
22
|
-
visibleWidth,
|
|
23
|
-
width: lockedWidth > 0 ? `${visibleWidth}px` : reservedHintWidth ? `calc(100% - ${reservedHintWidth}px)` : '100%'
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/** Consume a Lynx control tap before paging can remove its native hit target. */
|
|
28
|
-
export function ScrollHintButton(_ref) {
|
|
29
|
-
let {
|
|
30
|
-
renderMode,
|
|
31
|
-
platform,
|
|
32
|
-
onPress
|
|
33
|
-
} = _ref,
|
|
34
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
-
const nativeHitTarget = usesNativeHintImage(renderMode, platform || '');
|
|
36
|
-
const HintHost = nativeHitTarget ? View : CoverView;
|
|
37
|
-
return /*#__PURE__*/React.createElement(HintHost, _extends({}, props, nativeHitTarget ? {
|
|
38
|
-
flatten: false,
|
|
39
|
-
'native-interaction-enabled': true
|
|
40
|
-
} : {}, {
|
|
41
|
-
onClick: onPress ? event => {
|
|
42
|
-
var _event$origin, _event$origin$stopPro;
|
|
43
|
-
if (renderMode === 'lynx') event === null || event === void 0 || (_event$origin = event.origin) === null || _event$origin === void 0 || (_event$origin$stopPro = _event$origin.stopPropagation) === null || _event$origin$stopPro === void 0 || _event$origin$stopPro.call(_event$origin);
|
|
44
|
-
onPress();
|
|
45
|
-
} : undefined
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** Keep legacy/iOS geometry; Android Lynx paints a real image rather than CSS URL/borders. */
|
|
50
|
-
export function ScrollHintArrow(_ref2) {
|
|
51
|
-
let {
|
|
52
|
-
renderMode,
|
|
53
|
-
platform,
|
|
54
|
-
button
|
|
55
|
-
} = _ref2;
|
|
56
|
-
if (usesNativeHintImage(renderMode, platform)) {
|
|
57
|
-
const size = button ? '14px' : '10px';
|
|
58
|
-
return /*#__PURE__*/React.createElement(Image, {
|
|
59
|
-
className: "ipc-player-bottom-left-scroll-hint-image",
|
|
60
|
-
src: moreArrow,
|
|
61
|
-
mode: "aspectFit",
|
|
62
|
-
style: {
|
|
63
|
-
width: size,
|
|
64
|
-
height: size,
|
|
65
|
-
flexShrink: 0,
|
|
66
|
-
pointerEvents: 'none'
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
71
|
-
className: clsx('ipc-player-bottom-left-scroll-hint-arrow', {
|
|
72
|
-
'ipc-player-bottom-left-scroll-hint-arrow--right': true,
|
|
73
|
-
'ipc-player-bottom-left-scroll-hint-arrow--light': button,
|
|
74
|
-
'ipc-player-bottom-left-scroll-hint-arrow--static': button
|
|
75
|
-
}),
|
|
76
|
-
style: button ? {
|
|
77
|
-
width: '9px',
|
|
78
|
-
height: '9px',
|
|
79
|
-
transform: 'translate(-1px, 0) rotate(45deg)'
|
|
80
|
-
} : undefined
|
|
81
|
-
});
|
|
82
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { Image, View, getSystemInfoSync } from '@ray-js/ray';
|
|
3
|
-
import { usePlayerRenderMode } from '../../renderer/context';
|
|
4
|
-
import chargingImage from '../../res/player-charging.png';
|
|
5
|
-
import solarImage from '../../res/player-solar.png';
|
|
6
|
-
import './statusIcon.less';
|
|
7
|
-
|
|
8
|
-
/** Android needs a real image; geometry is normalized from the stylesheet. */
|
|
9
|
-
export function BatteryStatusIcon(_ref) {
|
|
10
|
-
let {
|
|
11
|
-
kind
|
|
12
|
-
} = _ref;
|
|
13
|
-
const renderMode = usePlayerRenderMode();
|
|
14
|
-
const platform = useMemo(() => {
|
|
15
|
-
var _getSystemInfoSync;
|
|
16
|
-
return renderMode === 'lynx' ? (_getSystemInfoSync = getSystemInfoSync()) === null || _getSystemInfoSync === void 0 ? void 0 : _getSystemInfoSync.platform : '';
|
|
17
|
-
}, [renderMode]);
|
|
18
|
-
const className = `icon-panel icon-panel-${kind} ipc-player-plugin-battery-${kind}`;
|
|
19
|
-
if (renderMode !== 'lynx' || platform !== 'android') return /*#__PURE__*/React.createElement(View, {
|
|
20
|
-
className: className
|
|
21
|
-
});
|
|
22
|
-
if (kind === 'solar') {
|
|
23
|
-
return /*#__PURE__*/React.createElement(Image, {
|
|
24
|
-
className: `${className} ipc-player-plugin-battery-solar-image`,
|
|
25
|
-
src: solarImage,
|
|
26
|
-
mode: "aspectFit"
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
30
|
-
className: `${className} ipc-player-plugin-battery-charging-image-wrap`
|
|
31
|
-
}, /*#__PURE__*/React.createElement(Image, {
|
|
32
|
-
className: "ipc-player-plugin-battery-charging-image",
|
|
33
|
-
src: chargingImage,
|
|
34
|
-
mode: "scaleToFill"
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
.ipc-player-plugin-battery-charging-image-wrap {
|
|
2
|
-
position: relative;
|
|
3
|
-
width: calc(16px * var(--ipc-player-size-scale, 1));
|
|
4
|
-
height: calc(16px * var(--ipc-player-size-scale, 1));
|
|
5
|
-
flex-shrink: 0;
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
background-image: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.ipc-player-plugin-battery-charging-image {
|
|
11
|
-
position: absolute;
|
|
12
|
-
left: calc(-1px * var(--ipc-player-size-scale, 1));
|
|
13
|
-
top: 0;
|
|
14
|
-
width: calc(18px * var(--ipc-player-size-scale, 1));
|
|
15
|
-
height: calc(19px * var(--ipc-player-size-scale, 1));
|
|
16
|
-
pointer-events: none;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.ipc-player-plugin-battery-solar-image {
|
|
20
|
-
width: calc(8px * var(--ipc-player-size-scale, 1));
|
|
21
|
-
height: calc(8px * var(--ipc-player-size-scale, 1));
|
|
22
|
-
background-image: none;
|
|
23
|
-
pointer-events: none;
|
|
24
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
2
|
-
/** Keep legacy draw coordinates, but bound the actual native clipping host to the video. */
|
|
3
|
-
export declare function clipZoomDock(position: CSSProperties, horizontalWidth?: number): {
|
|
4
|
-
position: CSSProperties;
|
|
5
|
-
content: CSSProperties;
|
|
6
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
/** Keep legacy draw coordinates, but bound the actual native clipping host to the video. */
|
|
3
|
-
export function clipZoomDock(position, horizontalWidth) {
|
|
4
|
-
const next = _objectSpread(_objectSpread({}, position), {}, {
|
|
5
|
-
overflow: 'hidden'
|
|
6
|
-
});
|
|
7
|
-
const content = {
|
|
8
|
-
position: 'absolute',
|
|
9
|
-
top: 0,
|
|
10
|
-
left: 0
|
|
11
|
-
};
|
|
12
|
-
if (horizontalWidth !== undefined) {
|
|
13
|
-
const right = parseFloat(String(position.right)) || 0;
|
|
14
|
-
next.right = `${Math.max(0, right)}px`;
|
|
15
|
-
next.width = `${Math.max(0, horizontalWidth + Math.min(0, right))}px`;
|
|
16
|
-
content.width = `${horizontalWidth}px`;
|
|
17
|
-
content.height = '100%';
|
|
18
|
-
} else {
|
|
19
|
-
const bottom = parseFloat(String(position.bottom)) || 0;
|
|
20
|
-
const height = parseFloat(String(position.height)) || 0;
|
|
21
|
-
next.bottom = `${Math.max(0, bottom)}px`;
|
|
22
|
-
next.height = `${Math.max(0, height + Math.min(0, bottom))}px`;
|
|
23
|
-
content.height = `${height}px`;
|
|
24
|
-
content.width = '100%';
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
position: next,
|
|
28
|
-
content
|
|
29
|
-
};
|
|
30
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ZoomTurntableProps } from './type';
|
|
3
|
-
import './lynx.less';
|
|
4
|
-
/** Native nodes only: no WebView canvas/RJS, and no fallback into the legacy tree. */
|
|
5
|
-
export default function LynxZoomTurntable(props: ZoomTurntableProps): React.JSX.Element;
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
|
-
import "core-js/modules/esnext.iterator.filter.js";
|
|
4
|
-
import "core-js/modules/esnext.iterator.for-each.js";
|
|
5
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
-
import { View, Text } from '@ray-js/ray';
|
|
7
|
-
import { SvgRender } from '@ray-js/components';
|
|
8
|
-
import { dialPaint } from './lynxPaint';
|
|
9
|
-
import { dialGeometry, dialProgress, dragDialRawValue, snapDialValue, tapDialValue } from './lynxModel';
|
|
10
|
-
import './lynx.less';
|
|
11
|
-
let sequence = 0;
|
|
12
|
-
const consume = e => {
|
|
13
|
-
var _e$origin, _e$origin$stopPropaga, _e$stopPropagation;
|
|
14
|
-
e === null || e === void 0 || (_e$origin = e.origin) === null || _e$origin === void 0 || (_e$origin$stopPropaga = _e$origin.stopPropagation) === null || _e$origin$stopPropaga === void 0 || _e$origin$stopPropaga.call(_e$origin);
|
|
15
|
-
e === null || e === void 0 || (_e$stopPropagation = e.stopPropagation) === null || _e$stopPropagation === void 0 || _e$stopPropagation.call(e);
|
|
16
|
-
};
|
|
17
|
-
const touch = e => {
|
|
18
|
-
var _e$touches, _e$changedTouches, _e$detail, _p$clientX, _p$clientY;
|
|
19
|
-
const p = (e === null || e === void 0 || (_e$touches = e.touches) === null || _e$touches === void 0 ? void 0 : _e$touches[0]) || (e === null || e === void 0 || (_e$changedTouches = e.changedTouches) === null || _e$changedTouches === void 0 ? void 0 : _e$changedTouches[0]) || (e === null || e === void 0 || (_e$detail = e.detail) === null || _e$detail === void 0 || (_e$detail = _e$detail.touches) === null || _e$detail === void 0 ? void 0 : _e$detail[0]);
|
|
20
|
-
if (!p) return null;
|
|
21
|
-
const x = Number((_p$clientX = p.clientX) !== null && _p$clientX !== void 0 ? _p$clientX : p.pageX);
|
|
22
|
-
const y = Number((_p$clientY = p.clientY) !== null && _p$clientY !== void 0 ? _p$clientY : p.pageY);
|
|
23
|
-
return Number.isFinite(x) && Number.isFinite(y) ? {
|
|
24
|
-
x,
|
|
25
|
-
y
|
|
26
|
-
} : null;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** Native nodes only: no WebView canvas/RJS, and no fallback into the legacy tree. */
|
|
30
|
-
export default function LynxZoomTurntable(props) {
|
|
31
|
-
var _props$styleOptions$m, _props$styleOptions, _props$styleOptions$o, _props$styleOptions2;
|
|
32
|
-
const [id] = useState(() => `ipc-zoom-turntable-lynx-${++sequence}`);
|
|
33
|
-
const options = useRef(props);
|
|
34
|
-
options.current = props;
|
|
35
|
-
const [value, setValue] = useState(() => {
|
|
36
|
-
var _ref, _ref2, _props$value;
|
|
37
|
-
return snapDialValue((_ref = (_ref2 = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : props.defaultValue) !== null && _ref2 !== void 0 ? _ref2 : props.min) !== null && _ref !== void 0 ? _ref : 1, props);
|
|
38
|
-
});
|
|
39
|
-
// TEMP DEBUG-zoom-perf-1109: bounded gesture sample, removed after comparison.
|
|
40
|
-
const profile = useRef(null);
|
|
41
|
-
const capture = (event, phase) => {
|
|
42
|
-
var _ref3, _ref4, _origin$timeStamp, _pt$clientX, _pt$clientY;
|
|
43
|
-
const r = profile.current;
|
|
44
|
-
if (!r || r.events.length >= 400) return;
|
|
45
|
-
const origin = (event === null || event === void 0 ? void 0 : event.origin) || event;
|
|
46
|
-
const pt = ((origin === null || origin === void 0 ? void 0 : origin.touches) || (origin === null || origin === void 0 ? void 0 : origin.changedTouches) || [])[0];
|
|
47
|
-
r.events.push({
|
|
48
|
-
phase,
|
|
49
|
-
at: Date.now(),
|
|
50
|
-
nativeTime: (_ref3 = (_ref4 = (_origin$timeStamp = origin === null || origin === void 0 ? void 0 : origin.timeStamp) !== null && _origin$timeStamp !== void 0 ? _origin$timeStamp : origin === null || origin === void 0 ? void 0 : origin.timestamp) !== null && _ref4 !== void 0 ? _ref4 : event === null || event === void 0 ? void 0 : event.timeStamp) !== null && _ref3 !== void 0 ? _ref3 : event === null || event === void 0 ? void 0 : event.timestamp,
|
|
51
|
-
x: (_pt$clientX = pt === null || pt === void 0 ? void 0 : pt.clientX) !== null && _pt$clientX !== void 0 ? _pt$clientX : pt === null || pt === void 0 ? void 0 : pt.x,
|
|
52
|
-
y: (_pt$clientY = pt === null || pt === void 0 ? void 0 : pt.clientY) !== null && _pt$clientY !== void 0 ? _pt$clientY : pt === null || pt === void 0 ? void 0 : pt.y
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (profile.current && profile.current.commits.length < 400) profile.current.commits.push({
|
|
57
|
-
at: Date.now(),
|
|
58
|
-
value
|
|
59
|
-
});
|
|
60
|
-
}, [value]);
|
|
61
|
-
const current = useRef(value);
|
|
62
|
-
const visual = useRef(value);
|
|
63
|
-
const frame = useRef(null);
|
|
64
|
-
const notifyTimer = useRef(null);
|
|
65
|
-
const notified = useRef(value);
|
|
66
|
-
const gesture = useRef(null);
|
|
67
|
-
const rect = useRef(null);
|
|
68
|
-
const cooldown = useRef(0);
|
|
69
|
-
const publish = () => {
|
|
70
|
-
frame.current = null;
|
|
71
|
-
setValue(visual.current);
|
|
72
|
-
};
|
|
73
|
-
const notify = () => {
|
|
74
|
-
var _options$current$onCh, _options$current;
|
|
75
|
-
notifyTimer.current = null;
|
|
76
|
-
if (notified.current === current.current) return;
|
|
77
|
-
notified.current = current.current;
|
|
78
|
-
const t = Date.now();
|
|
79
|
-
(_options$current$onCh = (_options$current = options.current).onChange) === null || _options$current$onCh === void 0 || _options$current$onCh.call(_options$current, current.current);
|
|
80
|
-
if (profile.current && profile.current.callbacks.length < 400) profile.current.callbacks.push({
|
|
81
|
-
at: t,
|
|
82
|
-
duration: Date.now() - t
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
const update = next => {
|
|
86
|
-
if (next === visual.current) return;
|
|
87
|
-
visual.current = next;
|
|
88
|
-
current.current = snapDialValue(next, options.current);
|
|
89
|
-
if (frame.current == null) frame.current = setTimeout(publish, 16);
|
|
90
|
-
// Match preview's existing 80ms cadence; local paint must not wait for lens/parent work.
|
|
91
|
-
if (notifyTimer.current == null) notifyTimer.current = setTimeout(notify, 80);
|
|
92
|
-
};
|
|
93
|
-
const measure = () => {
|
|
94
|
-
ty.createSelectorQuery().select(`#${id}`).boundingClientRect(r => {
|
|
95
|
-
if ((r === null || r === void 0 ? void 0 : r.width) > 0) rect.current = r;
|
|
96
|
-
}).exec(() => undefined);
|
|
97
|
-
};
|
|
98
|
-
const end = function (e) {
|
|
99
|
-
var _options$current$onCh2, _options$current2, _options$current$onTo, _options$current3, _options$current$onBl, _options$current4;
|
|
100
|
-
let cancelled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
101
|
-
consume(e);
|
|
102
|
-
const active = gesture.current;
|
|
103
|
-
if (!active) return;
|
|
104
|
-
capture(e, 'end');
|
|
105
|
-
gesture.current = null;
|
|
106
|
-
const point = touch(e);
|
|
107
|
-
const isTap = !cancelled && !active.moved && Date.now() - active.at <= 350;
|
|
108
|
-
let blank = false;
|
|
109
|
-
if (isTap && point && rect.current) {
|
|
110
|
-
const next = tapDialValue(point.x - rect.current.left, point.y - rect.current.top, current.current, options.current);
|
|
111
|
-
if (next === null) blank = true;else update(next);
|
|
112
|
-
}
|
|
113
|
-
if (frame.current != null) {
|
|
114
|
-
clearTimeout(frame.current);
|
|
115
|
-
frame.current = null;
|
|
116
|
-
publish();
|
|
117
|
-
}
|
|
118
|
-
if (notifyTimer.current != null) clearTimeout(notifyTimer.current);
|
|
119
|
-
notifyTimer.current = null;
|
|
120
|
-
notify();
|
|
121
|
-
cooldown.current = Date.now() + 300;
|
|
122
|
-
// Match RJS: cancel also settles the last value, releasing useLensZoom dragging state.
|
|
123
|
-
if (!blank) (_options$current$onCh2 = (_options$current2 = options.current).onChangeEnd) === null || _options$current$onCh2 === void 0 || _options$current$onCh2.call(_options$current2, current.current);
|
|
124
|
-
(_options$current$onTo = (_options$current3 = options.current).onTouchEnd) === null || _options$current$onTo === void 0 || _options$current$onTo.call(_options$current3);
|
|
125
|
-
if (blank) (_options$current$onBl = (_options$current4 = options.current).onBlankTap) === null || _options$current$onBl === void 0 || _options$current$onBl.call(_options$current4);
|
|
126
|
-
const sample = profile.current;
|
|
127
|
-
profile.current = null;
|
|
128
|
-
try {
|
|
129
|
-
var _env;
|
|
130
|
-
const root = (_env = ty.env) === null || _env === void 0 ? void 0 : _env.USER_DATA_PATH;
|
|
131
|
-
if (root && sample && sample.events.filter(item => item.phase === 'move').length >= 2) ty.getFileSystemManager().writeFile({
|
|
132
|
-
filePath: `${root}/ipc-zoom-perf-1109.json`,
|
|
133
|
-
encoding: 'utf8',
|
|
134
|
-
data: JSON.stringify(_objectSpread(_objectSpread({}, sample), {}, {
|
|
135
|
-
end: Date.now(),
|
|
136
|
-
version: 'vector-raw-v4-sample2'
|
|
137
|
-
})),
|
|
138
|
-
fail: () => undefined
|
|
139
|
-
});
|
|
140
|
-
} catch (error) {
|
|
141
|
-
/* The sample must never interrupt zoom cleanup. */
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
useEffect(() => {
|
|
145
|
-
if (!gesture.current && Date.now() >= cooldown.current) {
|
|
146
|
-
var _ref5, _ref6, _props$value2;
|
|
147
|
-
current.current = snapDialValue((_ref5 = (_ref6 = (_props$value2 = props.value) !== null && _props$value2 !== void 0 ? _props$value2 : props.defaultValue) !== null && _ref6 !== void 0 ? _ref6 : props.min) !== null && _ref5 !== void 0 ? _ref5 : 1, props);
|
|
148
|
-
visual.current = current.current;
|
|
149
|
-
notified.current = current.current;
|
|
150
|
-
setValue(current.current);
|
|
151
|
-
}
|
|
152
|
-
}, [props.value, props.min, props.max, props.step]);
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
measure();
|
|
155
|
-
return () => {
|
|
156
|
-
if (frame.current != null) clearTimeout(frame.current);
|
|
157
|
-
frame.current = null;
|
|
158
|
-
if (notifyTimer.current != null) clearTimeout(notifyTimer.current);
|
|
159
|
-
notifyTimer.current = null;
|
|
160
|
-
if (gesture.current) {
|
|
161
|
-
var _options$current$onTo2, _options$current5;
|
|
162
|
-
gesture.current = null;
|
|
163
|
-
(_options$current$onTo2 = (_options$current5 = options.current).onTouchEnd) === null || _options$current$onTo2 === void 0 || _options$current$onTo2.call(_options$current5);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
}, []);
|
|
167
|
-
const g = useMemo(() => dialGeometry(props), [props.scale, props.cropRatio, props.orientation, props.styleOptions]);
|
|
168
|
-
const progress = dialProgress(value, props);
|
|
169
|
-
const geo = g.scale * 5 / 6;
|
|
170
|
-
const right = props.orientation === 'right';
|
|
171
|
-
const color = props.activeColor || '#fff';
|
|
172
|
-
const elements = [];
|
|
173
|
-
const label = (key, text, angle, size, active) => {
|
|
174
|
-
const gap = g.option('labelTopGap', -1 / g.scale);
|
|
175
|
-
const inset = gap >= 0 ? gap + size / 2 + 2 * g.scale : null;
|
|
176
|
-
const rx = right ? g.rx - g.option('innerLabelOffsetX', 22) * 5 / 6 : inset != null ? g.mx - inset : g.rx + 4 * geo;
|
|
177
|
-
const ry = right ? g.ry - g.option('innerLabelOffsetY', 22) * 5 / 6 - (active ? 10 * geo : 0) : inset != null ? g.my - inset : g.ry + 18 * geo;
|
|
178
|
-
const pt = g.at(angle, rx, ry);
|
|
179
|
-
const w = size * Math.max(3, text.length);
|
|
180
|
-
elements.push(/*#__PURE__*/React.createElement(Text, {
|
|
181
|
-
key: key,
|
|
182
|
-
className: "ipc-zoom-turntable-lynx-paint",
|
|
183
|
-
style: {
|
|
184
|
-
left: `${pt.x - w / 2}px`,
|
|
185
|
-
top: `${pt.y - size * 0.7}px`,
|
|
186
|
-
width: `${w}px`,
|
|
187
|
-
height: `${size * 1.4}px`,
|
|
188
|
-
lineHeight: `${size * 1.4}px`,
|
|
189
|
-
textAlign: 'center',
|
|
190
|
-
fontSize: `${size}px`,
|
|
191
|
-
color: active ? color : 'rgba(255,255,255,0.65)',
|
|
192
|
-
fontWeight: '500'
|
|
193
|
-
}
|
|
194
|
-
}, text));
|
|
195
|
-
};
|
|
196
|
-
(props.marks || []).forEach((mark, index) => {
|
|
197
|
-
const offset = dialProgress(mark.value, props) - progress;
|
|
198
|
-
if (Math.abs(offset) > 0.28 || Math.abs(offset) < 0.012) return;
|
|
199
|
-
const angle = Math.PI * 1.5 + offset * Math.PI;
|
|
200
|
-
label(`label-${index}`, mark.label.replace(/x$/i, ''), angle, g.option('markLabelFontSize', 14), false);
|
|
201
|
-
});
|
|
202
|
-
label('current', `${Number(snapDialValue(value, props).toFixed(2))}X`, Math.PI * 1.5, g.option('currentLabelFontSize', (_props$styleOptions$m = (_props$styleOptions = props.styleOptions) === null || _props$styleOptions === void 0 ? void 0 : _props$styleOptions.markLabelFontSize) !== null && _props$styleOptions$m !== void 0 ? _props$styleOptions$m : 14), true);
|
|
203
|
-
const bg = g.point(g.cx, g.cy);
|
|
204
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
205
|
-
id: id,
|
|
206
|
-
className: "ipc-zoom-turntable-lynx",
|
|
207
|
-
style: {
|
|
208
|
-
width: `${g.width}px`,
|
|
209
|
-
height: `${g.height}px`
|
|
210
|
-
},
|
|
211
|
-
'native-interaction-enabled': true,
|
|
212
|
-
'native-interaction-consume-events': true,
|
|
213
|
-
flatten: false,
|
|
214
|
-
onTouchStart: e => {
|
|
215
|
-
var _options$current$onTo3, _options$current6;
|
|
216
|
-
consume(e);
|
|
217
|
-
const pt = touch(e);
|
|
218
|
-
if (!pt) return;
|
|
219
|
-
// The player may have moved with its parent since mounting; never query during move.
|
|
220
|
-
measure();
|
|
221
|
-
profile.current = {
|
|
222
|
-
start: Date.now(),
|
|
223
|
-
events: [],
|
|
224
|
-
commits: [],
|
|
225
|
-
callbacks: []
|
|
226
|
-
};
|
|
227
|
-
capture(e, 'start');
|
|
228
|
-
gesture.current = {
|
|
229
|
-
start: pt,
|
|
230
|
-
last: right ? pt.y : pt.x,
|
|
231
|
-
at: Date.now(),
|
|
232
|
-
moved: false,
|
|
233
|
-
rawValue: current.current
|
|
234
|
-
};
|
|
235
|
-
(_options$current$onTo3 = (_options$current6 = options.current).onTouchStart) === null || _options$current$onTo3 === void 0 || _options$current$onTo3.call(_options$current6);
|
|
236
|
-
},
|
|
237
|
-
onTouchMove: e => {
|
|
238
|
-
consume(e);
|
|
239
|
-
const active = gesture.current;
|
|
240
|
-
capture(e, 'move');
|
|
241
|
-
const pt = touch(e);
|
|
242
|
-
if (!active || !pt) return;
|
|
243
|
-
if (Math.abs(pt.x - active.start.x) > 10 || Math.abs(pt.y - active.start.y) > 10) active.moved = true;
|
|
244
|
-
const axis = right ? pt.y : pt.x;
|
|
245
|
-
// Keep fractional movement across events; quantize only the public value, not the next movement's origin.
|
|
246
|
-
active.rawValue = dragDialRawValue(active.rawValue, axis - active.last, options.current);
|
|
247
|
-
update(active.rawValue);
|
|
248
|
-
active.last = axis;
|
|
249
|
-
},
|
|
250
|
-
onTouchEnd: e => end(e),
|
|
251
|
-
onTouchCancel: e => end(e, true),
|
|
252
|
-
onClick: consume
|
|
253
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
254
|
-
className: "ipc-zoom-turntable-lynx-paint",
|
|
255
|
-
style: {
|
|
256
|
-
left: `${bg.x - (right ? g.my : g.mx)}px`,
|
|
257
|
-
top: `${bg.y - (right ? g.mx : g.my)}px`,
|
|
258
|
-
width: `${(right ? g.my : g.mx) * 2}px`,
|
|
259
|
-
height: `${(right ? g.mx : g.my) * 2}px`,
|
|
260
|
-
borderRadius: '50%',
|
|
261
|
-
backgroundColor: `rgba(0,0,0,${(_props$styleOptions$o = (_props$styleOptions2 = props.styleOptions) === null || _props$styleOptions2 === void 0 ? void 0 : _props$styleOptions2.overlayOpacity) !== null && _props$styleOptions$o !== void 0 ? _props$styleOptions$o : 0.44})`
|
|
262
|
-
}
|
|
263
|
-
}), /*#__PURE__*/React.createElement(SvgRender, {
|
|
264
|
-
className: "ipc-zoom-turntable-lynx-paint",
|
|
265
|
-
style: {
|
|
266
|
-
left: 0,
|
|
267
|
-
top: 0,
|
|
268
|
-
width: `${g.width}px`,
|
|
269
|
-
height: `${g.height}px`
|
|
270
|
-
},
|
|
271
|
-
source: dialPaint(props, value)
|
|
272
|
-
}), elements);
|
|
273
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { ZoomTurntableProps } from './type';
|
|
2
|
-
export declare function dialRange(p: ZoomTurntableProps): {
|
|
3
|
-
min: number;
|
|
4
|
-
max: number;
|
|
5
|
-
step: number;
|
|
6
|
-
};
|
|
7
|
-
export declare function snapDialValue(value: number, p: ZoomTurntableProps): number;
|
|
8
|
-
export declare function dialProgress(value: number, p: ZoomTurntableProps): number;
|
|
9
|
-
export declare function dialValue(progress: number, p: ZoomTurntableProps): number;
|
|
10
|
-
/** Same viewport and ellipse geometry as the WebView RJS, in logical px. */
|
|
11
|
-
type DialPoint = {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
};
|
|
15
|
-
type DialGeometry = {
|
|
16
|
-
width: number;
|
|
17
|
-
height: number;
|
|
18
|
-
baseWidth: number;
|
|
19
|
-
baseHeight: number;
|
|
20
|
-
scale: number;
|
|
21
|
-
mx: number;
|
|
22
|
-
my: number;
|
|
23
|
-
cx: number;
|
|
24
|
-
cy: number;
|
|
25
|
-
rx: number;
|
|
26
|
-
ry: number;
|
|
27
|
-
point: (x: number, y: number) => DialPoint;
|
|
28
|
-
inverse: (x: number, y: number) => DialPoint;
|
|
29
|
-
at: (angle: number, radiusX?: number, radiusY?: number) => DialPoint;
|
|
30
|
-
option: (key: keyof NonNullable<ZoomTurntableProps['styleOptions']>, fallback: number) => number;
|
|
31
|
-
};
|
|
32
|
-
export declare function dialGeometry(p: ZoomTurntableProps): DialGeometry;
|
|
33
|
-
/** Left drag increases bottom dial; downward drag increases the right-side dial. */
|
|
34
|
-
export declare function dragDialRawValue(value: number, delta: number, p: ZoomTurntableProps): number;
|
|
35
|
-
export declare function dragDialValue(value: number, delta: number, p: ZoomTurntableProps): number;
|
|
36
|
-
export declare function tapDialValue(x: number, y: number, value: number, p: ZoomTurntableProps): number | null;
|
|
37
|
-
export {};
|