diff --git a/Thermo.Active/wwwroot/assets/styles/base/tastierino.less b/Thermo.Active/wwwroot/assets/styles/base/tastierino.less index a1e04688..e7163490 100644 --- a/Thermo.Active/wwwroot/assets/styles/base/tastierino.less +++ b/Thermo.Active/wwwroot/assets/styles/base/tastierino.less @@ -29,6 +29,26 @@ color: @color-darkish-blue; font-size: 20px; border-radius: 2px; + + &.pressed, + &:active:not([disabled]) { + background-image: linear-gradient(to bottom, @color-silver, @color-white2); + border: none !important; + box-shadow: inset @button-shadow !important; + } + + &[disabled] { + border-radius: 2px; + border-radius: 2px; + background-color: #dddddd; + background-image: none; + box-shadow: none; + color: @color-warm-grey; + + &:hover { + box-shadow: none !important; + } + } } .zero { @@ -102,11 +122,25 @@ .bPunto { grid-column: 3/4; grid-row: 4/5; + &.point { + background-image: linear-gradient(to bottom, #1756ad, #002680); + color: white; + } } .bDel { grid-column: 4/5; grid-row: 1/2; } + .focus{ + position: absolute; + background-image: linear-gradient(to bottom, #1756ad, #002680); + bottom: 6px; + right: 4px; + width: 10px; + height: 10px; + border-radius: 5px; + + } } } \ No newline at end of file diff --git a/Thermo.Active/wwwroot/assets/styles/style.css b/Thermo.Active/wwwroot/assets/styles/style.css index ece6f7bc..3af48fea 100644 --- a/Thermo.Active/wwwroot/assets/styles/style.css +++ b/Thermo.Active/wwwroot/assets/styles/style.css @@ -4802,6 +4802,22 @@ article .box .body { font-size: 20px; border-radius: 2px; } +.keyboard .mask button.pressed, +.keyboard .mask button:active:not([disabled]) { + background-image: linear-gradient(to bottom, #bbbcbc, #f1f1f1); + border: none !important; + box-shadow: inset 0 1px 2px 0 rgba(0, 0, 0, 0.4) !important; +} +.keyboard .mask button[disabled] { + border-radius: 2px; + background-color: #dddddd; + background-image: none; + box-shadow: none; + color: #878787; +} +.keyboard .mask button[disabled]:hover { + box-shadow: none !important; +} .keyboard .mask .zero { grid-column: 1 / span 2; grid-row: 0.8; @@ -4861,10 +4877,23 @@ article .box .body { grid-column: 0.75; grid-row: 0.8; } +.keyboard .mask .bPunto.point { + background-image: linear-gradient(to bottom, #1756ad, #002680); + color: white; +} .keyboard .mask .bDel { grid-column: 0.8; grid-row: 0.5; } +.keyboard .mask .focus { + position: absolute; + background-image: linear-gradient(to bottom, #1756ad, #002680); + bottom: 6px; + right: 4px; + width: 10px; + height: 10px; + border-radius: 5px; +} .pre_heat { grid-template-rows: 144px auto auto auto; grid-template-columns: repeat(6, 16.7%); diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/components/KeyboardHelper.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/components/KeyboardHelper.ts index 6bca61a3..43363fb6 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/components/KeyboardHelper.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/components/KeyboardHelper.ts @@ -10,6 +10,7 @@ export class KeyboardHelper { static showKeyboard(x, y, value: Recipe.IValue, component: HTMLInputElement) { if (KeyboardHelper.currentKeyboard) { + KeyboardHelper.currentKeyboard.focusTo(); KeyboardHelper.currentKeyboard.resetTo(value); KeyboardHelper.currentKeyboard.positionX = x; diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/components/keyboard.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/components/keyboard.ts index 00bfd786..c7e33ac8 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/components/keyboard.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/components/keyboard.ts @@ -13,62 +13,84 @@ export default class Keyboard extends Vue { actualValue: Recipe.IValue; - point: string; + point = false; + haspoint = false; + disabledall = false; + + addedPoint = true; + focus = false; @Prop() value: string; - get Value() { + get Value() { return this.actualValue.setpointHMI; } - set Value(v: number) { - try { - let scale = Math.pow(10, this.actualValue.numDec ?? 0); - let result = Math.round(v * scale) / scale; - - if (!Number.isNaN(result) && Number.isFinite(result)) - this.actualValue.setpointHMI = result; - else - this.actualValue.setpointHMI = v; - } catch { + setValue(v: number) { + if (!Number.isNaN(v) && Number.isFinite(v)) this.actualValue.setpointHMI = v; - } } del() { - this.Value = 0; + this.setValue(0); + this.calcDisabled(); } canc() { - let temp = String(this.Value); - this.Value = Number(temp.slice(0, -1)) + let temp = String(this.actualValue.setpointHMI); + temp = temp.slice(0, -1); + if(temp.endsWith('.')) + temp = temp.slice(0, -1); + this.setValue(Number(temp)); + this.calcDisabled(); } add(num: string) { - if (this.point) { - this.point += num; - this.Value = Number(this.point) - } else { - let temp = String(this.Value); - temp += num; - this.Value = Number(temp) + if(this.disabledall) return + + if(this.focus) + { + this.focus = false; + this.setValue(Number(num)); + return } + + if (this.point) { + this.point = false; + let temp = String(this.actualValue.setpointHMI); + temp += "."+num; + this.setValue(Number(temp)); + } else if(this.actualValue.setpointHMI == 0){ + this.setValue(Number(num)); + } + else { + let temp = String(this.actualValue.setpointHMI); + temp += num; + this.setValue(Number(temp)); + } + this.calcDisabled(); } + addpoint() { - if (!this.point) { - this.point = String(this.Value); - this.point += "."; - } + if(this.actualValue.numDec == 0)return + if(String(this.actualValue.setpointHMI).includes(".")) return; + this.point = !this.point; + this.calcDisabled(); } resetTo(value) { - this.actualValue = null; - this.point = null; - this.actualValue = value; + this.point = false; + if(this.actualValue){ + this.calcDisabled(); + } + } + + focusTo() { + this.focus = true; } hide() { @@ -79,5 +101,47 @@ export default class Keyboard extends Vue { mounted() { KeyboardHelper.setCurrentKeyboard(this); } + + countDecimals(value) { + if (Math.floor(value) !== value) + return value.toString().split(".")[1].length || 0; + return 0; + } + countchars(value) { + return value.toString().split(".")[0].length || 0; + } + + calcDisabled(){ + if(this.actualValue.numDec == 0) { + if(this.focus){ + this.disabledall = false; + this.haspoint = true; + } + else{ + this.haspoint = true; + this.disabledall = this.countchars(this.actualValue.setpointHMI) >= this.countchars(this.actualValue.range.max); + } + } + else{ + if(this.focus){ + this.disabledall = false; + this.haspoint = false; + } + else + { + this.haspoint = String(this.actualValue.setpointHMI).includes("."); + if(!this.haspoint && !this.point){ + this.disabledall =this.countchars(this.actualValue.setpointHMI) >= this.countchars(this.actualValue.range.max); + } + else{ + this.disabledall = this.countDecimals(this.actualValue.setpointHMI) >= this.actualValue.numDec; + } + } + + } + + + } + } diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/components/keyboard.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/components/keyboard.vue index bd0dd758..cf8fbd70 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/components/keyboard.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/components/keyboard.vue @@ -6,44 +6,45 @@ @mousedown.prevent.stop >
- - - - - - - - - - - +
 
diff --git a/Thermo.Active/wwwroot/src/services/hub.ts b/Thermo.Active/wwwroot/src/services/hub.ts index 6e3a0b07..b313ce85 100644 --- a/Thermo.Active/wwwroot/src/services/hub.ts +++ b/Thermo.Active/wwwroot/src/services/hub.ts @@ -26,6 +26,7 @@ import { prodActions } from "@/store/prod.store"; import { Model } from "vue-property-decorator"; import { prodService } from "./prodService"; import { recipeService } from "./recipeService"; +import { warmersActions } from "@/store/warmers.store"; declare const PRODUCTION; @@ -107,6 +108,7 @@ export class Hub { // qui i NUOVI metodi NUOVI dal server (Recipe, gauges) da completare lato HUB this._hub.client.recipeFullData = Hub.recipeFullData; + this._hub.client.warmersData = Hub.warmersData; this._hub.client.setpointHmiInvalid = Hub.setpointHmiInvalid; this._hub.client.recipeOverData = Hub.recipeOverData; this._hub.client.recipeChangedData = Hub.recipeChangedData; @@ -181,6 +183,10 @@ export class Hub { recipeActions.setCurrent(store, data, true); } + public static warmersData(data){ + warmersActions.setChannels(store, data as { [id: number]: Warmers.IChannel }); + } + public static async setpointHmiInvalid(data) { if (data) { await recipeService.GetCurrent(); diff --git a/Thermo.Active/wwwroot/src/store/warmers.store.ts b/Thermo.Active/wwwroot/src/store/warmers.store.ts index 9b564425..1f155e75 100644 --- a/Thermo.Active/wwwroot/src/store/warmers.store.ts +++ b/Thermo.Active/wwwroot/src/store/warmers.store.ts @@ -38,8 +38,14 @@ export const warmersStore = { SetChannels(state, model: { [id: number]: Warmers.IChannel }) { for (const key in model) { if (model.hasOwnProperty(key)) { + let intModel = state.channels.find(obj => obj.idChannel == key) const element = model[key]; - state.channels.push(element); + if(!intModel){ + state.channels.push(element); + } + else{ + intModel.setpointHMI = element.setpointHMI; + } } } },