84 lines
2.3 KiB
JavaScript
84 lines
2.3 KiB
JavaScript
|
let { remote } = require('electron')
|
||
|
let { ipcRenderer } = require('electron')
|
||
|
|
||
|
const path = require('path')
|
||
|
|
||
|
const webFrame = require('electron').webFrame
|
||
|
console.log('Disable pinch zoom', webFrame)
|
||
|
webFrame.setVisualZoomLevelLimits(1, 1)
|
||
|
|
||
|
window.nodePath = path
|
||
|
|
||
|
window.nodeDirname = __dirname
|
||
|
|
||
|
window.nodeRequire = require
|
||
|
delete window.require
|
||
|
delete window.exports
|
||
|
delete window.module
|
||
|
|
||
|
window.padLoadedHandler = []
|
||
|
|
||
|
let pointerCounter = 0
|
||
|
|
||
|
window.addEventListener('pointerdown', (e) => {
|
||
|
//e.preventDefault()
|
||
|
// console.log("ipcRenderer.sendToHost('webviewPointerDown')")
|
||
|
ipcRenderer.sendToHost('webviewPointerDown')
|
||
|
})
|
||
|
|
||
|
window.addEventListener('pointerup', (e) => {
|
||
|
// console.log("ipcRenderer.sendToHost('webviewPointerUp')")
|
||
|
ipcRenderer.sendToHost('webviewPointerUp')
|
||
|
})
|
||
|
|
||
|
window.addEventListener('pointerenter', (e) => {
|
||
|
// console.log("ipcRenderer.sendToHost('webviewPointerEnter')")
|
||
|
ipcRenderer.sendToHost('webviewPointerEnter')
|
||
|
})
|
||
|
|
||
|
window.addEventListener('pointercancel', (e) => {
|
||
|
// console.log("ipcRenderer.sendToHost('webviewPointerCancel')")
|
||
|
ipcRenderer.sendToHost('webviewPointerCancel')
|
||
|
})
|
||
|
|
||
|
window.addEventListener('pointerleave', (e) => {
|
||
|
// console.log("ipcRenderer.sendToHost('webviewPointerLeave')")
|
||
|
ipcRenderer.sendToHost('webviewPointerLeave')
|
||
|
})
|
||
|
|
||
|
window.addEventListener('pointerout', (e) => {
|
||
|
// console.log("ipcRenderer.sendToHost('webviewPointerOut')")
|
||
|
ipcRenderer.sendToHost('webviewPointerOut')
|
||
|
})
|
||
|
|
||
|
window.addEventListener('pointerover', (e) => {
|
||
|
// console.log("ipcRenderer.sendToHost('webviewPointerOver')")
|
||
|
ipcRenderer.sendToHost('webviewPointerOver')
|
||
|
})
|
||
|
|
||
|
window.addEventListener('pointermove', (e) => {
|
||
|
// console.log("ipcRenderer.sendToHost('webviewPointerMove')")
|
||
|
ipcRenderer.sendToHost('webviewPointerMove')
|
||
|
})
|
||
|
|
||
|
window.addEventListener('touchmove', (e) => {
|
||
|
// console.log("ipcRenderer.sendToHost('touchmove')")
|
||
|
ipcRenderer.sendToHost('touchMove')
|
||
|
})
|
||
|
|
||
|
window.addEventListener('touchstart', (e) => {
|
||
|
pointerCounter++
|
||
|
// console.log("ipcRenderer.sendToHost('touchstart')")
|
||
|
ipcRenderer.sendToHost('touchStart')
|
||
|
})
|
||
|
|
||
|
window.addEventListener('touchend', (e) => {
|
||
|
pointerCounter--
|
||
|
// console.log("ipcRenderer.sendToHost('touchend')")
|
||
|
ipcRenderer.sendToHost('touchEnd')
|
||
|
})
|
||
|
|
||
|
ipcRenderer.on('overlayEvent', function () {
|
||
|
console.log('hello world From Preload')
|
||
|
})
|