Merge pull request #11109 from keymanapp/fix/developer/11107-scroll-typeerror

fix(developer): prevent error when scrolling touch layout editor with no selected key
This commit is contained in:
Marc Durdin 2024-03-29 15:23:13 +11:00 committed by GitHub
commit ebe258d062
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,8 +18,8 @@ $(function() {
this.saveSelection = function() {
let key = builder.selectedKey(), subKey = builder.selectedSubKey();
return {
id: key ? $(key).data('id') : null,
subId: subKey ? $(subKey).data('id') : null
id: key.length ? $(key).data('id') : null,
subId: subKey.length ? $(subKey).data('id') : null
};
}
@ -971,7 +971,7 @@ $(function() {
$('#kbd-scroll-container').on('scroll', function () {
const key = builder.selectedKey();
if(key) {
if(key.length) {
builder.moveWedgesAround(key[0]);
}
});