wid_edit: sort widgets with same sortorder by name

(assuming Array.sort() is stable)
pull/1303/head
Richard de Boer 2022-01-17 20:35:18 +01:00
parent 832f308fde
commit 9a8ccf0f4f
No known key found for this signature in database
GPG Key ID: 8721727971871937
2 changed files with 2 additions and 0 deletions

View File

@ -30,6 +30,7 @@ Bangle.loadWidgets = function() {
const W = WIDGETS;
WIDGETS = {};
Object.keys(W)
.sort()
.sort((a, b) => (0|W[b].sortorder)-(0|W[a].sortorder))
.forEach(k => WIDGETS[k] = W[k]);
}

View File

@ -14,6 +14,7 @@
let W = WIDGETS;
global.WIDGETS = {};
Object.keys(W)
.sort()
.sort((a, b) => (0|W[b].sortorder)-(0|W[a].sortorder))
.forEach(k => {WIDGETS[k] = W[k]});
Bangle.drawWidgets();