当前位置:网站首页>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>
mousedown
mouseup
mousemove
let isDown = false; // Mouse status
let baseX = 0,baseY = 0; // Monitor coordinates
mousedown
header.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,y
setPosition
ipcMain.on('move-application',(event,pos) => {
mainWin && mainWin.setPosition(pos.posX,pos.posY)
})

isDown
document.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
边栏推荐
- Sending and interrupt receiving of STM32 serial port
- Qcombox style settings
- 20220606数学:分数到小数
- LeetCode - 919. 完全二叉树插入器 (数组)
- (2) New methods in the interface
- Swing transformer details-2
- LeetCode - 703 数据流中的第 K 大元素(设计 - 优先队列)
- After clicking the Save button, you can only click it once
- QT detection card reader analog keyboard input
- Opencv feature extraction sift
猜你喜欢
LeetCode - 705 设计哈希集合(设计)
Discrete-event system
Mise en œuvre d'OpenCV + dlib pour changer le visage de Mona Lisa
LeetCode - 1670 設計前中後隊列(設計 - 兩個雙端隊列)
LeetCode - 706 设计哈希映射(设计) *
Opencv Harris corner detection
CV learning notes - BP neural network training example (including detailed calculation process and formula derivation)
LeetCode - 508. Sum of subtree elements with the most occurrences (traversal of binary tree)
Yocto Technology Sharing Phase 4: Custom add package support
Retinaface: single stage dense face localization in the wild
随机推荐
STM32 running lantern experiment - library function version
Octave instructions
openCV+dlib实现给蒙娜丽莎换脸
Development of intelligent charging pile (I): overview of the overall design of the system
3.1 Monte Carlo Methods & case study: Blackjack of on-Policy Evaluation
On the problem of reference assignment to reference
[combinatorics] Introduction to Combinatorics (combinatorial idea 3: upper and lower bound approximation | upper and lower bound approximation example Remsey number)
LeetCode - 715. Range 模块(TreeSet) *****
Leetcode - 1670 conception de la file d'attente avant, moyenne et arrière (conception - deux files d'attente à double extrémité)
The underlying principle of vector
CV learning notes - reasoning and training
CV learning notes - scale invariant feature transformation (SIFT)
3.2 Off-Policy Monte Carlo Methods & case study: Blackjack of off-Policy Evaluation
Leetcode 300 最长上升子序列
Leetcode 300 longest ascending subsequence
Opencv interview guide
Wireshark use
2. Elment UI date selector formatting problem
(1) What is a lambda expression
Basic use and actual combat sharing of crash tool