handle adding widgets in indexed axis mode
This commit is contained in:
parent
f53b9825cb
commit
74f60dea78
2 changed files with 9 additions and 6 deletions
|
|
@ -66,10 +66,10 @@ CAM.init = function(kiri, api) {
|
|||
return API.conf.get().process.camZBottom > 0;
|
||||
}
|
||||
|
||||
function setAnimationStyle() {
|
||||
function setAnimationStyle(refresh) {
|
||||
const { camStockIndexed, camStockOn } = current.process;
|
||||
let newIndexed = camStockIndexed && camStockOn;
|
||||
let changed = isIndexed !== newIndexed;
|
||||
let changed = refresh || isIndexed !== newIndexed;
|
||||
isIndexed = newIndexed;
|
||||
if (!isIndexed || !isCamMode) {
|
||||
for (let widget of API.widgets.all()) {
|
||||
|
|
@ -109,8 +109,10 @@ CAM.init = function(kiri, api) {
|
|||
}
|
||||
|
||||
api.event.on("widget.add", widget => {
|
||||
if (isCamMode) {
|
||||
setAnimationStyle();
|
||||
if (isCamMode && !Array.isArray(widget)) {
|
||||
setAnimationStyle(true);
|
||||
widget.setIndexed(camStock && isIndexed ? camStock.scale.z : 0);
|
||||
api.platform.update_top_z();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ CAM.slice = function(settings, widget, onupdate, ondone) {
|
|||
zbOff = isIndexed ? 0 : (hasStock ? wztop - track.box.d : 0),
|
||||
// defined z bottom offset by distance to stock bottom
|
||||
// keeps the z bottom relative to the part when z align changes
|
||||
zBottom = isIndexed ? bounds.min.z : proc.camZBottom - zbOff,
|
||||
zBottom = isIndexed ? proc.camZBottom || bounds.min.z : proc.camZBottom - zbOff,
|
||||
// greater of widget bottom and z bottom
|
||||
zMin = isIndexed ? bounds.min.z : Math.max(bounds.min.z, zBottom),
|
||||
zMax = bounds.max.z,
|
||||
|
|
@ -110,7 +110,8 @@ CAM.slice = function(settings, widget, onupdate, ondone) {
|
|||
let mark = Date.now();
|
||||
let slicer = new kiri.cam_slicer(widget.getPoints(), {
|
||||
zlist: true,
|
||||
zline: true
|
||||
zline: true,
|
||||
nobucket: isIndexed
|
||||
});
|
||||
|
||||
function updateToolDiams(toolDiam) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue