mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-26 01:35:28 +03:00
fix : Memory leak fix
This commit is contained in:
parent
7df6587912
commit
aeeda5755f
1 changed files with 10 additions and 1 deletions
|
@ -21,6 +21,8 @@ const FONT = {};
|
||||||
const SYM = {};
|
const SYM = {};
|
||||||
const OSD = {};
|
const OSD = {};
|
||||||
|
|
||||||
|
// Stuff related to the "preset" positioning
|
||||||
|
let globalMenuClickHandler = null;
|
||||||
const positionConfigs = {
|
const positionConfigs = {
|
||||||
TL: {
|
TL: {
|
||||||
label: "Top Left",
|
label: "Top Left",
|
||||||
|
@ -3662,7 +3664,8 @@ osd.initialize = function (callback) {
|
||||||
$(this).removeClass("show");
|
$(this).removeClass("show");
|
||||||
});
|
});
|
||||||
// Global click handler to close menus
|
// Global click handler to close menus
|
||||||
$(document).on("click", hideAllMenus);
|
globalMenuClickHandler = hideAllMenus;
|
||||||
|
$(document).on("click", globalMenuClickHandler);
|
||||||
// Make field container relative positioned to contain the absolute positioned menu
|
// Make field container relative positioned to contain the absolute positioned menu
|
||||||
$field.css("position", "relative");
|
$field.css("position", "relative");
|
||||||
// Append all elements
|
// Append all elements
|
||||||
|
@ -3982,6 +3985,12 @@ osd.cleanup = function (callback) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove position menu click handler
|
||||||
|
if (globalMenuClickHandler) {
|
||||||
|
$(document).off("click", globalMenuClickHandler);
|
||||||
|
globalMenuClickHandler = null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.osd = osd;
|
TABS.osd = osd;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue