feat(electron): recording popup ux (#11403)

fix AF-2444, AF-2443
This commit is contained in:
pengx17
2025-04-02 14:17:52 +00:00
parent 2adb8e1404
commit 90c3c4bf7f
4 changed files with 15 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ export const root = style({
display: 'flex', display: 'flex',
gap: 4, gap: 4,
alignItems: 'center', alignItems: 'center',
['WebkitAppRegion' as string]: 'drag',
}); });
export const affineIcon = style({ export const affineIcon = style({

View File

@@ -70,13 +70,11 @@ abstract class PopupWindow {
async build(): Promise<BrowserWindow> { async build(): Promise<BrowserWindow> {
const browserWindow = new BrowserWindow({ const browserWindow = new BrowserWindow({
...this.windowOptions,
resizable: false, resizable: false,
minimizable: false, minimizable: false,
maximizable: false, maximizable: false,
closable: false, closable: false,
alwaysOnTop: true, alwaysOnTop: true,
focusable: false,
hiddenInMissionControl: true, hiddenInMissionControl: true,
movable: false, movable: false,
titleBarStyle: 'hidden', titleBarStyle: 'hidden',
@@ -84,6 +82,7 @@ abstract class PopupWindow {
backgroundColor: 'transparent', backgroundColor: 'transparent',
visualEffectState: 'active', visualEffectState: 'active',
vibrancy: 'under-window', vibrancy: 'under-window',
...this.windowOptions,
webPreferences: { webPreferences: {
...this.windowOptions.webPreferences, ...this.windowOptions.webPreferences,
webgl: true, webgl: true,
@@ -99,6 +98,9 @@ abstract class PopupWindow {
// required to make the window transparent // required to make the window transparent
browserWindow.setBackgroundColor('#00000000'); browserWindow.setBackgroundColor('#00000000');
browserWindow.setVisibleOnAllWorkspaces(true, {
visibleOnFullScreen: true,
});
browserWindow.loadURL(popupViewUrl).catch(err => logger.error(err)); browserWindow.loadURL(popupViewUrl).catch(err => logger.error(err));
browserWindow.on('ready-to-show', () => { browserWindow.on('ready-to-show', () => {
@@ -199,6 +201,7 @@ class RecordingPopupWindow extends PopupWindow {
windowOptions: Partial<BrowserWindowConstructorOptions> = { windowOptions: Partial<BrowserWindowConstructorOptions> = {
width: RECORDING_SIZE[0], width: RECORDING_SIZE[0],
height: RECORDING_SIZE[1], height: RECORDING_SIZE[1],
movable: true,
}; };
} }

View File

@@ -756,7 +756,7 @@ export class WebContentViewsManager {
}, 100); }, 100);
}; };
app.on('browser-window-focus', () => { this.mainWindow?.on('focus', () => {
focusActiveView(); focusActiveView();
}); });

View File

@@ -25,6 +25,14 @@ const PlayAndPauseIcon = ({
const lottieRef: LottieRef = useRef(null); const lottieRef: LottieRef = useRef(null);
const prevStateRef = useRef(state); const prevStateRef = useRef(state);
useEffect(() => {
if (!lottieRef.current) return;
const lottie = lottieRef.current;
if (prevStateRef.current === 'pause') {
lottie.goToAndStop(100, true);
}
}, []);
useEffect(() => { useEffect(() => {
if (!lottieRef.current) return; if (!lottieRef.current) return;
const lottie = lottieRef.current; const lottie = lottieRef.current;