add ui checkpoint / restore for modules, consts to api, fix stock calc when 0 widgets
This commit is contained in:
parent
852f72253d
commit
4182de3349
2 changed files with 22 additions and 6 deletions
13
js/kiri.js
13
js/kiri.js
|
|
@ -462,7 +462,6 @@ self.kiri.license = exports.LICENSE;
|
|||
view: null,
|
||||
zoomSpeed: 1.0,
|
||||
reverseZoom: true,
|
||||
groupImport: false,
|
||||
freeLayout: true,
|
||||
autoLayout: true
|
||||
},
|
||||
|
|
@ -588,6 +587,10 @@ self.kiri.license = exports.LICENSE;
|
|||
mouse : {
|
||||
moved : function() { return mouseMoved },
|
||||
movedSet : function(b) { mouseMoved = b }
|
||||
},
|
||||
const: {
|
||||
MODES,
|
||||
VIEWS
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1900,7 +1903,7 @@ self.kiri.license = exports.LICENSE;
|
|||
let sd = settings.process;
|
||||
let offset = UI.camStockOffset.checked;
|
||||
// create/inject cam stock if stock size other than default
|
||||
if (MODE === MODES.CAM && sd.camStockX && sd.camStockY && sd.camStockZ) {
|
||||
if (MODE === MODES.CAM && sd.camStockX && sd.camStockY && sd.camStockZ && WIDGETS.length) {
|
||||
UI.stock.style.display = offset ? 'inline' : 'none';
|
||||
let csx = sd.camStockX;
|
||||
let csy = sd.camStockY;
|
||||
|
|
@ -2649,12 +2652,14 @@ self.kiri.license = exports.LICENSE;
|
|||
UC.newButton("right", SPACE.view.right)
|
||||
]
|
||||
]),
|
||||
|
||||
layout: UC.newGroup('options'),
|
||||
autoLayout: UC.newBoolean("auto layout", booleanSave, {title:"automatically layout platform\nwhen new items added\nor when arrange clicked\nmore than once"}),
|
||||
freeLayout: UC.newBoolean("free layout", booleanSave, {title:"permit dragable layout"}),
|
||||
groupImport: UC.newBoolean("group import", booleanSave, {title:"group imports received\nfrom external sources\nlike Onshape", modes:CAM}),
|
||||
reverseZoom: UC.newBoolean("invert zoom", booleanSave, {title:"invert mouse wheel\nscroll zoom"}),
|
||||
|
||||
appendLeft: UC.checkpoint(),
|
||||
|
||||
layers: UC.setGroup($("layers")),
|
||||
layerOutline: UC.newBoolean("outline", onLayerToggle, {modes:LOCAL ? ALL : FDM_LASER}),
|
||||
layerTrace: UC.newBoolean("trace", onLayerToggle, {modes:FDM_LASER}),
|
||||
|
|
@ -2835,7 +2840,6 @@ self.kiri.license = exports.LICENSE;
|
|||
function booleanSave() {
|
||||
settings.controller.autoLayout = UI.autoLayout.checked;
|
||||
settings.controller.freeLayout = UI.freeLayout.checked;
|
||||
settings.controller.groupImport = UI.groupImport.checked;
|
||||
settings.controller.reverseZoom = UI.reverseZoom.checked;
|
||||
SPACE.view.setZoom(settings.controller.reverseZoom, settings.controller.zoomSpeed);
|
||||
saveSettings();
|
||||
|
|
@ -3837,7 +3841,6 @@ self.kiri.license = exports.LICENSE;
|
|||
SPACE.view.setZoom(settings.controller.reverseZoom, settings.controller.zoomSpeed);
|
||||
SPACE.platform.setZOff(0.2);
|
||||
|
||||
UI.groupImport.checked = settings.controller.groupImport;
|
||||
UI.freeLayout.checked = settings.controller.freeLayout;
|
||||
UI.autoLayout.checked = settings.controller.autoLayout;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ var gs_moto_ui = exports;
|
|||
newRow: newRow,
|
||||
newBlank: newBlank,
|
||||
newGroup: newGroup,
|
||||
setGroup: setGroup
|
||||
setGroup: setGroup,
|
||||
checkpoint,
|
||||
restore
|
||||
};
|
||||
|
||||
function setMode(mode) {
|
||||
|
|
@ -68,6 +70,17 @@ var gs_moto_ui = exports;
|
|||
return ls ? ls !== 'false' : dv !== undefined ? dv : true;
|
||||
}
|
||||
|
||||
function checkpoint() {
|
||||
return { lastDiv, lastGroup };
|
||||
}
|
||||
|
||||
function restore(opt) {
|
||||
if (opt) {
|
||||
lastDiv = opt.lastDiv;
|
||||
lastGroup = opt.lastGroup;
|
||||
}
|
||||
}
|
||||
|
||||
function setGroup(div) {
|
||||
lastDiv = div;
|
||||
return div;
|
||||
|
|
|
|||
Loading…
Reference in a new issue