当前位置:网站首页>Implementation of "quick start electronic" window dragging
Implementation of "quick start electronic" window dragging
2022-07-03 10:11:00 【InfoQ】
After reading this article, you can learn
- Have a basic understanding of process communication
- Learn how to implement the drag and drop function in the customized top bar
Antecedents feed
Drag and drop
...
frame:false,
...
index.html<div class="header"></div>
mousedownmouseupmousemovelet isDown = false; // Mouse status
let baseX = 0,baseY = 0; // Monitor coordinates
mousedownheader.addEventListener('mousedown',function(e){
isDown = true
baseX = e.x
baseY = e.y
})


(screenX - baseX) , (screenY - baseY) document.addEventListener('mousemove',function(e){
if(isDown){
const x = e.screenX - baseX
const y = e.screenY - baseY
ipcRenderer.send('move-application',{
posX:x,
posY:y
})
}
})
x,ysetPositionipcMain.on('move-application',(event,pos) => {
mainWin && mainWin.setPosition(pos.posX,pos.posY)
})

isDowndocument.addEventListener('mouseup',function(){
isDown = false
})
Electron Series
- Hand in hand to get you started Electron)
- bag yyds:from Electron Starting from the framework , Go deep into Electron Cross end principle | Many pictures explain
- Small f The plug-in with the pig skin :vue + electron Develop a real-time monitor github Cross end desktop applications for
Last
Ned Front end growth diary 边栏推荐
- Opencv interview guide
- Crash工具基本使用及实战分享
- Simulate mouse click
- QT self drawing button with bubbles
- [combinatorics] Introduction to Combinatorics (combinatorial idea 3: upper and lower bound approximation | upper and lower bound approximation example Remsey number)
- CV learning notes - edge extraction
- Drive and control program of Dianchuan charging board for charging pile design
- Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction
- MySQL root user needs sudo login
- 2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)
猜你喜欢

El table X-axis direction (horizontal) scroll bar slides to the right by default

3.2 Off-Policy Monte Carlo Methods & case study: Blackjack of off-Policy Evaluation

Retinaface: single stage dense face localization in the wild

Basic use and actual combat sharing of crash tool

Leetcode-112:路径总和

CV learning notes convolutional neural network

pycharm 无法引入自定义包

Leetcode-106:根据中后序遍历序列构造二叉树

2. Elment UI date selector formatting problem

LeetCode - 460 LFU 缓存(设计 - 哈希表+双向链表 哈希表+平衡二叉树(TreeSet))*
随机推荐
03 fastjason solves circular references
LeetCode - 1670 设计前中后队列(设计 - 两个双端队列)
Circular queue related design and implementation reference 1
CV learning notes ransca & image similarity comparison hash
使用密钥对的形式连接阿里云服务器
『快速入门electron』之实现窗口拖拽
(1) What is a lambda expression
Liquid crystal display
Installation and removal of MySQL under Windows
openEuler kernel 技术分享 - 第1期 - kdump 基本原理、使用及案例介绍
Leetcode-112:路径总和
20220606数学:分数到小数
20220609其他:多数元素
Leetcode - 460 LFU cache (Design - hash table + bidirectional linked hash table + balanced binary tree (TreeSet))*
Connect Alibaba cloud servers in the form of key pairs
QT setting suspension button
20220605数学:两数相除
Leetcode - 895 maximum frequency stack (Design - hash table + priority queue hash table + stack)*
1. Finite Markov Decision Process
Design of charging pile mqtt transplantation based on 4G EC20 module