diff --git a/src/js/control-view.js b/src/js/control-view.js index 60e09b1..abf61e1 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -39,14 +39,6 @@ module.exports = { jog_adjust: parseInt(cookie.get('jog-adjust', 2)), deleteGCode: false, tab: 'auto', - toolpath_msg: { - x: false, - y: false, - z: false, - a: false, - b: false, - c: false - }, ask_home: true, showGcodeMessage: false } @@ -425,8 +417,8 @@ module.exports = { SvelteComponents.showDialog("MoveToZero", { axes }); }, - show_toolpath_msg: function (axis) { - this.toolpath_msg[axis] = true; + showToolpathMessageDialog: function (axis) { + SvelteComponents.showDialog("ToolpathMessage", { msg: this[axis].toolmsg }); }, set_position: function (axis, position) { diff --git a/src/pug/templates/control-view.pug b/src/pug/templates/control-view.pug index 6ca4ec7..6f5887d 100644 --- a/src/pug/templates/control-view.pug +++ b/src/pug/templates/control-view.pug @@ -107,20 +107,10 @@ script#control-view-template(type="text/x-template") td.state .fa(:class=`'fa-' + ${axis}.icon`) | {{#{axis}.state}} - td.tstate(:class=`${axis}.tklass`, :title=`${axis}.toolmsg`, @click=`show_toolpath_msg('${axis}')`) + td.tstate(:class=`${axis}.tklass`, :title=`${axis}.toolmsg`, @click=`showToolpathMessageDialog('${axis}')`) .fa(:class=`'fa-' + ${axis}.ticon`) | {{#{axis}.tstate}} - - message(:show.sync=`toolpath_msg['${axis}']`) - h3(slot="header") Tool path info {{'#{axis}' | upper}} axis - - div(slot="body") - p {{#{axis}.toolmsg}} - - div(slot="footer") - button.pure-button(@click=`toolpath_msg['${axis}'] = false`) - | OK - + th.actions button.pure-button(:disabled="!can_set_axis", title=`Set {{'${axis}' | upper}} axis position.`, diff --git a/src/svelte-components/src/dialogs/DialogHost.svelte b/src/svelte-components/src/dialogs/DialogHost.svelte index 377c5e2..b8275d3 100644 --- a/src/svelte-components/src/dialogs/DialogHost.svelte +++ b/src/svelte-components/src/dialogs/DialogHost.svelte @@ -9,6 +9,7 @@ import SetAxisPositionDialog from "./SetAxisPositionDialog.svelte"; import MoveToZeroDialog from "./MoveToZeroDialog.svelte"; import ShutdownDialog from "./ShutdownDialog.svelte"; + import ToolpathMessageDialog from "./ToolpathMessageDialog.svelte"; const HomeMachineDialogProps = writable(); type HomeMachineDialogPropsType = { @@ -62,6 +63,12 @@ open: boolean; }; + const ToolpathMessageDialogProps = writable(); + type ToolpathMessageDialogPropsType = { + open: boolean; + msg: string; + }; + export function showDialog( dialog: "HomeMachine", props: Omit @@ -107,6 +114,11 @@ props: Omit ); + export function showDialog( + dialog: "ToolpathMessage", + props: Omit + ); + export function showDialog(dialog: string, props: any) { switch (dialog) { case "HomeMachine": @@ -145,6 +157,10 @@ ShutdownDialogProps.set({ ...props, open: true }); break; + case "ToolpathMessage": + ToolpathMessageDialogProps.set({ ...props, open: true }); + break; + default: throw new Error(`Unknown dialog '${dialog}'`); } @@ -220,3 +236,4 @@ + diff --git a/src/svelte-components/src/dialogs/ToolpathMessageDialog.svelte b/src/svelte-components/src/dialogs/ToolpathMessageDialog.svelte new file mode 100644 index 0000000..6304698 --- /dev/null +++ b/src/svelte-components/src/dialogs/ToolpathMessageDialog.svelte @@ -0,0 +1,22 @@ + + + + {msg || ""} + + + + +