1.4.0 Alpha
This commit is contained in:
73
src/controller/player_onTop.js
Normal file
73
src/controller/player_onTop.js
Normal file
@@ -0,0 +1,73 @@
|
||||
const {
|
||||
app,
|
||||
BrowserWindow,
|
||||
Menu,
|
||||
dialog,
|
||||
ipcMain
|
||||
} = require('electron');
|
||||
|
||||
//alwaysOnTop
|
||||
|
||||
var win = null;
|
||||
|
||||
var pot = {};
|
||||
var s = null;
|
||||
|
||||
ipcMain
|
||||
.on('close_pot',(event,arg)=>{
|
||||
console.log('CLOSE')
|
||||
pot.close(event);
|
||||
})
|
||||
|
||||
pot.isOpen = false;
|
||||
|
||||
pot.open = (e) => {
|
||||
s = e;
|
||||
if (win !== null) {
|
||||
e.sender.send('play-in-Window',{do :false});
|
||||
win.close();
|
||||
}
|
||||
var x = new playerOnTop(e);
|
||||
console.log('XX');
|
||||
}
|
||||
pot.close = ()=>{
|
||||
console.log('CLOSE')
|
||||
s.sender.send('play-in-Window',{do :false});
|
||||
win.close();
|
||||
}
|
||||
|
||||
|
||||
class playerOnTop {
|
||||
constructor(e) {
|
||||
pot.isOpen = true;
|
||||
this.win = new BrowserWindow({
|
||||
width: 320,
|
||||
height: 500,
|
||||
show: false,
|
||||
frame: false,
|
||||
alwaysOnTop: true,
|
||||
icon: global.dir + '/app.ico'
|
||||
})
|
||||
e.sender.send('play-in-Window',{do :true});
|
||||
win = this.win;
|
||||
win.loadURL(`file://${global.dir}/app/view/pot.html`)
|
||||
win.once('ready-to-show', () => {
|
||||
win.show();
|
||||
console.log('XX');
|
||||
})
|
||||
win.on('resize', function () {
|
||||
setTimeout(function () {
|
||||
var size = win.getSize();
|
||||
win.setSize(size[0], parseInt(size[0] * 9 / 16));
|
||||
}, 0);
|
||||
});
|
||||
win.on('closed', () => {
|
||||
pot.isOpen = false;
|
||||
e.sender.send('play-in-Window',{do :false});
|
||||
win = null;
|
||||
console.log('XX');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = pot;
|
||||
Reference in New Issue
Block a user