Skip to content

Commit 1c44787

Browse files
authored
Merge pull request #2174 from error414/osd-serarch-speed-up
2 parents 6dd9cea + f49ae17 commit 1c44787

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tabs/osd.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -2799,7 +2799,7 @@ OSD.GUI.updateUnits = function() {
27992799
});
28002800
};
28012801

2802-
OSD.GUI.updateFields = function() {
2802+
OSD.GUI.updateFields = function(event) {
28032803
// display fields on/off and position
28042804
var $tmpl = $('#osd_group_template').hide();
28052805
// Clear previous groups, if any
@@ -2840,6 +2840,7 @@ OSD.GUI.updateFields = function() {
28402840
});
28412841
}
28422842
var $displayFields = groupContainer.find('.display-fields');
2843+
var osdSearch = $('.osd_search');
28432844
for (var jj = 0; jj < groupItems.length; jj++) {
28442845
var item = groupItems[jj];
28452846
var itemData = OSD.data.items[item.id];
@@ -2853,7 +2854,7 @@ OSD.GUI.updateFields = function() {
28532854
} else {
28542855
name = inflection.titleize(name);
28552856
}
2856-
var searchTerm = $('.osd_search').val();
2857+
var searchTerm = osdSearch.val();
28572858
if (searchTerm.length > 0 && !name.toLowerCase().includes(searchTerm.toLowerCase())) {
28582859
continue;
28592860
}
@@ -2949,10 +2950,13 @@ OSD.GUI.updateFields = function() {
29492950
// needs to be called after all of them have been set up
29502951
GUI.switchery();
29512952

2952-
// Update the OSD preview
2953-
refreshOSDSwitchIndicators();
2954-
updatePilotAndCraftNames();
2955-
updatePanServoPreview();
2953+
if(event != null && event.currentTarget !== osdSearch[0])
2954+
{
2955+
// Update the OSD preview
2956+
refreshOSDSwitchIndicators();
2957+
updatePilotAndCraftNames();
2958+
updatePanServoPreview();
2959+
}
29562960
};
29572961

29582962
OSD.GUI.removeBottomLines = function(){
@@ -3367,8 +3371,8 @@ OSD.GUI.updateAll = function() {
33673371
clear.off('change');
33683372
}
33693373

3370-
$('.osd_search').on('input', function() {
3371-
OSD.GUI.updateFields();
3374+
$('.osd_search').on('input', function(event) {
3375+
OSD.GUI.updateFields(event);
33723376
});
33733377
$('.supported').fadeIn();
33743378
OSD.GUI.updateVideoMode();

0 commit comments

Comments
 (0)