kapetan/electron-drag
소개
Electron 애플리케이션의 창 드래그 기능
기타 프로젝트측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalelectron-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.
Build
The module needs to be built with the correct Electron headers. See the guide for using native Node modules with Electron for more information.
Versions of this library above version 2.0.0 require Electron which support Node.js version 9 and above.
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'
}
관련 프로젝트 살펴보기
불러오는 중…