@onekeyfe/react-native-native-overlay 6.7.0-alpha.436 → 6.7.0-alpha.444
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/docs/SPEC.md +25 -0
- package/lib/module/OverlayView.js +8 -3
- package/lib/module/OverlayView.js.map +1 -1
- package/lib/module/contentSize.js +20 -0
- package/lib/module/contentSize.js.map +1 -0
- package/lib/typescript/src/OverlayView.d.ts.map +1 -1
- package/lib/typescript/src/OverlayViewTypes.d.ts +11 -0
- package/lib/typescript/src/OverlayViewTypes.d.ts.map +1 -1
- package/lib/typescript/src/contentSize.d.ts +19 -0
- package/lib/typescript/src/contentSize.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/OverlayView.tsx +10 -1
- package/src/OverlayViewTypes.ts +8 -0
- package/src/contentSize.ts +21 -0
package/docs/SPEC.md
CHANGED
|
@@ -156,6 +156,7 @@ visible)`, `removePage(ownerKey)`.
|
|
|
156
156
|
dismissOnBackPress
|
|
157
157
|
dismissOnPanDown // sheet and toast only
|
|
158
158
|
anchor? // anchored only: a trigger ref or a window rect
|
|
159
|
+
contentSize? // native non-sheet only: content frame instead of the window size
|
|
159
160
|
onPresented onDismissRequest onDismissed(reason)
|
|
160
161
|
/>
|
|
161
162
|
```
|
|
@@ -432,6 +433,27 @@ the correction:
|
|
|
432
433
|
- Rects already in screen space (for example from native lists) need no
|
|
433
434
|
correction.
|
|
434
435
|
|
|
436
|
+
### Content size for windows about to rotate
|
|
437
|
+
|
|
438
|
+
Implemented; Android runtime-verified with OneKey's native chart fullscreen on
|
|
439
|
+
an API 36 emulator. iOS takes the same JS layout path but was not
|
|
440
|
+
runtime-verified. Non-sheet content is laid out by JS at the window size it
|
|
441
|
+
last saw (`useWindowDimensions`), and the Android content host clips the
|
|
442
|
+
content to that frame. JS hears about a rotation only after the window has
|
|
443
|
+
rotated, so until then the content keeps the previous orientation's frame and
|
|
444
|
+
is clipped to it.
|
|
445
|
+
|
|
446
|
+
- `contentSize?: { width, height }` (non-sheet presentations) replaces the
|
|
447
|
+
window size for the content frame. A caller that prepares content for the
|
|
448
|
+
window it is about to rotate into passes the rotated size, so the first
|
|
449
|
+
rotated frame shows all of it. Omitted, the content follows the window size
|
|
450
|
+
as before.
|
|
451
|
+
- The content stays anchored at the host origin. While the window has not
|
|
452
|
+
rotated yet, content larger than the window draws past its edges and takes
|
|
453
|
+
no touches there; the caller keeps it hidden until the window matches.
|
|
454
|
+
- Sheets ignore it: they size their content from the sheet geometry. Web
|
|
455
|
+
ignores it: the DOM overlay sizes itself with CSS.
|
|
456
|
+
|
|
435
457
|
### Web keyboard focus containment
|
|
436
458
|
|
|
437
459
|
The topmost active, unsuspended blocking Web entry MUST contain sequential
|
|
@@ -580,6 +602,9 @@ Automated (P0):
|
|
|
580
602
|
- page suspend, restore and removal;
|
|
581
603
|
- back resolution (global first, `block`, `pass`, focused host) and the
|
|
582
604
|
blocking top.
|
|
605
|
+
- `src/__tests__/contentSize.test.ts` covers the non-sheet content frame:
|
|
606
|
+
the window size by default, and a caller size before and after the window
|
|
607
|
+
size reaches JS.
|
|
583
608
|
- `src/__tests__/animation.test.ts` covers:
|
|
584
609
|
- the spring response in all damping regimes, overshoot clamping and settle
|
|
585
610
|
time;
|
|
@@ -5,6 +5,7 @@ import { Platform, PlatformColor, Pressable, StatusBar, StyleSheet, View, useWin
|
|
|
5
5
|
import NativeOverlay from './NativeOverlayNativeComponent';
|
|
6
6
|
import { OverlayLevelProvider } from "./OverlayLevelContext.js";
|
|
7
7
|
import { isBlockingLevel } from "./OverlayLevels.js";
|
|
8
|
+
import { resolveContentSize } from "./contentSize.js";
|
|
8
9
|
import { resolveSheetWidth } from "./sheetWidth.js";
|
|
9
10
|
import { useOverlayController } from "./useOverlayController.js";
|
|
10
11
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -67,7 +68,8 @@ export function OverlayView(props) {
|
|
|
67
68
|
children,
|
|
68
69
|
testID,
|
|
69
70
|
windowOffsetRequest,
|
|
70
|
-
onWindowOffset
|
|
71
|
+
onWindowOffset,
|
|
72
|
+
contentSize
|
|
71
73
|
} = props;
|
|
72
74
|
// A plain sibling at the host's spot: its JS-measured origin shares the
|
|
73
75
|
// modal-relative space of the caller's measurements, while native reports
|
|
@@ -242,8 +244,11 @@ export function OverlayView(props) {
|
|
|
242
244
|
collapsable: false,
|
|
243
245
|
pointerEvents: "box-none",
|
|
244
246
|
style: {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
+
...resolveContentSize({
|
|
248
|
+
windowWidth: width,
|
|
249
|
+
windowHeight: height,
|
|
250
|
+
contentSize
|
|
251
|
+
}),
|
|
247
252
|
flexShrink: 0
|
|
248
253
|
},
|
|
249
254
|
children: /*#__PURE__*/_jsx(OverlayLevelProvider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useMemo","useRef","useState","Platform","PlatformColor","Pressable","StatusBar","StyleSheet","View","useWindowDimensions","NativeOverlay","OverlayLevelProvider","isBlockingLevel","resolveSheetWidth","useOverlayController","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DEFAULT_BACKDROP_COLOR","DEFAULT_SHEET_MAX_RATIO","DEFAULT_SHEET_CORNER_RADIUS","SHEET_SURFACE_TAIL_HEIGHT","REQUEST_REASONS","back","backdrop","pan","styles","create","host","position","top","left","width","sheetMarginLeft","bottom","sheetMarginRight","right","sheetSurface","borderCurve","overflow","flexGrow","sheetSurfaceTail","height","OverlayView","props","level","presentation","blocking","dismissOnBackPress","sheet","keepContentMounted","statusBarStyle","children","testID","windowOffsetRequest","onWindowOffset","offsetProbeRef","onHostWindowOrigin","event","x","nativeX","y","nativeY","nativeEvent","current","measureInWindow","isSheet","controller","entry","mounted","presented","ownsStatusBar","scope","hostKey","ownerKey","animation","onHostPresented","onHostDismissed","onHostRequestDismiss","measuredSheetHeight","setMeasuredSheetHeight","reportedSheetWidth","setReportedSheetWidth","containerWidth","sheetContainerWidth","inset","sheetInset","windowWidth","reportedWidth","maxWidth","hasSheetSurface","undefined","sheetSurfaceBackgroundColor","backgroundColor","OS","dismissOnBackdropPress","dismissOnPress","onSheetMarginPress","onSheetLayoutReport","maxSheetHeight","maxHeight","sheetHeight","Math","min","onSheetLayout","layout","animationConfig","JSON","stringify","isBlocking","onDismissed","onRequestDismiss","reason","statusBar","animated","barStyle","ref","collapsable","pointerEvents","style","visible","stackOrder","seq","backdropColor","color","sheetCornerRadius","cornerRadius","showHandle","sheetBackgroundColor","dismissOnPanDown","onPresented","hostOriginRequest","onLayout","paddingHorizontal","flexShrink","accessible","importantForAccessibility","onPress","borderTopLeftRadius","borderTopRightRadius","value"],"sourceRoot":"../../src","sources":["OverlayView.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAE9D,SACEC,QAAQ,EACRC,aAAa,EACbC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,IAAI,EACJC,mBAAmB,QACd,cAAc;AAErB,OAAOC,aAAa,MAAM,gCAAgC;AAC1D,SAASC,oBAAoB,QAAQ,0BAAuB;AAC5D,SAASC,eAAe,QAAQ,oBAAiB;AACjD,SAASC,iBAAiB,QAAQ,iBAAc;AAChD,SAASC,oBAAoB,QAAQ,2BAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAS9D,MAAMC,sBAAsB,GAAG,oBAAoB;AACnD,MAAMC,uBAAuB,GAAG,IAAI;AACpC,MAAMC,2BAA2B,GAAG,EAAE;AACtC;AACA,MAAMC,yBAAyB,GAAG,GAAG;AAErC,MAAMC,eAA6D,GAAG;EACpEC,IAAI,EAAE,MAAM;EACZC,QAAQ,EAAE,UAAU;EACpBC,GAAG,EAAE;AACP,CAAC;AAED,MAAMC,MAAM,
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useRef","useState","Platform","PlatformColor","Pressable","StatusBar","StyleSheet","View","useWindowDimensions","NativeOverlay","OverlayLevelProvider","isBlockingLevel","resolveContentSize","resolveSheetWidth","useOverlayController","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DEFAULT_BACKDROP_COLOR","DEFAULT_SHEET_MAX_RATIO","DEFAULT_SHEET_CORNER_RADIUS","SHEET_SURFACE_TAIL_HEIGHT","REQUEST_REASONS","back","backdrop","pan","styles","create","host","position","top","left","width","sheetMarginLeft","bottom","sheetMarginRight","right","sheetSurface","borderCurve","overflow","flexGrow","sheetSurfaceTail","height","OverlayView","props","level","presentation","blocking","dismissOnBackPress","sheet","keepContentMounted","statusBarStyle","children","testID","windowOffsetRequest","onWindowOffset","contentSize","offsetProbeRef","onHostWindowOrigin","event","x","nativeX","y","nativeY","nativeEvent","current","measureInWindow","isSheet","controller","entry","mounted","presented","ownsStatusBar","scope","hostKey","ownerKey","animation","onHostPresented","onHostDismissed","onHostRequestDismiss","measuredSheetHeight","setMeasuredSheetHeight","reportedSheetWidth","setReportedSheetWidth","containerWidth","sheetContainerWidth","inset","sheetInset","windowWidth","reportedWidth","maxWidth","hasSheetSurface","undefined","sheetSurfaceBackgroundColor","backgroundColor","OS","dismissOnBackdropPress","dismissOnPress","onSheetMarginPress","onSheetLayoutReport","maxSheetHeight","maxHeight","sheetHeight","Math","min","onSheetLayout","layout","animationConfig","JSON","stringify","isBlocking","onDismissed","onRequestDismiss","reason","statusBar","animated","barStyle","ref","collapsable","pointerEvents","style","visible","stackOrder","seq","backdropColor","color","sheetCornerRadius","cornerRadius","showHandle","sheetBackgroundColor","dismissOnPanDown","onPresented","hostOriginRequest","onLayout","paddingHorizontal","flexShrink","accessible","importantForAccessibility","onPress","borderTopLeftRadius","borderTopRightRadius","value","windowHeight"],"sourceRoot":"../../src","sources":["OverlayView.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAA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QAAA,eAEFvC,IAAA,CAACN,oBAAoB;cAACsI,KAAK,EAAEhG,KAAM;cAAAO,QAAA,EAChCA;YAAQ,CACW;UAAC,CACnB,CAAC;QAAA,CACP,CAAC,gBAEHvC,IAAA,CAACN,oBAAoB;UAACsI,KAAK,EAAEhG,KAAM;UAAAO,QAAA,EAChCA;QAAQ,CACW;MACvB,CACG,CAAC,gBAEPvC,IAAA,CAACT,IAAI;QACHkH,WAAW,EAAE,KAAM;QACnBC,aAAa,EAAC,UAAU;QACxBC,KAAK,EAAE;UACL,GAAG/G,kBAAkB,CAAC;YACpB+E,WAAW,EAAExD,KAAK;YAClB8G,YAAY,EAAEpG,MAAM;YACpBc;UACF,CAAC,CAAC;UACF+E,UAAU,EAAE;QACd,CAAE;QAAAnF,QAAA,eAEFvC,IAAA,CAACN,oBAAoB;UAACsI,KAAK,EAAEhG,KAAM;UAAAO,QAAA,EAChCA;QAAQ,CACW;MAAC,CACnB;IACP,CACY,CAAC;EAAA,CAChB,CAAC;AAEP","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Non-sheet content geometry. JS lays the content out at the window size it
|
|
5
|
+
* last saw, and the native content host clips the content to that frame. Right
|
|
6
|
+
* after the window rotates, JS still holds the previous size, so a caller that
|
|
7
|
+
* prepared its content for the window it is about to rotate into passes that
|
|
8
|
+
* size instead.
|
|
9
|
+
*/
|
|
10
|
+
export function resolveContentSize({
|
|
11
|
+
windowWidth,
|
|
12
|
+
windowHeight,
|
|
13
|
+
contentSize
|
|
14
|
+
}) {
|
|
15
|
+
return {
|
|
16
|
+
width: contentSize?.width ?? windowWidth,
|
|
17
|
+
height: contentSize?.height ?? windowHeight
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=contentSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["resolveContentSize","windowWidth","windowHeight","contentSize","width","height"],"sourceRoot":"../../src","sources":["contentSize.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,kBAAkBA,CAAC;EACjCC,WAAW;EACXC,YAAY;EACZC;AAKF,CAAC,EAAqC;EACpC,OAAO;IACLC,KAAK,EAAED,WAAW,EAAEC,KAAK,IAAIH,WAAW;IACxCI,MAAM,EAAEF,WAAW,EAAEE,MAAM,IAAIH;EACjC,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayView.d.ts","sourceRoot":"","sources":["../../../src/OverlayView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OverlayView.d.ts","sourceRoot":"","sources":["../../../src/OverlayView.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAuC5B,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,sCAoPnD"}
|
|
@@ -77,6 +77,17 @@ export interface IOverlayViewProps {
|
|
|
77
77
|
x: number;
|
|
78
78
|
y: number;
|
|
79
79
|
}) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Native only, non-sheet presentations. Lays the content out at this size
|
|
82
|
+
* instead of the window size JS last saw. The content host clips the
|
|
83
|
+
* content to that frame, and JS hears about a rotation only after the
|
|
84
|
+
* window has rotated: content prepared for the window it is about to rotate
|
|
85
|
+
* into passes the rotated size, so the first rotated frame shows all of it.
|
|
86
|
+
*/
|
|
87
|
+
contentSize?: {
|
|
88
|
+
width: number;
|
|
89
|
+
height: number;
|
|
90
|
+
};
|
|
80
91
|
/** The exit animation finished and the content unmounted. */
|
|
81
92
|
onClose?: (reason: IOverlayDismissReason) => void;
|
|
82
93
|
children?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayViewTypes.d.ts","sourceRoot":"","sources":["../../../src/OverlayViewTypes.ts"],"names":[],"mappings":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C,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,IAAI,CAAC;IAClE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D;;;;;;OAMG;IACH,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Non-sheet content geometry. JS lays the content out at the window size it
|
|
3
|
+
* last saw, and the native content host clips the content to that frame. Right
|
|
4
|
+
* after the window rotates, JS still holds the previous size, so a caller that
|
|
5
|
+
* prepared its content for the window it is about to rotate into passes that
|
|
6
|
+
* size instead.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveContentSize({ windowWidth, windowHeight, contentSize, }: {
|
|
9
|
+
windowWidth: number;
|
|
10
|
+
windowHeight: number;
|
|
11
|
+
contentSize?: {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
}): {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=contentSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentSize.d.ts","sourceRoot":"","sources":["../../../src/contentSize.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,WAAW,EACX,YAAY,EACZ,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAKpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-overlay",
|
|
3
|
-
"version": "6.7.0-alpha.
|
|
3
|
+
"version": "6.7.0-alpha.444",
|
|
4
4
|
"description": "Native and Web overlay hosts with ordered levels, page scope and Fabric measurement",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
package/src/OverlayView.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import NativeOverlay from './NativeOverlayNativeComponent';
|
|
14
14
|
import { OverlayLevelProvider } from './OverlayLevelContext';
|
|
15
15
|
import { isBlockingLevel } from './OverlayLevels';
|
|
16
|
+
import { resolveContentSize } from './contentSize';
|
|
16
17
|
import { resolveSheetWidth } from './sheetWidth';
|
|
17
18
|
import { useOverlayController } from './useOverlayController';
|
|
18
19
|
|
|
@@ -72,6 +73,7 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
72
73
|
testID,
|
|
73
74
|
windowOffsetRequest,
|
|
74
75
|
onWindowOffset,
|
|
76
|
+
contentSize,
|
|
75
77
|
} = props;
|
|
76
78
|
// A plain sibling at the host's spot: its JS-measured origin shares the
|
|
77
79
|
// modal-relative space of the caller's measurements, while native reports
|
|
@@ -284,7 +286,14 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
284
286
|
<View
|
|
285
287
|
collapsable={false}
|
|
286
288
|
pointerEvents="box-none"
|
|
287
|
-
style={{
|
|
289
|
+
style={{
|
|
290
|
+
...resolveContentSize({
|
|
291
|
+
windowWidth: width,
|
|
292
|
+
windowHeight: height,
|
|
293
|
+
contentSize,
|
|
294
|
+
}),
|
|
295
|
+
flexShrink: 0,
|
|
296
|
+
}}
|
|
288
297
|
>
|
|
289
298
|
<OverlayLevelProvider value={level}>
|
|
290
299
|
{children}
|
package/src/OverlayViewTypes.ts
CHANGED
|
@@ -88,6 +88,14 @@ export interface IOverlayViewProps {
|
|
|
88
88
|
*/
|
|
89
89
|
windowOffsetRequest?: number;
|
|
90
90
|
onWindowOffset?: (offset: { x: number; y: number }) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Native only, non-sheet presentations. Lays the content out at this size
|
|
93
|
+
* instead of the window size JS last saw. The content host clips the
|
|
94
|
+
* content to that frame, and JS hears about a rotation only after the
|
|
95
|
+
* window has rotated: content prepared for the window it is about to rotate
|
|
96
|
+
* into passes the rotated size, so the first rotated frame shows all of it.
|
|
97
|
+
*/
|
|
98
|
+
contentSize?: { width: number; height: number };
|
|
91
99
|
/** The exit animation finished and the content unmounted. */
|
|
92
100
|
onClose?: (reason: IOverlayDismissReason) => void;
|
|
93
101
|
children?: ReactNode;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Non-sheet content geometry. JS lays the content out at the window size it
|
|
3
|
+
* last saw, and the native content host clips the content to that frame. Right
|
|
4
|
+
* after the window rotates, JS still holds the previous size, so a caller that
|
|
5
|
+
* prepared its content for the window it is about to rotate into passes that
|
|
6
|
+
* size instead.
|
|
7
|
+
*/
|
|
8
|
+
export function resolveContentSize({
|
|
9
|
+
windowWidth,
|
|
10
|
+
windowHeight,
|
|
11
|
+
contentSize,
|
|
12
|
+
}: {
|
|
13
|
+
windowWidth: number;
|
|
14
|
+
windowHeight: number;
|
|
15
|
+
contentSize?: { width: number; height: number };
|
|
16
|
+
}): { width: number; height: number } {
|
|
17
|
+
return {
|
|
18
|
+
width: contentSize?.width ?? windowWidth,
|
|
19
|
+
height: contentSize?.height ?? windowHeight,
|
|
20
|
+
};
|
|
21
|
+
}
|