mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 02:31:58 +08:00
If the element adds the data-rails-drag attribute, it can trigger the dbclick event. (#1317)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
parent
0c244b1ce4
commit
65a97a668e
@ -60,6 +60,10 @@ if (ENV === 0) {
|
||||
delete window.wailsbindings;
|
||||
}
|
||||
|
||||
var dragTimeOut;
|
||||
var dragLastTime = 0;
|
||||
var dbClickInterval = 100;
|
||||
|
||||
// Setup drag handler
|
||||
// Based on code from: https://github.com/patr0nus/DeskGap
|
||||
window.addEventListener('mousedown', (e) => {
|
||||
@ -83,7 +87,14 @@ window.addEventListener('mousedown', (e) => {
|
||||
break;
|
||||
}
|
||||
}
|
||||
window.WailsInvoke("drag");
|
||||
if (new Date().getTime() - dragLastTime < dbClickInterval) {
|
||||
clearTimeout(dragTimeOut)
|
||||
break;
|
||||
}
|
||||
dragTimeOut = setTimeout(function () {
|
||||
window.WailsInvoke("drag");
|
||||
}, dbClickInterval)
|
||||
dragLastTime = new Date().getTime();
|
||||
e.preventDefault();
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user