Skip to content

Commit

Permalink
Merge pull request #2174 from error414/osd-serarch-speed-up
Browse files Browse the repository at this point in the history
  • Loading branch information
MrD-RC authored Nov 30, 2024
2 parents 6dd9cea + f49ae17 commit 1c44787
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tabs/osd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2799,7 +2799,7 @@ OSD.GUI.updateUnits = function() {
});
};

OSD.GUI.updateFields = function() {
OSD.GUI.updateFields = function(event) {
// display fields on/off and position
var $tmpl = $('#osd_group_template').hide();
// Clear previous groups, if any
Expand Down Expand Up @@ -2840,6 +2840,7 @@ OSD.GUI.updateFields = function() {
});
}
var $displayFields = groupContainer.find('.display-fields');
var osdSearch = $('.osd_search');
for (var jj = 0; jj < groupItems.length; jj++) {
var item = groupItems[jj];
var itemData = OSD.data.items[item.id];
Expand All @@ -2853,7 +2854,7 @@ OSD.GUI.updateFields = function() {
} else {
name = inflection.titleize(name);
}
var searchTerm = $('.osd_search').val();
var searchTerm = osdSearch.val();
if (searchTerm.length > 0 && !name.toLowerCase().includes(searchTerm.toLowerCase())) {
continue;
}
Expand Down Expand Up @@ -2949,10 +2950,13 @@ OSD.GUI.updateFields = function() {
// needs to be called after all of them have been set up
GUI.switchery();

// Update the OSD preview
refreshOSDSwitchIndicators();
updatePilotAndCraftNames();
updatePanServoPreview();
if(event != null && event.currentTarget !== osdSearch[0])
{
// Update the OSD preview
refreshOSDSwitchIndicators();
updatePilotAndCraftNames();
updatePanServoPreview();
}
};

OSD.GUI.removeBottomLines = function(){
Expand Down Expand Up @@ -3367,8 +3371,8 @@ OSD.GUI.updateAll = function() {
clear.off('change');
}

$('.osd_search').on('input', function() {
OSD.GUI.updateFields();
$('.osd_search').on('input', function(event) {
OSD.GUI.updateFields(event);
});
$('.supported').fadeIn();
OSD.GUI.updateVideoMode();
Expand Down

0 comments on commit 1c44787

Please sign in to comment.