JSPM

electron-drag-click

1.0.6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 109
  • Score
    100M100P100Q72890F
  • License MIT

A native module that propagates click events to draggable areas in Electron on macOS.

Package Exports

  • electron-drag-click
  • electron-drag-click/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (electron-drag-click) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

electron-drag-click

Description

$ npm i electron-drag-click

This Native Node Module allows you to change the behavior of how frameless Electron browser windows handle pointer events on macOS. Chromium's built-in mechanism ignores pointer events in draggable regions in frameless windows. This module changes the built-in hit testing so in frameless windows pointer events are propagated even in draggable regions.

It is based on my earlier PR in the Electron repository (https://github.com/electron/electron/pull/38208), which after some discussion with maintainers was decided not to be merged in, and rather be handled in a separate Native Module.

The code is using ObjectiveC's runtime method swizzling capability, which allows you to alter the implementation of an existing selector. Shoutout to @tzahola, who helped me dealing with these APIs.

Usage

const { app, BrowserWindow } = require('electron');
const electronDragClick = require('electron-drag-click');

electronDragClick();

app.on('ready', () => {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    frame: false,
  });

  win.loadFile('./index.html');
});