diff --git a/src/kiri/conf.js b/src/kiri/conf.js index 098b7367..37f01a22 100644 --- a/src/kiri/conf.js +++ b/src/kiri/conf.js @@ -438,7 +438,6 @@ camContourYOn: true, camTraceTool: 1000, camTraceSpeed: 250, - camTraceOn: false, camDrillTool: 1000, camDrillSpindle: 1000, camDrillDownSpeed: 250, @@ -450,7 +449,6 @@ camTabsWidth: 5, camTabsHeight: 5, camTabsDepth: 5, - camTabsOn: false, camDepthFirst: false, camEaseDown: false, camOriginTop: true, diff --git a/src/kiri/init.js b/src/kiri/init.js index 9b968112..32082eba 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -502,6 +502,7 @@ set.ver = res.ver; API.conf.put(set); API.event.settings(); + API.ui.sync(); LOC.hash = ''; } } @@ -1612,8 +1613,22 @@ camTracing: UC.newGroup(LANG.cu_menu, null, {modes:CAM, marker:true}), camTraceTool: UC.newSelect(LANG.cc_tool, {modes:CAM}), camTraceSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM}), - camTracingSep: UC.newBlank({class:"pop-sep"}), - camTraceOn: UC.newBoolean(LANG.enable, onBooleanClick, {title:'todo', modes:CAM}), + camTraceSep: UC.newBlank({class:"pop-sep"}), + camTraceSelect: UC.newRow([ + (UI.traceAdd = UC.newButton(undefined, onButtonClick, {icon:''})), + (UI.traceDun = UC.newButton(undefined, onButtonClick, {icon:''})), + (UI.traceClr = UC.newButton(undefined, onButtonClick, {icon:''})) + ], {modes:CAM, class:"ext-buttons f-row"}), + camTabs: UC.newGroup(LANG.ct_menu, null, {modes:CAM, marker:true}), + camTabsWidth: UC.newInput(LANG.ct_wdth_s, {title:LANG.ct_wdth_l, convert:UC.toFloat, bound:UC.bound(0.005,100), modes:CAM, units:true}), + camTabsHeight: UC.newInput(LANG.ct_hght_s, {title:LANG.ct_hght_l, convert:UC.toFloat, bound:UC.bound(0.005,100), modes:CAM, units:true}), + camTabsDepth: UC.newInput(LANG.ct_dpth_s, {title:LANG.ct_dpth_l, convert:UC.toFloat, bound:UC.bound(0.005,100), modes:CAM, units:true}), + camTabSep: UC.newBlank({class:"pop-sep"}), + camTabsManual: UC.newRow([ + (UI.tabAdd = UC.newButton(undefined, onButtonClick, {icon:''})), + (UI.tabDun = UC.newButton(undefined, onButtonClick, {icon:''})), + (UI.tabClr = UC.newButton(undefined, onButtonClick, {icon:''})) + ], {modes:CAM, class:"ext-buttons f-row"}), camDrill: UC.newGroup(LANG.cd_menu, null, {modes:CAM, marker:true}), camDrillTool: UC.newSelect(LANG.cc_tool, {modes:CAM}), camDrillSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM, visible:spindleShow}), @@ -1625,16 +1640,6 @@ camDrillingOn: UC.newBoolean(LANG.enable, onBooleanClick, {modes:CAM}), camDrillSep: UC.newBlank({class:"pop-sep"}), camDrillReg: UC.newSelect(LANG.cd_regi_s, {modes:CAM, title:LANG.cd_regi_l}, "drillreg"), - camTabs: UC.newGroup(LANG.ct_menu, null, {modes:CAM, marker:false}), - camTabsWidth: UC.newInput(LANG.ct_wdth_s, {title:LANG.ct_wdth_l, convert:UC.toFloat, bound:UC.bound(0.005,100), modes:CAM, units:true}), - camTabsHeight: UC.newInput(LANG.ct_hght_s, {title:LANG.ct_hght_l, convert:UC.toFloat, bound:UC.bound(0.005,100), modes:CAM, units:true}), - camTabsDepth: UC.newInput(LANG.ct_dpth_s, {title:LANG.ct_dpth_l, convert:UC.toFloat, bound:UC.bound(0.005,100), modes:CAM, units:true}), - camTabSep: UC.newBlank({class:"pop-sep"}), - camTabsManual: UC.newRow([ - (UI.tabAdd = UC.newButton(undefined, onButtonClick, {icon:''})), - (UI.tabDun = UC.newButton(undefined, onButtonClick, {icon:''})), - (UI.tabClr = UC.newButton(undefined, onButtonClick, {icon:''})) - ], {modes:CAM, class:"ext-buttons f-row"}), camSep1: UC.newGroup(null, null, {modes:CAM, class:"set-sep"}), camStock: UC.newGroup(LANG.cs_menu, null, {modes:CAM, marker: true}), diff --git a/src/mode/cam/client.js b/src/mode/cam/client.js index f0e90847..adbdd7f7 100644 --- a/src/mode/cam/client.js +++ b/src/mode/cam/client.js @@ -37,7 +37,7 @@ $('set-tools').style.display = isCamMode ? '' : 'none'; kiri.space.platform.setColor(isCamMode ? 0xeeeeee : 0xcccccc); updateStock(undefined, 'internal'); - if (!isCamMode) func.tclear(); + if (!isCamMode) func.tabClear(); }); api.event.on("view.set", (mode) => { @@ -48,6 +48,14 @@ api.event.on("settings.saved", (settings) => { const proc = settings.process; + let hasTabs = false; + let hasTraces = false; + // for any tabs or traces to set markers + Object.keys(settings.widget).forEach(wid => { + let wannot = settings.widget[wid]; + if (wannot.tab && wannot.tab.length) hasTabs = true; + if (wannot.trace && wannot.trace.length) hasTraces = true; + }); // show/hide dots in enabled process pop buttons api.ui.camRough.marker.style.display = proc.camRoughOn ? 'flex' : 'none'; api.ui.camDrill.marker.style.display = @@ -55,7 +63,8 @@ api.ui.camOutline.marker.style.display = proc.camOutlineOn ? 'flex' : 'none'; api.ui.camContour.marker.style.display = proc.camContourXOn || proc.camContourYOn ? 'flex' : 'none'; - api.ui.camTracing.marker.style.display = proc.camTraceOn ? 'flex' : 'none'; + api.ui.camTracing.marker.style.display = hasTraces ? 'flex' : 'none'; + api.ui.camTabs.marker.style.display = hasTabs ? 'flex' : 'none'; api.ui.camStock.marker.style.display = proc.camStockOn ? 'flex' : 'none'; updateStock(settings, 'settings.saved.internal'); }); @@ -99,46 +108,75 @@ api.event.on("button.click", target => { switch (target) { case api.ui.tabAdd: - return func.tadd(); + return func.tabAdd(); case api.ui.tabDun: - return func.tdone(); + return func.tabDone(); case api.ui.tabClr: api.uc.confirm("clear tabs?").then(ok => { - if (ok) func.tclear(); + if (ok) func.tabClear(); + }); + break; + case api.ui.traceAdd: + return func.traceAdd(); + case api.ui.traceDun: + return func.traceDone(); + case api.ui.traceClr: + api.uc.confirm("clear traces?").then(ok => { + if (ok) func.traceClear(); }); break; } }); - api.event.on("cam.tabs.add", func.tadd = () => { + api.event.on("cam.tabs.add", func.tabAdd = () => { alert = api.show.alert("<esc> key cancels editing tabs"); api.feature.hover = true; }); - api.event.on("cam.tabs.done", func.tdone = () => { + api.event.on("cam.tabs.done", func.tabDone = () => { delbox('tabb'); api.hide.alert(alert); api.feature.hover = false; }); - api.event.on("cam.tabs.clear", func.tclear = () => { - func.tdone(); + api.event.on("cam.tabs.clear", func.tabClear = () => { + func.tabDone(); API.widgets.all().forEach(widget => { clearTabs(widget); }); API.conf.save(); }); + + api.event.on("cam.trace.add", func.traceAdd = () => { + alert = api.show.alert("<esc> key cancels editing traces"); + api.feature.hover = true; + }); + api.event.on("cam.trace.done", func.traceDone = () => { + api.hide.alert(alert); + api.feature.hover = false; + }); + api.event.on("cam.trace.clear", func.traceClear = () => { + func.traceDone(); + API.widgets.all().forEach(widget => { + clearTraces(widget); + }); + API.conf.save(); + }); + api.event.on("slice.begin", () => { if (isCamMode) { - func.tdone(); + func.tabDone(); + func.traceDone(); } }); api.event.on("key.esc", () => { if (isCamMode) { - func.tdone(); + func.tabDone(); + func.traceDone(); } }); api.event.on("selection.scale", () => { if (isCamMode) { - func.tclear(); + func.tabClear(); + func.traceClear(); } }); api.event.on("widget.rotate", rot => {