小编Pts*_*luS的帖子

Electron 中的内容周围有黑色边框

我使用 Electron 将使用 Phaser 2 制作的视频游戏转换为 .exe。但在我的内容周围,我有一些边框或边距。

我尝试使用全屏来改变这一点,我也尝试使用 useContentSize 但问题没有解决。

这是我的 JS 文件:

const { app, BrowserWindow } = require('electron')

let win;

function createWindow () {
  // Cree la fenetre du navigateur.
 win = new BrowserWindow({
    //width: 886,
    //height: 473,
    useContentSize : true,
    autoHideMenuBar : true,
    icon: "favicon.ico",
    //met la fenetre sans bordure 
    //frame : false,
    //fullscreen : true,
  })

  //load the index.html.
  win.loadFile('src/junkbuster.html');
  win.setMenuBarVisibility(false);
  win.setMenu(null);
  //win.setContentSize(1700,1200);
}

app.on('ready', function(){
  createWindow();

  console.log(win.getContentBounds());

  //800,600 => 786, 563
  console.log(win.getSize()+"=>"+win.getContentSize());

});
Run Code Online (Sandbox Code Playgroud)

这是我的 HTML …

javascript node.js npm electron

2
推荐指数
1
解决办法
1546
查看次数

标签 统计

electron ×1

javascript ×1

node.js ×1

npm ×1