move some right click context menu items to toolbar. highlight selected menu mode

This commit is contained in:
Stewart Allen 2024-05-31 13:02:35 -04:00
commit c1cab0389c
3 changed files with 16 additions and 28 deletions

View file

@ -908,6 +908,15 @@ gapp.register("kiri.main", [], (root, exports) => {
options.selectedIndex = optlist.indexOf(mode);
modename.onchange = (ev) => setMode(optlist[options.selectedIndex]);
}
// highlight selected mode menu item
["FDM","CAM","SLA","LASER"].forEach(sm => {
const cl = $(`mode-${sm.toLowerCase()}`).classList;
if (sm === mode) {
cl.add('selected');
} else {
cl.remove('selected');
}
});
// restore cached device profile for this mode
if (current.cdev[mode]) {
current.device = clone(current.cdev[mode]);