You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-1Lines changed: 43 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,10 +84,52 @@ Each instance independently manages its own drag configuration and WebContents a
84
84
|`exclude`|`string`| Disabled | CSS selector for elements that should **NOT** trigger drag. **Exclusive** with `selector`. |
85
85
|`maximize`|`boolean`| Disabled | Enable double-click to maximize/unmaximize. |
86
86
|`fps`|`number`| Screen refresh rate | Frames per second for drag position updates. |
87
-
|`attachOnInit`|`boolean`|`true`| If true, auto-attach the `BrowserWindow.webContents` on initialization. |
87
+
|`attachOnInit`|`boolean`|Enabled| If true, auto-attach the `BrowserWindow.webContents` on initialization. |
88
88
89
89
> **Note:**`selector` and `exclude` are mutually exclusive. Use `selector` to whitelist draggable areas, or `exclude` to blacklist non-draggable elements within the drag region.
90
90
91
+
#### Region
92
+
93
+
The `region` option defines draggable bounds using up to 4 independent thresholds. Only specified attributes are checked — omitted ones impose no constraint:
94
+
95
+
| Attribute | Constraint | Default |
96
+
|-----------|-----------|---------|
97
+
|`x`| Drag only when cursor is **at or after**`x` px from the left |`0` (no left bound) |
98
+
|`y`| Drag only when cursor is **at or after**`y` px from the top |`0` (no top bound) |
99
+
|`width`| Drag only within `width` px **after**`x`|`∞` (no right bound) |
100
+
|`height`| Drag only within `height` px **after**`y`|`∞` (no bottom bound) |
101
+
102
+
```
103
+
x x + width
104
+
┬ ┬
105
+
┌──────┼────────┼──────┐
106
+
│ 0,0 │ │ │
107
+
│ │ │ │
108
+
│ ░░░░░░░░░░──────┼─┤ y
109
+
│ ░░ DRAG ░░ │
110
+
│ ░░ ZONE ░░ │
111
+
│ ░░░░░░░░░░──────┼─┤ y + height
112
+
│ │
113
+
│ │
114
+
└──────────────────────┘
115
+
```
116
+
117
+
**Examples:**
118
+
119
+
```js
120
+
// Title bar: top 40px
121
+
{ height:40 }
122
+
123
+
// Sidebar handle: left 8px
124
+
{ width:8 }
125
+
126
+
// Custom band: between 50px and 100px from top
127
+
{ y:50, height:100 }
128
+
129
+
// Scoped box: specific region
130
+
{ x:100, y:50, width:300, height:150 }
131
+
```
132
+
91
133
### Attaching and Detaching WebContents
92
134
93
135
For `BaseWindow` setups with multiple `WebContentsView` children, you can manually attach and detach drag sources:
0 commit comments