5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 17:39:58 +08:00

[windows] Allow single-clicks on wails-draggable items (#2482)

* [runtime] Make it possible to restore old drag behaviour on windows with window.wails.flags.deferDragToMouseMove

* [runtime] Use deferDragToMouseMove as new default

This enhanced version should work well in all cases for Windows:
- No lag/delayed start of dragging
- Double-Clicks and Single-Click events still work in JavaScript on elements

* [docs] Add changelog
This commit is contained in:
stffabi 2023-03-20 08:45:21 +01:00 committed by GitHub
parent 77f053068c
commit 47af68a8cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 12 deletions

View File

@ -66,7 +66,7 @@ window.wails = {
defaultCursor: null,
borderThickness: 6,
shouldDrag: false,
deferDragToMouseMove: false,
deferDragToMouseMove: true,
cssDragProperty: "--wails-draggable",
cssDragValue: "drag",
}
@ -152,10 +152,9 @@ function setResize(cursor) {
window.addEventListener('mousemove', function (e) {
if (window.wails.flags.shouldDrag) {
let mousePressed = e.buttons !== undefined ? e.buttons : e.which;
if(mousePressed <= 0) {
window.wails.flags.shouldDrag = false;
} else {
let mousePressed = e.buttons !== undefined ? e.buttons : e.which;
if (mousePressed > 0) {
window.WailsInvoke("drag");
return;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Support single clicks on items with `--wails-draggable: drag` again on Windows. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2482)
### Fixed
- Fixed panic when using `wails dev` and the AssetServer tried to log to the logger. Fixed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2481)
- Fixed compatibility with WebView2 Runtime > `110.0.1587.69` which showed a `connection refused` html page before doing a reload of the frontend. Fixed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2496)