1.2.6 • Published 4 years ago

electron-drag-ex v1.2.6

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

vue-cli@3 and electron-plugin-electron support..

maybe can use to the react framework?...

the win-mouse or osx-mouse possiable input issue of Node Version is difference,use 'electron-rebuild' rebuild win-mouse or osx-mouse lib

electron-drag

Improved window dragging for Electron applications.

Frameless windows can be dragged using the -webkit-app-region css property, but this disables all regular dom events and user interactions with the affected element, which makes it hard to emulate a native-like title bar in the application, as it's not possible to capture double clicks for maximizing the window.

A workaround is to use a pure javascript solution, but dragging only works well when moving the mouse in less than normal speed, else the mouse pointer will move outside the window area and no events will be received by the dom.

This module uses osx-mouse or win-mouse modules for tracking the mouse position on the entire screen, and thereby enabling consistent window dragging, while the affected element is still able to receive dom events.

Usage

npm install electron-drag

Require the module in an Electron web page.

var drag = require('electron-drag');

// Pass a query selector or a dom element to the function.
// Dragging the element will drag the whole window.
var clear = drag('#element');

// Call the returned function to make the element undraggable again.
clear();

The module only works on OS X and Windows, but doesn't fail when installed on a non-supported platform.

// Fallback to using -webkit-app-region property.
if(!drag.supported) {
	document.querySelector('#element').style['-webkit-app-region'] = 'drag';
}

The module needs to be built with the correct Electron headers. See the guide for using native Node modules with Electron for more information.

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2-beta.12

4 years ago

1.2.2-beta.11

4 years ago

1.2.2-beta.9

4 years ago

1.2.2-beta.10

4 years ago

1.2.2-beta.8

4 years ago

1.2.2-beta.7

4 years ago

1.2.2-beta.6

4 years ago

1.2.2-beta.5

4 years ago

1.2.2-beta.4

4 years ago

1.2.2-beta.3

4 years ago

1.2.2-beta.2

4 years ago

1.2.2-beta.1

4 years ago

1.2.2-beta

4 years ago