mirror of https://github.com/espruino/BangleApps
wid_edit: restore alphabetical sort
parent
ba995ddf4e
commit
2023138295
|
@ -4,3 +4,4 @@
|
||||||
Allow changing widgets into all areas, including bottom widget bar
|
Allow changing widgets into all areas, including bottom widget bar
|
||||||
0.03: Fix editing widgets whose draw method takes the widget
|
0.03: Fix editing widgets whose draw method takes the widget
|
||||||
0.04: Remove double-sort
|
0.04: Remove double-sort
|
||||||
|
0.05: Restore alphabetical sort
|
||||||
|
|
|
@ -14,6 +14,7 @@ Bangle.loadWidgets = (o => ()=>{
|
||||||
const W = global.WIDGETS;
|
const W = global.WIDGETS;
|
||||||
global.WIDGETS = {};
|
global.WIDGETS = {};
|
||||||
Object.keys(W)
|
Object.keys(W)
|
||||||
|
.sort() // sort alphabetically. the next sort is stable and preserves this if sortorder matches
|
||||||
.sort((a, b) => (0|W[b].sortorder)-(0|W[a].sortorder))
|
.sort((a, b) => (0|W[b].sortorder)-(0|W[a].sortorder))
|
||||||
.forEach(k => global.WIDGETS[k] = W[k]);
|
.forEach(k => global.WIDGETS[k] = W[k]);
|
||||||
})(Bangle.loadWidgets);
|
})(Bangle.loadWidgets);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"id": "wid_edit",
|
"id": "wid_edit",
|
||||||
"version": "0.04",
|
"version": "0.05",
|
||||||
"name": "Widget Editor",
|
"name": "Widget Editor",
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"description": "Customize widget locations",
|
"description": "Customize widget locations",
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
let W = global.WIDGETS;
|
let W = global.WIDGETS;
|
||||||
global.WIDGETS = {};
|
global.WIDGETS = {};
|
||||||
Object.keys(W)
|
Object.keys(W)
|
||||||
.sort()
|
.sort() // see comment in boot.js
|
||||||
.sort((a, b) => (0|W[b].sortorder)-(0|W[a].sortorder))
|
.sort((a, b) => (0|W[b].sortorder)-(0|W[a].sortorder))
|
||||||
.forEach(k => {global.WIDGETS[k] = W[k];});
|
.forEach(k => {global.WIDGETS[k] = W[k];});
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
|
|
Loading…
Reference in New Issue