@ray-js/ipc-player-integration 0.0.67-beta.2 → 0.0.69-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.
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const getBottomCoverHeight = (screenType, isVerticalFullLayout, shouldHide) => {
|
|
2
|
+
if (screenType === 'full') return shouldHide ? 59 : 58;
|
|
3
|
+
|
|
4
|
+
// Distinct sizes refresh native hit regions when only the parent moves.
|
|
5
|
+
return 48 + (isVerticalFullLayout ? 1 : 0) + (shouldHide ? 2 : 0);
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getBottomCoverHeight } from './bottomCoverHeight';
|
|
2
|
+
describe('bottom cover height', () => {
|
|
3
|
+
it('changes size for every vertical layout and visibility transition', () => {
|
|
4
|
+
const heights = [getBottomCoverHeight('vertical', false, false), getBottomCoverHeight('vertical', true, false), getBottomCoverHeight('vertical', false, true), getBottomCoverHeight('vertical', true, true)];
|
|
5
|
+
expect(new Set(heights).size).toBe(4);
|
|
6
|
+
expect(Math.min(...heights)).toBe(48);
|
|
7
|
+
expect(Math.max(...heights)).toBeLessThanOrEqual(51);
|
|
8
|
+
});
|
|
9
|
+
it('preserves landscape sizes regardless of the vertical layout state', () => {
|
|
10
|
+
for (const isVerticalFullLayout of [false, true]) {
|
|
11
|
+
expect(getBottomCoverHeight('full', isVerticalFullLayout, false)).toBe(58);
|
|
12
|
+
expect(getBottomCoverHeight('full', isVerticalFullLayout, true)).toBe(59);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -10,6 +10,7 @@ import { CoverView, ScrollView, View } from '@ray-js/ray';
|
|
|
10
10
|
import clsx from 'clsx';
|
|
11
11
|
import { useStore } from '../ctx/store';
|
|
12
12
|
import { useComponentHideState } from './hooks';
|
|
13
|
+
import { getBottomCoverHeight } from './bottomCoverHeight';
|
|
13
14
|
import { TrialBadge, useTrialBadge } from '../widgets/trialBadge';
|
|
14
15
|
import { bottomLeftContentResize, pauseTimeToHideAllComponent, startTimeToHideAllComponent } from './constant';
|
|
15
16
|
|
|
@@ -45,11 +46,13 @@ const BottomLeftContent = _ref => {
|
|
|
45
46
|
} = _ref;
|
|
46
47
|
const {
|
|
47
48
|
screenType,
|
|
49
|
+
isVerticalFullLayout,
|
|
48
50
|
playState,
|
|
49
51
|
brandColor,
|
|
50
52
|
bottomLeftContent
|
|
51
53
|
} = useStore({
|
|
52
54
|
screenType: ctx.screenType,
|
|
55
|
+
isVerticalFullLayout: ctx.isVerticalFullLayout,
|
|
53
56
|
playState: ctx.playState,
|
|
54
57
|
brandColor: ctx.brandColor,
|
|
55
58
|
bottomLeftContent: ctx.bottomLeftContent
|
|
@@ -366,7 +369,7 @@ const BottomLeftContent = _ref => {
|
|
|
366
369
|
// 点击右箭头:直接滚动到最右端。
|
|
367
370
|
// 给一个足够大的目标值,交由 ScrollView 自身夹取到真实最右端,避免测量误差导致滚不到底。
|
|
368
371
|
|
|
369
|
-
const coverHeight = screenType
|
|
372
|
+
const coverHeight = getBottomCoverHeight(screenType, isVerticalFullLayout, shouldHide);
|
|
370
373
|
const containerHeight = screenType === 'vertical' ? 48 : 58;
|
|
371
374
|
|
|
372
375
|
// reservedRight 兼容 number(px)与 string(任意 CSS 长度,例如 "35%")
|
|
@@ -394,6 +397,7 @@ const BottomLeftContent = _ref => {
|
|
|
394
397
|
style: {
|
|
395
398
|
right: rightCss,
|
|
396
399
|
height: showBadge ? `${coverHeight + 30}px` : `${coverHeight}px`,
|
|
400
|
+
boxSizing: 'border-box',
|
|
397
401
|
display: 'flex',
|
|
398
402
|
flexDirection: 'column',
|
|
399
403
|
justifyContent: 'flex-start',
|
|
@@ -403,6 +407,8 @@ const BottomLeftContent = _ref => {
|
|
|
403
407
|
}, showBadge && /*#__PURE__*/React.createElement(View, {
|
|
404
408
|
style: {
|
|
405
409
|
height: '32px',
|
|
410
|
+
position: 'relative',
|
|
411
|
+
top: `${coverHeight - containerHeight}px`,
|
|
406
412
|
marginLeft: screenType === 'vertical' ? '12px' : '25px'
|
|
407
413
|
}
|
|
408
414
|
}, /*#__PURE__*/React.createElement(TrialBadge, {
|
|
@@ -460,6 +466,8 @@ const BottomLeftContent = _ref => {
|
|
|
460
466
|
paddingRight: `${paddingRightPx}px`,
|
|
461
467
|
width: verticalScrollWidth > 0 ? `${verticalScrollWidth}px` : '100%',
|
|
462
468
|
height: `${containerHeight}px`,
|
|
469
|
+
position: 'relative',
|
|
470
|
+
top: `${coverHeight - containerHeight}px`,
|
|
463
471
|
marginTop: showBadge ? '-2px' : 0,
|
|
464
472
|
whiteSpace: 'nowrap'
|
|
465
473
|
}
|
|
@@ -4,6 +4,7 @@ import { CoverView, View } from '@ray-js/ray';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useStore } from '../ctx/store';
|
|
6
6
|
import { useComponentHideState } from './hooks';
|
|
7
|
+
import { getBottomCoverHeight } from './bottomCoverHeight';
|
|
7
8
|
|
|
8
9
|
// 用唯一 className 在 createSelectorQuery 中区分多个实例,避免互相干扰
|
|
9
10
|
let rightClsSeq = 0;
|
|
@@ -16,10 +17,12 @@ const BottomRightContent = _ref => {
|
|
|
16
17
|
} = _ref;
|
|
17
18
|
const {
|
|
18
19
|
screenType,
|
|
20
|
+
isVerticalFullLayout,
|
|
19
21
|
playState,
|
|
20
22
|
bottomRightContent
|
|
21
23
|
} = useStore({
|
|
22
24
|
screenType: ctx.screenType,
|
|
25
|
+
isVerticalFullLayout: ctx.isVerticalFullLayout,
|
|
23
26
|
playState: ctx.playState,
|
|
24
27
|
bottomRightContent: ctx.bottomRightContent
|
|
25
28
|
});
|
|
@@ -56,6 +59,7 @@ const BottomRightContent = _ref => {
|
|
|
56
59
|
};
|
|
57
60
|
}, [screenType, playState, bottomRightContent === null || bottomRightContent === void 0 ? void 0 : bottomRightContent.length, shouldHide, wrapCls, onWidthChange]);
|
|
58
61
|
const containerHeight = screenType === 'vertical' ? 48 : 58;
|
|
62
|
+
const coverHeight = getBottomCoverHeight(screenType, isVerticalFullLayout, shouldHide);
|
|
59
63
|
|
|
60
64
|
// 将 width 统一规范成 CSS 合法值。number → "${n}px",string → 原样透传。
|
|
61
65
|
// 0 / 空串视为「没有传宽度」,沿用默认布局(不设 width)。
|
|
@@ -72,7 +76,8 @@ const BottomRightContent = _ref => {
|
|
|
72
76
|
// 竖屏归 0:这 10px 是纯空白,且计入实测宽后又被 reservedRight 带给左下角,
|
|
73
77
|
// 等于左下角白让 10px。与右下角按钮的间距统一由 BOTTOM_RIGHT_SAFE_GAP 负责。
|
|
74
78
|
paddingLeft: '0',
|
|
75
|
-
height:
|
|
79
|
+
height: `${coverHeight}px`,
|
|
80
|
+
boxSizing: 'border-box'
|
|
76
81
|
}, widthStyle)
|
|
77
82
|
}, /*#__PURE__*/React.createElement(View, {
|
|
78
83
|
style: {
|
|
@@ -80,6 +85,8 @@ const BottomRightContent = _ref => {
|
|
|
80
85
|
paddingRight: screenType === 'vertical' ? 0 : '25px',
|
|
81
86
|
width: '100%',
|
|
82
87
|
height: `${containerHeight}px`,
|
|
88
|
+
position: 'relative',
|
|
89
|
+
top: `${coverHeight - containerHeight}px`,
|
|
83
90
|
justifyContent: 'flex-end'
|
|
84
91
|
},
|
|
85
92
|
className: clsx('ipc-player-bottom-right-content-container', {
|