JS
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 450, height: 600,
'title' : 'Quantum Pilot', 'transparent' : true,
'web-preferences' : {'allow-displaying-insecure-content' : true}});
HTML
<html>
<body bgcolor="black">
<center>
<div id="game_container">
</div>
</center>
</body>
前端JS
generateCanvas() {
var canvas = document.createElement("canvas");
Thing.prototype.scale = 1;
canvas.width = 450 * Thing.prototype.scale;
canvas.height = 600;
当我运行我的应用程序时,除非在html的body中使用
style="overflow: hidden"
,否则会出现滚动条。我可以通过将50px添加到Electron窗口来去除滚动条。但是我对为什么会发生这种情况感到困惑。
如何使窗口和画布大小相同?