update index view on field setting update

This commit is contained in:
Stewart Allen 2022-11-14 10:46:45 -05:00
commit a0b749ea21

View file

@ -189,6 +189,7 @@ CAM.init = function(kiri, api) {
api.ui.camStock.marker.style.display = proc.camStockOn ? 'flex' : 'none';
api.platform.update_bounds();
updateAxisMode();
updateIndex();
updateStock();
if (!poppedRec) {
func.opRender();
@ -408,6 +409,28 @@ CAM.init = function(kiri, api) {
}
});
function updateIndex() {
let index = 0;
let indexing = false;
for (let op of current.process.ops) {
if (op.type === '|') {
break;
}
if (op.type === 'index') {
indexing = true;
if (op.absolute) {
index = op.degrees
} else {
index += op.degrees;
}
}
}
for (let widget of API.widgets.all()) {
widget.setAxisIndex(isPreview || !isIndexed ? 0 : -index);
}
currentIndex = isIndexed && !isPreview ? index * DEG2RAD : 0;
}
api.event.on("cam.op.render", func.opRender = () => {
let oplist = current.process.ops;
if (!(isCamMode && oplist)) {