add device search

This commit is contained in:
Stewart Allen 2020-12-20 14:15:35 -05:00
commit 6977a4e720
3 changed files with 56 additions and 1 deletions

View file

@ -52,6 +52,7 @@
let currentDevice = null,
deviceURL = null,
deviceTexture = null,
deviceFilter = null,
deviceImage = null,
selectedTool = null,
editTools = null,
@ -950,6 +951,10 @@
}
dedup[device] = device;
let loc = isLocalDevice(device);
// if filter set, use
if (!loc && deviceFilter && device.toLowerCase().indexOf(deviceFilter) < 0) {
return;
}
if (incr === 0) {
first = device;
}
@ -1399,6 +1404,10 @@
help: $('acct-help'),
export: $('acct-export')
},
dev: {
search: $('dev-search'),
filter: $('dev-filter')
},
fps: $('fps'),
load: $('load-file'),
@ -1950,6 +1959,30 @@
if (!ev.buttons) API.event.emit('slider.unlabel');
};
UI.dev.search.onclick = () => {
let style = UI.dev.filter.style;
if (style.display === 'flex') {
style.display = '';
deviceFilter = null;
updateDeviceList();
} else {
style.display = 'flex';
UI.dev.filter.focus();
deviceFilter = UI.dev.filter.value;
updateDeviceList();
}
};
UI.dev.filter.onkeyup = (ev) => {
deviceFilter = UI.dev.filter.value;
updateDeviceList();
};
UI.dev.filter.onclick = (ev) => {
ev.preventDefault();
ev.stopPropagation();
};
API.event.on('slider.unlabel', (values) => {
});