Closed OctupleSakura closed 5 years ago
引用了一位老哥的一个方案 ,暂时解决问题了
ipcMain.on('windowMoving', (e, {mouseX, mouseY}) => { const { x, y } = electron.screen.getCursorScreenPoint() this.win.setPosition(x - mouseX, y - mouseY) }); ipcMain.on('windowMoved', () => { // Do somehting when dragging stop );
let animationId; let mouseX; let mouseY; function onMouseDown(e) { mouseX = e.clientX; mouseY = e.clientY; document.addEventListener('mouseup', onMouseUp) requestAnimationFrame(this.moveWindow); } function onMouseUp(e) { window.ipcRenderer.send('windowMoved'); document.removeEventListener('mouseup', onMouseUp) cancelAnimationFrame(animationId) } function moveWindow() { window.ipcHandler.send('windowMoving', { mouseX, mouseY }); animationId = requestAnimationFrame(moveWindow); }
electron/electron#1354
react-dnd ?
引用了一位老哥的一个方案 ,暂时解决问题了
electron/electron#1354