[v2] Add flag to disable scrollbar drag

This commit is contained in:
Lea Anthony
2021-10-12 20:45:53 +11:00
parent 6413a6fb4d
commit 26d248a4b6
3 changed files with 29 additions and 10 deletions
+11 -1
View File
@@ -39,7 +39,10 @@ window.wails = {
EventsNotify,
SetBindings,
eventListeners,
callbacks
callbacks,
flags: {
disableScrollbarDrag: false,
}
};
// Set the bindings
@@ -61,7 +64,14 @@ window.addEventListener('mousedown', (e) => {
if (currentElement.hasAttribute('data-wails-no-drag')) {
break;
} else if (currentElement.hasAttribute('data-wails-drag')) {
if (window.wails.flags.disableScrollbarDrag) {
// This checks for clicks on the scroll bar
if (e.offsetX > e.target.clientWidth || e.offsetY > e.target.clientHeight) {
break;
}
}
window.WailsInvoke("drag");
e.preventDefault();
break;
}
currentElement = currentElement.parentElement;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long