solideo
solideo

Reputation: 127

electron frameless window auto maximize when drag to the top (windows 7)

a normal program, when mouse click and drag windows topbar to the top of screen, this program will auto fullscreen in windows 7+ system

but when I use electron without the frame, and use electron-drag package to control move it, then, what can I do, to let it auto fullscreen when drag to top, and drag left side cover left screen, drag right side...

thanks

Upvotes: 1

Views: 1700

Answers (1)

flapjack17
flapjack17

Reputation: 1834

electron-drag hasn't been updated for 2 years.

Why not just use electrons built in drag-able style <div style="-webkit-app-region: drag"> I Built a quick app, and added the style to a div, worked fine.

https://electronjs.org/docs/api/frameless-window#draggable-region

Note: -webkit-app-region: drag is known to have problems while the developer tools are open.
See this GitHub issue for more information including a workaround.

EDIT: create a quick gist showing how to mimic the snapping of a frameless window without using the draggable style. https://gist.github.com/flapjack17/44a9fdd504b832714c24f899a11c0b42

Upvotes: 1

Related Questions