diff --git a/src/js/admin-network-view.js b/src/js/admin-network-view.js index c37e6ff..12d20c5 100644 --- a/src/js/admin-network-view.js +++ b/src/js/admin-network-view.js @@ -4,7 +4,7 @@ module.exports = { attached: function () { this.svelteComponent = SvelteComponents.createComponent( "AdminNetworkView", - document.getElementById("svelte-root") + document.getElementById("admin-network") ); }, diff --git a/src/js/app.js b/src/js/app.js index 57f18a5..a15c343 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -135,6 +135,7 @@ module.exports = new Vue({ watch: { display_units: function (value) { localStorage.setItem("display_units", value); + SvelteComponents.setDisplayUnits(value); }, }, @@ -213,6 +214,10 @@ module.exports = new Vue({ ready: function () { $(window).on("hashchange", this.parse_hash); this.connect(); + + SvelteComponents.registerControllerMethods({ + dispatch: (...args) => this.$dispatch(...args) + }); }, methods: { diff --git a/src/js/settings-view.js b/src/js/settings-view.js index 6d26b98..ab87296 100644 --- a/src/js/settings-view.js +++ b/src/js/settings-view.js @@ -1,31 +1,14 @@ -'use strict' - module.exports = { - template: '#settings-view-template', - props: ['config', 'template'], + template: "#settings-view-template", - computed: { - display_units: { - cache: false, - get: function () { - return this.$root.display_units; - }, - set: function (value) { - this.$root.display_units = value; - } - }, + attached: function () { + this.svelteComponent = SvelteComponents.createComponent( + "SettingsView", + document.getElementById("settings") + ); }, - events: { - 'input-changed': function () { - this.$dispatch('config-changed'); - return false; - } - }, - - methods: { - showScreenRotationDialog: function () { - SvelteComponents.showDialog("ScreenRotation"); - } + detached: function() { + this.svelteComponent.$destroy(); } -} +}; diff --git a/src/pug/templates/admin-network-view.pug b/src/pug/templates/admin-network-view.pug index dd57264..dd7d4a9 100644 --- a/src/pug/templates/admin-network-view.pug +++ b/src/pug/templates/admin-network-view.pug @@ -1,3 +1,2 @@ script#admin-network-view-template(type="text/x-template") - #admin-network - #svelte-root + #admin-network \ No newline at end of file diff --git a/src/pug/templates/settings-view.pug b/src/pug/templates/settings-view.pug index 15ec257..8a0061f 100644 --- a/src/pug/templates/settings-view.pug +++ b/src/pug/templates/settings-view.pug @@ -1,53 +1,2 @@ script#settings-view-template(type="text/x-template") - #settings - h1 Settings - - .pure-form.pure-form-aligned - fieldset - h2 Screen - .pure-control-group - label(for="screen-rotation") - button.pure-button(name="screen-rotation", @click="showScreenRotationDialog") Change Screen Rotation - - fieldset - h2 Probe Dimensions - templated-input(v-for="templ in template.probe", v-if="$key !== 'probe-diameter'", :name="$key" - :model.sync="config.probe[$key]", :template="templ") - - fieldset - h2 GCode - templated-input(v-for="templ in template.gcode", :name="$key", - :model.sync="config.gcode[$key]", :template="templ") - - fieldset - h2 Path Accuracy - templated-input(name="max-deviation", - :model.sync="config.settings['max-deviation']", - :template="template.settings['max-deviation']") - - p. - Lower #[tt max-deviation] to follow the programmed path more precisely - but at a slower speed. - - p. - In order to improve traversal speed, the path planner may merge - consecutive moves or round off sharp corners if doing so would deviate - from the program path by less than #[tt max-deviation]. - - - var base = '//linuxcnc.org/docs/html/gcode/g-code.html' - p. - GCode commands - #[a(href=base + "#gcode:g61", target="_blank") G61, G61.1] and - #[a(href=base + "#gcode:g64", target="_blank") G64] also affect path - planning accuracy. - - h2 Cornering Speed (Advanced) - templated-input(name="junction-accel", - :model.sync="config.settings['junction-accel']", - :template="template.settings['junction-accel']") - - p. - Junction acceleration limits the cornering speed the planner will - allow. Increasing this value will allow for faster traversal of - corners but may cause the planner to violate axis jerk limits and - stall the motors. Use with caution. + #settings \ No newline at end of file diff --git a/src/resources/config-template.json b/src/resources/config-template.json index 5495a73..fad50fb 100644 --- a/src/resources/config-template.json +++ b/src/resources/config-template.json @@ -502,14 +502,14 @@ }, "probe-fast-seek": { "type": "float", - "unit": "mm/m", + "unit": "mm/min", "min": 0, "max": 1000, "default": 200 }, "probe-slow-seek": { "type": "float", - "unit": "mm/m", + "unit": "mm/min", "min": 0, "max": 1000, "default": 25 diff --git a/src/svelte-components/src/components/ConfigTemplatedInput.svelte b/src/svelte-components/src/components/ConfigTemplatedInput.svelte new file mode 100644 index 0000000..a5f2950 --- /dev/null +++ b/src/svelte-components/src/components/ConfigTemplatedInput.svelte @@ -0,0 +1,131 @@ + + +{#if template} +
+ + + {#if template.values} + + {:else if template.type === "bool"} + + {:else if template.type === "float"} + + {:else if template.type === "int"} + + {:else if template.type === "string"} + + {:else if template.type == "text"} +