Skip to content

Commit

Permalink
📝 Document the new argument in window.setDraggableRegion (#342)
Browse files Browse the repository at this point in the history
* 📝 Document the new argument in window.setDraggableRegion.

A follow-up to neutralinojs/neutralino.js#120

* 📝 Add an example to window.setDraggableRegion that uses options
  • Loading branch information
CosmoMyzrailGorynych authored Sep 24, 2024
1 parent 24139ae commit f6b8e73
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/api/window.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,26 @@ const icon = '/resources/icons/appIcon.png';
await Neutralino.window.setIcon(icon);
```

## window.setDraggableRegion(domId)
## window.setDraggableRegion(domId, options)
Converts a given DOM element to a draggable region. The user will be able to drag the native window by dragging the given DOM element. This feature is suitable to make custom window bars along with the [borderless mode](../configuration/neutralino.config.json#modeswindowborderless-boolean).

### Parameters

- `domId` String | HTMLElement: A DOM element identifier.
- `options` DraggableRegionOptions (optional): Customize the behavior of the draggable region.

### DraggableRegionOptions

- `alwaysCapture` Boolean (optional): If set to `true`, the region will always capture the pointer, ensuring that dragging is not interrupted when moving the pointer quickly. Note that it prevents child elements from receiving any pointer events. Defaults to `false`.
- `dragMinDistance` Number (optional): The minimum distance between cursor's starting and current position after which dragging is started. This helps prevent accidental dragging while interacting with child elements. Defaults to `10` and is measured in CSS pixels.

```js
await Neutralino.window.setDraggableRegion('myCustomTitleBar');

await Neutralino.window.setDraggableRegion('myCustomTitleBar', {
alwaysCapture: true,
dragMinDistance: 15
});
```

## window.unsetDraggableRegion(domId)
Expand Down

0 comments on commit f6b8e73

Please sign in to comment.