fix velocità di aggiornamento slider tramite tasti.

This commit is contained in:
=
2020-08-31 16:10:39 +02:00
parent b47975c7f6
commit 968dab090d
15 changed files with 95 additions and 50 deletions
@@ -2,7 +2,7 @@
"env": "development",
"api": {
"enabled": true,
"apiServerUrl": "http://localhost:9000/"
"apiServerUrl": "http://seriate.steamware.net:9000/"
},
"allUIVisible": true
}
+1 -1
View File
@@ -13,7 +13,7 @@
<script src="Scripts/jquery.mousewheel.js"></script>
<script src="Scripts/jquery.signalR-2.2.2.min.js"></script>
<script src="Scripts/raphael-2.1.4.min.js"></script>
<script src="http://localhost:9000/signalr/hubs" async></script>
<script src="http://seriate.steamware.net:9000/signalr/hubs" async></script>
<link href="assets/styles/style.css" rel="stylesheet" />
</head>
@@ -1,8 +1,9 @@
import Vue from "vue";
import Component from "vue-class-component";
import { Prop } from 'vue-property-decorator';
import { debounce } from "@/_base/debounce";
import { Hub } from "@/services";
import Numeric from "./numeric";
@Component({ name: "slider" })
export default class Slider extends Vue {
@@ -17,6 +18,8 @@ export default class Slider extends Vue {
@Prop({ default: 1 })
decimal: number;
incrementing: number = 0;
tempValue: number = null;
get actualvalue() {
return this.value.setpointHMI;
@@ -27,11 +30,9 @@ export default class Slider extends Vue {
}
set actualvalue(v: number) {
this.debouncedActualValue(v)
this.value.setpointHMI = v;
}
debouncedActualValue = debounce((v: number) => this.value.setpointHMI = v, 200);
get step() {
// var s = ((this.value.range.max - this.value.range.min) / (this.lines + 1));
// var m = Math.pow(10, this.decimal);
@@ -39,31 +40,43 @@ export default class Slider extends Vue {
return 1;
};
increment() {
startIncrement() {
if (!this.value.status.enabled) return;
this.incrementing = setInterval(() => {
var v = this.value.setpointHMI;
if (v < this.value.range.max) {
v += this.step;
}
if (v > this.value.range.max) {
v = this.value.range.max;
}
this.actualvalue = v;
}, 50);
}
startDecrement() {
if (!this.value.status.enabled) return;
this.incrementing = setInterval(() => {
var v = this.value.setpointHMI;
if (v > this.value.range.min) {
v -= this.step;
}
if (v < this.value.range.min) {
v = this.value.range.min;
}
this.actualvalue = v;
}, 50);
}
confirm() {
if (!this.value.status.enabled) return;
if (this.incrementing)
clearInterval(this.incrementing);
this.incrementing = 0;
var v = this.value.setpointHMI;
if (v < this.value.range.max) {
v += this.step;
}
if (v > this.value.range.max) {
v = this.value.range.max;
}
this.actualvalue = v;
};
decrement() {
if (!this.value.status.enabled) return;
var v = this.value.setpointHMI;
if (v > this.value.range.min) {
v -= this.step;
}
if (v < this.value.range.min) {
v = this.value.range.min;
}
this.actualvalue = v;
};
doSoftKeyClick() {
Hub.Current.sendUserSoftKey(this.softKey.id);
@@ -1,7 +1,7 @@
<template>
<div class="slider-container">
<div class="slider">
<button @click="decrement()">
<button @mousedown="startDecrement()" @mouseup="confirm()" @mouseout="confirm()">
<img src="assets/icons/png/min.png" />
</button>
<div class="control">
@@ -21,7 +21,7 @@
<small>{{`${this.value.range.max} ${this.value.unitMeasure}`}}</small>
</div>
</div>
<button @click="increment()">
<button @mousedown="startIncrement()" @mouseup="confirm()" @mouseout="confirm()">
<img src="assets/icons/png/max.png" />
</button>
</div>
@@ -10,6 +10,7 @@ import { recipeActions } from "@/store/recipe.store";
import { store } from "@/store";
import { Deferred } from '@/services';
import { recipeService } from "@/services/recipeService";
import { debounce } from '@/_base/debounce';
@Component({ components: { modal: Modal, stepfooter: StepFooter, caricatore: Caricatore, cicloformatura: CicloFormatura } })
export default class ShowCicloInfo extends Vue {
@@ -57,9 +58,11 @@ export default class ShowCicloInfo extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
await recipeService.Update(this.payload);
this.debouncedRecipeSave()
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
hasErrors() {
let payload = this.recipe;
let errors = false;
@@ -12,6 +12,7 @@ import { recipeActions } from "@/store/recipe.store";
import { store } from "@/store";
import { Deferred } from '@/services';
import { recipeService } from "@/services/recipeService";
import { debounce } from '@/_base/debounce';
@Component({
components: {
@@ -39,8 +40,10 @@ export default class ShowControstampoInfo extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
await recipeService.Update(this.payload);
}
this.debouncedRecipeSave()
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
return {
@@ -10,6 +10,7 @@ import { recipeActions } from "@/store/recipe.store";
import { store } from "@/store";
import { Deferred } from '@/services';
import { recipeService } from "@/services/recipeService";
import { debounce } from '@/_base/debounce';
@Component({
components:
@@ -36,9 +37,10 @@ export default class ShowEstrazioneInfo extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
this.debouncedRecipeSave()
};
await recipeService.Update(this.payload);
}
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
return {
@@ -19,6 +19,7 @@ import { recipeActions } from "@/store/recipe.store";
import { store } from "@/store";
import { Deferred } from "@/services";
import { recipeService } from "@/services/recipeService";
import { debounce } from "@/_base/debounce";
@Component({
components: {
@@ -57,8 +58,10 @@ export default class ShowFormatoInfo extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
await recipeService.Update(this.payload);
}
this.debouncedRecipeSave()
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
return {
@@ -11,6 +11,7 @@ import { store } from "@/store";
import { Deferred } from "@/services";
import { recipeService } from "@/services/recipeService";
import svgChart from "@/app_modules_thermo/components/svgChart.vue";
import { debounce } from "@/_base/debounce";
@Component({
components: {
@@ -47,8 +48,10 @@ export default class ShowImbutituraInfo extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
await recipeService.Update(this.payload);
}
this.debouncedRecipeSave()
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
return {
@@ -11,6 +11,7 @@ import { store } from "@/store";
import { Prop, Watch } from "vue-property-decorator";
import { Deferred } from "@/services";
import { recipeService } from "@/services/recipeService";
import { debounce } from "@/_base/debounce";
@Component({
components: {
@@ -38,8 +39,10 @@ export default class ShowOpzioniInfo extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
await recipeService.Update(this.payload);
}
this.debouncedRecipeSave()
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
return {
@@ -11,6 +11,7 @@ import { recipeActions } from "@/store/recipe.store";
import { store } from "@/store";
import { Deferred } from "@/services";
import { recipeService } from "@/services/recipeService";
import { debounce } from "@/_base/debounce";
@Component({ components: { modal: Modal, pirometro: Pirometro, stepfooter: StepFooter, termosuperiore: TermoregolazioneSuperiore, termoinferiore: TermoregolazioneInferiore } })
export default class ShowPirometroInfo extends Vue {
@@ -29,8 +30,10 @@ export default class ShowPirometroInfo extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
await recipeService.Update(this.payload);
}
this.debouncedRecipeSave()
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
return {
@@ -11,6 +11,7 @@ import { store } from "@/store";
import { Prop, Watch } from "vue-property-decorator";
import { Deferred } from "@/services";
import { recipeService } from "@/services/recipeService";
import { debounce } from "@/_base/debounce";
@Component({
components: {
@@ -37,8 +38,10 @@ export default class ShowQuoteVelocitaInfo extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
await recipeService.Update(this.payload);
}
this.debouncedRecipeSave()
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
return {
@@ -13,6 +13,7 @@ import { recipeActions } from "@/store/recipe.store";
import { store } from "@/store";
import { Deferred } from '@/services';
import { recipeService } from "@/services/recipeService";
import { debounce } from '@/_base/debounce';
@Component({
components: {
@@ -41,8 +42,10 @@ export default class Raffreddamento extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
await recipeService.Update(this.payload);
}
this.debouncedRecipeSave()
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
@@ -12,6 +12,7 @@ import { store } from "@/store";
import { Deferred } from "@/services";
import { recipeService } from "@/services/recipeService";
import { warmersService } from "@/services/warmersService";
import { debounce } from "@/_base/debounce";
@Component({ components: { modal: Modal, stepfooter: StepFooter, riscaldiinf: RiscaldiInf, riscaldisup: RiscaldiSup, sostdecomp: SostDecomp } })
export default class ShowRiscaldamentoSuperioreInfo extends Vue {
@@ -30,8 +31,10 @@ export default class ShowRiscaldamentoSuperioreInfo extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
await recipeService.Update(this.payload);
}
this.debouncedRecipeSave()
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
return {
@@ -12,6 +12,7 @@ import { recipeActions } from "@/store/recipe.store";
import { store } from "@/store";
import { Deferred } from "@/services";
import { recipeService } from "@/services/recipeService";
import { debounce } from "@/_base/debounce";
@Component({
components:
@@ -41,8 +42,10 @@ export default class ShowVuotoInfo extends Vue {
@Watch('recipe', { deep: true })
async recipeChanged(n, o) {
await recipeService.Update(this.payload);
}
this.debouncedRecipeSave()
};
debouncedRecipeSave = debounce(async () => await recipeService.Update(this.payload), 200);
get payload() {
return {