mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
WebUI: use passive event handlers
These kind of event handlers can be asynchronously dispatched, freeing up the main thread for lag-free operation.
This commit is contained in:
parent
29379232aa
commit
98623b2cf7
2 changed files with 4 additions and 4 deletions
|
@ -156,7 +156,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
this.hide();
|
this.hide();
|
||||||
this.touchStartAt = performance.now();
|
this.touchStartAt = performance.now();
|
||||||
this.touchStartEvent = e;
|
this.touchStartEvent = e;
|
||||||
});
|
}, { passive: true });
|
||||||
elem.addEventListener("touchend", (e) => {
|
elem.addEventListener("touchend", (e) => {
|
||||||
const now = performance.now();
|
const now = performance.now();
|
||||||
const touchStartAt = this.touchStartAt;
|
const touchStartAt = this.touchStartAt;
|
||||||
|
@ -168,7 +168,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
const isTargetUnchanged = (Math.abs(e.event.pageX - touchStartEvent.event.pageX) <= 10) && (Math.abs(e.event.pageY - touchStartEvent.event.pageY) <= 10);
|
const isTargetUnchanged = (Math.abs(e.event.pageX - touchStartEvent.event.pageX) <= 10) && (Math.abs(e.event.pageY - touchStartEvent.event.pageY) <= 10);
|
||||||
if (((now - touchStartAt) >= this.options.touchTimer) && isTargetUnchanged)
|
if (((now - touchStartAt) >= this.options.touchTimer) && isTargetUnchanged)
|
||||||
this.triggerMenu(touchStartEvent, elem);
|
this.triggerMenu(touchStartEvent, elem);
|
||||||
});
|
}, { passive: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
addTarget: function(t) {
|
addTarget: function(t) {
|
||||||
|
|
|
@ -274,7 +274,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
const th = ths[i];
|
const th = ths[i];
|
||||||
th.addEventListener("mousemove", mouseMoveFn);
|
th.addEventListener("mousemove", mouseMoveFn);
|
||||||
th.addEventListener("mouseout", mouseOutFn);
|
th.addEventListener("mouseout", mouseOutFn);
|
||||||
th.addEventListener("touchend", onTouch);
|
th.addEventListener("touchend", onTouch, { passive: true });
|
||||||
th.makeResizable({
|
th.makeResizable({
|
||||||
modifiers: {
|
modifiers: {
|
||||||
x: "",
|
x: "",
|
||||||
|
@ -762,7 +762,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
this._this.deselectAll();
|
this._this.deselectAll();
|
||||||
this._this.selectRow(this.rowId);
|
this._this.selectRow(this.rowId);
|
||||||
}
|
}
|
||||||
});
|
}, { passive: true });
|
||||||
tr.addEventListener("keydown", function(event) {
|
tr.addEventListener("keydown", function(event) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "up":
|
case "up":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue