Resolves #74
This commit is contained in:
parent
24b1301f9f
commit
f5392aea9f
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.7.11",
|
"version": "1.7.12",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
body.meter {
|
body.meter {
|
||||||
background: rgb(117, 117, 117);
|
background: rgb(117, 117, 117);
|
||||||
}
|
}
|
||||||
|
body.meter #img,
|
||||||
|
body.meter #can {
|
||||||
|
display : none;
|
||||||
|
}
|
||||||
#img {
|
#img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
/*background-image: url(".../img/background.jpg");*/
|
/*background-image: url(".../img/background.jpg");*/
|
||||||
|
@ -46,16 +50,15 @@
|
||||||
</canvas>
|
</canvas>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
const { remote, ipcRenderer } = require('electron')
|
const { ipcRenderer } = require('electron')
|
||||||
|
const remote = require('@electron/remote')
|
||||||
let imgTmp;
|
let imgTmp;
|
||||||
async function setImage (src) {
|
async function setImage (src) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
imgTmp = new Image()
|
imgTmp = new Image()
|
||||||
let img = document.getElementById('img')
|
let img = document.getElementById('img')
|
||||||
let body = document.querySelector('body')
|
let body = document.querySelector('body')
|
||||||
if (body.classList.contains('meter')) {
|
body.className = ''
|
||||||
body.classList.remove('meter')
|
|
||||||
}
|
|
||||||
imgTmp.onload = function () {
|
imgTmp.onload = function () {
|
||||||
img.style.backgroundImage = `url('${src}')`;
|
img.style.backgroundImage = `url('${src}')`;
|
||||||
return resolve(src);
|
return resolve(src);
|
||||||
|
@ -66,15 +69,16 @@
|
||||||
async function onMeter () {
|
async function onMeter () {
|
||||||
console.log('meter')
|
console.log('meter')
|
||||||
const body = document.querySelector('body')
|
const body = document.querySelector('body')
|
||||||
if (!body.classList.contains('meter')) {
|
body.className = ''
|
||||||
body.classList.add('meter')
|
body.classList.add('meter')
|
||||||
}
|
}
|
||||||
}
|
|
||||||
async function onFocus () {
|
async function onFocus () {
|
||||||
console.log('focus')
|
console.log('focus')
|
||||||
const can = document.getElementById('can')
|
const can = document.getElementById('can')
|
||||||
const dpr = window.devicePixelRatio || 1
|
const dpr = window.devicePixelRatio || 1
|
||||||
|
const body = document.querySelector('body')
|
||||||
let ctx;
|
let ctx;
|
||||||
|
body.className = ''
|
||||||
if (!can.classList.contains('show')) {
|
if (!can.classList.contains('show')) {
|
||||||
can.classList.add('show')
|
can.classList.add('show')
|
||||||
}
|
}
|
||||||
|
@ -122,7 +126,9 @@
|
||||||
const can = document.getElementById('can')
|
const can = document.getElementById('can')
|
||||||
const dpr = window.devicePixelRatio || 1
|
const dpr = window.devicePixelRatio || 1
|
||||||
const screen = window.outerWidth / window.outerHeight
|
const screen = window.outerWidth / window.outerHeight
|
||||||
|
const body = document.querySelector('body')
|
||||||
let ctx;
|
let ctx;
|
||||||
|
body.className = ''
|
||||||
if (!can.classList.contains('show')) {
|
if (!can.classList.contains('show')) {
|
||||||
can.classList.add('show')
|
can.classList.add('show')
|
||||||
}
|
}
|
||||||
|
@ -217,9 +223,11 @@
|
||||||
}
|
}
|
||||||
return event.returnValue = true
|
return event.returnValue = true
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onEscape (evt) {
|
async function onEscape (evt) {
|
||||||
let isEscape = false
|
let isEscape = false
|
||||||
let win
|
let win
|
||||||
|
|
||||||
evt = evt || window.event
|
evt = evt || window.event
|
||||||
|
|
||||||
if ('key' in evt) {
|
if ('key' in evt) {
|
||||||
|
@ -227,6 +235,7 @@
|
||||||
} else {
|
} else {
|
||||||
isEscape = (evt.keyCode == 27)
|
isEscape = (evt.keyCode == 27)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEscape) {
|
if (isEscape) {
|
||||||
win = remote.getCurrentWindow()
|
win = remote.getCurrentWindow()
|
||||||
win.close()
|
win.close()
|
||||||
|
|
|
@ -36,6 +36,7 @@ class WebView {
|
||||||
prefs.y = display.y + 50;
|
prefs.y = display.y + 50;
|
||||||
}
|
}
|
||||||
this.digitalWindow = new BrowserWindow(prefs);
|
this.digitalWindow = new BrowserWindow(prefs);
|
||||||
|
require('@electron/remote/main').enable(this.digitalWindow.webContents);
|
||||||
this.digitalWindow.loadURL(pageUrl);
|
this.digitalWindow.loadURL(pageUrl);
|
||||||
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
|
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
|
||||||
this.digitalWindow.webContents.openDevTools();
|
this.digitalWindow.webContents.openDevTools();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.7.11",
|
"version": "1.7.12",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.7.11",
|
"version": "1.7.12",
|
||||||
"description": "GUI for the mcopy small gauge film optical printer platform",
|
"description": "GUI for the mcopy small gauge film optical printer platform",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.7.11",
|
"version": "1.7.12",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.7.11",
|
"version": "1.7.12",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.7.11",
|
"version": "1.7.12",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"arduino": "file:app/lib/arduino",
|
"arduino": "file:app/lib/arduino",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.7.11",
|
"version": "1.7.12",
|
||||||
"description": "Small gauge film optical printer platform",
|
"description": "Small gauge film optical printer platform",
|
||||||
"main": "build.js",
|
"main": "build.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.7.11",
|
"version": "1.7.12",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -44,6 +44,7 @@ class WebView {
|
||||||
prefs.y = display.y + 50;
|
prefs.y = display.y + 50;
|
||||||
}
|
}
|
||||||
this.digitalWindow = new BrowserWindow(prefs);
|
this.digitalWindow = new BrowserWindow(prefs);
|
||||||
|
require('@electron/remote/main').enable(this.digitalWindow.webContents)
|
||||||
this.digitalWindow.loadURL(pageUrl);
|
this.digitalWindow.loadURL(pageUrl);
|
||||||
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
|
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
|
||||||
this.digitalWindow.webContents.openDevTools();
|
this.digitalWindow.webContents.openDevTools();
|
||||||
|
|
Loading…
Reference in New Issue