当前位置:网站首页>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 边栏推荐
- 4G module at command communication package interface designed by charging pile
- Leetcode - 933 number of recent requests
- Dynamic layout management
- Modelcheckpoint auto save model
- LeetCode 面试题 17.20. 连续中值(大顶堆+小顶堆)
- 1. Finite Markov Decision Process
- After clicking the Save button, you can only click it once
- openCV+dlib實現給蒙娜麗莎換臉
- openCV+dlib实现给蒙娜丽莎换脸
- Toolbutton property settings
猜你喜欢

Yocto Technology Sharing Phase 4: Custom add package support

2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)

4.1 Temporal Differential of one step

使用密钥对的形式连接阿里云服务器

CV learning notes - Stereo Vision (point cloud model, spin image, 3D reconstruction)

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

Opencv image rotation

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

Connect Alibaba cloud servers in the form of key pairs

It is difficult to quantify the extent to which a single-chip computer can find a job
随机推荐
20220610其他:任务调度器
LeetCode - 715. Range 模块(TreeSet) *****
LeetCode - 508. 出现次数最多的子树元素和 (二叉树的遍历)
CV learning notes - deep learning
2.1 Dynamic programming and case study: Jack‘s car rental
Leetcode 300 longest ascending subsequence
Octave instructions
. DLL and Differences between lib files
20220608其他:逆波兰表达式求值
Drive and control program of Dianchuan charging board for charging pile design
Screen display of charging pile design -- led driver ta6932
RESNET code details
It is difficult to quantify the extent to which a single-chip computer can find a job
openEuler kernel 技術分享 - 第1期 - kdump 基本原理、使用及案例介紹
QT detection card reader analog keyboard input
Circular queue related design and implementation reference 1
4G module board level control interface designed by charging pile
yocto 技術分享第四期:自定義增加軟件包支持
Application of external interrupts
Leetcode bit operation