Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么在config.default.js里面获取screen来按比例设置宽高 #88

Open
aaro0608 opened this issue Jan 18, 2024 · 1 comment
Open

Comments

@aaro0608
Copy link

const { width, height } = screen.getPrimaryDisplay().workAreaSize;
const barHeight = screen.getPrimaryDisplay().workArea.y;
const newWidth = Math.round(width * (4 / 5));
const newHeight = Math.round(newWidth * (9 / 16)) + barHeight;
const x = Math.round((width - newWidth) / 2);
const y = Math.round((height - newHeight) / 2);

@wallace5303
Copy link
Collaborator

可以在生命周期,或者预加载模块处理。

配置里面隐藏主窗口。在electron/index.js 或 preload/index.js里面拿到主窗口对象,调整尺寸,然后显示窗口

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants