当前位置:网站首页>『快速入门electron』之实现窗口拖拽
『快速入门electron』之实现窗口拖拽
2022-07-03 09:20:00 【InfoQ】
看完本文你可学会
- 对于进程通信有基本的一个了解
- 学会自定义的顶部栏如何实现拖拽功能
前情提要
实现拖拽功能
...
frame:false,
...
index.html<div class="header"></div>
mousedownmouseupmousemovelet isDown = false; // 鼠标状态
let baseX = 0,baseY = 0; //监听坐标
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系列文
- 手把手带你快速入门Electron)
- 包包yyds:从 Electron 架构出发,深究 Electron 跨端原理 | 多图详解
- 小f的插件配上猪皮的文:vue + electron 开发一个实时监测github的跨端桌面应用
最后
Ned前端成长日记边栏推荐
- Installation and removal of MySQL under Windows
- LeetCode - 706 设计哈希映射(设计) *
- STM32 general timer output PWM control steering gear
- Yocto technology sharing phase IV: customize and add software package support
- 20220602数学:Excel表列序号
- CV learning notes - Stereo Vision (point cloud model, spin image, 3D reconstruction)
- Swing transformer details-2
- I think all friends should know that the basic law of learning is: from easy to difficult
- LeetCode - 673. 最长递增子序列的个数
- Leetcode bit operation
猜你喜欢

CV learning notes ransca & image similarity comparison hash

LeetCode - 706 设计哈希映射(设计) *

Leetcode-513:找树的左下角值

Yocto Technology Sharing Phase 4: Custom add package support

03 fastjason solves circular references

LeetCode - 933 最近的请求次数

Opencv histogram equalization

Adaptiveavgpool1d internal implementation

There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way

My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
随机推荐
20220610其他:任务调度器
Pymssql controls SQL for Chinese queries
20220603数学:Pow(x,n)
LeetCode - 715. Range 模块(TreeSet) *****
03 fastjason solves circular references
Leetcode - 460 LFU cache (Design - hash table + bidirectional linked hash table + balanced binary tree (TreeSet))*
Adaptiveavgpool1d internal implementation
Retinaface: single stage dense face localization in the wild
I think all friends should know that the basic law of learning is: from easy to difficult
Basic use and actual combat sharing of crash tool
yocto 技術分享第四期:自定義增加軟件包支持
Tensorflow2.0 save model
2.2 DP: Value Iteration & Gambler‘s Problem
Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
openEuler kernel 技術分享 - 第1期 - kdump 基本原理、使用及案例介紹
2.1 Dynamic programming and case study: Jack‘s car rental
Google browser plug-in recommendation
4G module board level control interface designed by charging pile
Leetcode - 1670 design front, middle and rear queues (Design - two double ended queues)
Do you understand automatic packing and unpacking? What is the principle?