min and max feed coloring settings
This commit is contained in:
1 parent
037e610136
commit
8cc9018b58
4 files changed
+126
-8
No files matched your search
@@ -222,9 +222,7 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
setReloadRequiredFlag() {
|
||||
console.log(this.loadedFile);
|
||||
if (this.loadedFile && this.loadedFile != '') {
|
||||
console.log('Flag it');
|
||||
this.reloadRequired = true;
|
||||
}
|
||||
}
|
||||
@@ -335,7 +333,6 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
|
||||
@Watch('colorMode')
|
||||
colorModeChanged(newVal) {
|
||||
console.log(newVal);
|
||||
if (newVal) {
|
||||
let mode = newVal === 'extruder' ? 0 : 1; //Magic number until I export the enum 0 = Color 1 = Feed Rate
|
||||
if (viewer.gcodeProcessor.colorMode !== mode) {
|
||||
@@ -380,10 +377,63 @@ export default class Viewer extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
@Watch('showAxes')
|
||||
showAxesChanged(newVal){
|
||||
showAxesChanged(newVal) {
|
||||
viewer.axes.show(newVal);
|
||||
}
|
||||
|
||||
get minFeed() {
|
||||
try {
|
||||
return this.$store.state.gui.gcodeViewer.minFeed;
|
||||
} catch {
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('minFeed')
|
||||
minFeedChanged(newVal) {
|
||||
viewer.gcodeProcessor.updateColorRate(newVal * 60, this.maxFeed * 60);
|
||||
}
|
||||
|
||||
get maxFeed() {
|
||||
try {
|
||||
return this.$store.state.gui.gcodeViewer.maxFeed;
|
||||
} catch {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('maxFeed')
|
||||
maxFeedChanged(newVal) {
|
||||
viewer.gcodeProcessor.updateColorRate(this.minFeed * 60, newVal * 60);
|
||||
}
|
||||
|
||||
get minFeedColor() {
|
||||
try {
|
||||
return this.$store.state.gui.gcodeViewer.minFeedColor;
|
||||
} catch {
|
||||
return '#0000FF';
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('minFeedColor')
|
||||
minFeedColorUpdated(newVal) {
|
||||
viewer.gcodeProcessor.updateMinFeedColor(newVal);
|
||||
this.setReloadRequiredFlag();
|
||||
}
|
||||
|
||||
get maxFeedColor() {
|
||||
try {
|
||||
return this.$store.state.gui.gcodeViewer.maxFeedColor;
|
||||
} catch {
|
||||
return '#FF0000';
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('maxFeedColor')
|
||||
maxFeedColorUpdated(newVal) {
|
||||
viewer.gcodeProcessor.updateMaxFeedColor(newVal);
|
||||
this.setReloadRequiredFlag();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -46,6 +46,31 @@
|
||||
</v-row>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GCodeViewerTab.MinFeed')">
|
||||
<v-text-field :rules="[v => v > 0 || 'Minimum speed is 1']" @blur="feedBlur" dense hide-details="auto" outlined suffix="mm/s" type="number" v-model="minFeed"></v-text-field>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GCodeViewerTab.MinColor')">
|
||||
<v-menu :close-on-content-click="false" bottom left offset-y>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn :color="minFeedColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
|
||||
</template>
|
||||
<v-color-picker :value="minFeedColor" @update:color="updateColorValue('minFeedColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
|
||||
</v-menu>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GCodeViewerTab.MaxFeed')">
|
||||
<v-text-field :rules="[v => v > 0 || 'Minimum speed is 1']" @blur="feedBlur" dense hide-details="auto" outlined suffix="mm/s" type="number" v-model="maxFeed"></v-text-field>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GCodeViewerTab.MaxColor')">
|
||||
<v-menu :close-on-content-click="false" bottom left offset-y>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn :color="maxFeedColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
|
||||
</template>
|
||||
<v-color-picker :value="maxFeedColor" @update:color="updateColorValue('maxFeedColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
|
||||
</v-menu>
|
||||
</settings-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</div>
|
||||
@@ -103,7 +128,6 @@ export default class SettingsGCodeViewerTab extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get backgroundColor(): string {
|
||||
console.log(this.$store.state.gui.gcodeViewer.backgroundColor);
|
||||
return this.$store.state.gui.gcodeViewer.backgroundColor;
|
||||
}
|
||||
|
||||
@@ -116,7 +140,6 @@ export default class SettingsGCodeViewerTab extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
set gridColor(newVal: string) {
|
||||
console.log(newVal);
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.gridColor', value: newVal});
|
||||
}
|
||||
|
||||
@@ -130,6 +153,43 @@ export default class SettingsGCodeViewerTab extends Mixins(BaseMixin) {
|
||||
if (color.length > 7) color = color.substr(0, 7);
|
||||
return color;
|
||||
}
|
||||
|
||||
get minFeed(): number {
|
||||
return this.$store.state.gui.gcodeViewer.minFeed;
|
||||
}
|
||||
|
||||
set minFeed(newVal: number) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.minFeed', value: newVal});
|
||||
}
|
||||
|
||||
get maxFeed(): number {
|
||||
return this.$store.state.gui.gcodeViewer.maxFeed;
|
||||
}
|
||||
|
||||
set maxFeed(newVal: number) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.maxFeed', value: newVal});
|
||||
}
|
||||
|
||||
get minFeedColor(): string {
|
||||
return this.$store.state.gui.gcodeViewer.minFeedColor;
|
||||
}
|
||||
|
||||
set minFeedColor(newVal: string) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.minFeedColor', value: newVal});
|
||||
}
|
||||
|
||||
get maxFeedColor(): string {
|
||||
return this.$store.state.gui.gcodeViewer.maxFeedColor;
|
||||
}
|
||||
|
||||
set maxFeedColor(newVal: string) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.maxFeedColor', value: newVal});
|
||||
}
|
||||
|
||||
feedBlur(): void {
|
||||
if (this.minFeed < 1) this.minFeed = 1;
|
||||
if (this.maxFeed < this.minFeed) this.maxFeed = this.minFeed + 1;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
+5
-1
@@ -583,7 +583,11 @@
|
||||
"Extruder" : "Extruder",
|
||||
"BackgroundColor" : "Background Color",
|
||||
"GridColor": "Grid Color",
|
||||
"ShowAxes": "Show Axes"
|
||||
"ShowAxes": "Show Axes",
|
||||
"MinFeed" :"Min Feed Rate",
|
||||
"MaxFeed" : "Max Feed Rate",
|
||||
"MinColor" : "Min Feed Rate Color",
|
||||
"MaxColor" : "Max Feed Rate Color"
|
||||
}
|
||||
},
|
||||
"GCodeViewer":{
|
||||
|
||||
@@ -168,7 +168,11 @@ export const getDefaultState = (): GuiState => {
|
||||
gridColor : '#0000FF',
|
||||
backgroundColor : '#000000',
|
||||
colorMode : 'extruder',
|
||||
showAxes : 'true'
|
||||
showAxes : 'true',
|
||||
minFeed : 20,
|
||||
maxFeed : 100,
|
||||
minFeedColor : "#0000FF",
|
||||
maxFeedColor : "#FF0000"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user