当前位置:网站首页>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 边栏推荐
- Timer and counter of 51 single chip microcomputer
- 03 fastjason solves circular references
- 使用sed替换文件夹下文件
- Leetcode interview question 17.20 Continuous median (large top pile + small top pile)
- Basic use and actual combat sharing of crash tool
- CV learning notes - camera model (Euclidean transformation and affine transformation)
- CV learning notes alexnet
- RESNET code details
- LeetCode - 933 最近的请求次数
- Basic knowledge of communication interface
猜你喜欢

Opencv feature extraction sift

Anaconda安装包 报错packagesNotFoundError: The following packages are not available from current channels:

Yocto Technology Sharing Phase 4: Custom add package support

Opencv image rotation

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

LeetCode - 673. 最长递增子序列的个数

LeetCode - 508. Sum of subtree elements with the most occurrences (traversal of binary tree)

Serial communication based on 51 single chip microcomputer

Opencv histogram equalization

Leetcode bit operation
随机推荐
Serial port programming
The underlying principle of vector
When the reference is assigned to auto
[combinatorics] Introduction to Combinatorics (combinatorial idea 3: upper and lower bound approximation | upper and lower bound approximation example Remsey number)
使用密钥对的形式连接阿里云服务器
Problems encountered when MySQL saves CSV files
51 MCU tmod and timer configuration
QT is a method of batch modifying the style of a certain type of control after naming the control
Dictionary tree prefix tree trie
Leetcode 300 longest ascending subsequence
Leetcode bit operation
LeetCode - 900. RLE 迭代器
Opencv notes 17 template matching
Markdown latex full quantifier and existential quantifier (for all, existential)
4G module initialization of charge point design
Vgg16 migration learning source code
openEuler kernel 技術分享 - 第1期 - kdump 基本原理、使用及案例介紹
About windows and layout
CV learning notes - image filter
Screen display of charging pile design -- led driver ta6932