Refer to the blog

Electron in the realization of the window drag several ways

1. Use -webkit-app-region: drag; 2. Monitor the mousedown, Mouseup, and Mousemove implementations of the mouse

Problems encountered

GetSize () and getPosition() are used to obtain the size and position of the window respectively. When the DPI of the screen is 150%, setPostion() is used to reset the window position, the size of the window will increase by 0-2px, resulting in inaccurate setting of the window position.

The solution

Call setSize() to reset the window size after each window position is reset