fix client problems and slider behaviour

This commit is contained in:
Samuele E. Locatelli
2020-09-28 09:16:54 +02:00
parent 7086c0a83f
commit 0ea0fbd8d4
4 changed files with 17 additions and 15 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<IsSCM>false</IsSCM> <IsSCM>false</IsSCM>
<TranspColor>#FF00FF</TranspColor> <TranspColor>#FF00FF</TranspColor>
<RenderingMethod>GPU</RenderingMethod> <!-- GPU/CPU --> <RenderingMethod>GPU</RenderingMethod> <!-- GPU/CPU -->
<ShowVirtualKeyboard>false</ShowVirtualKeyboard> <ShowVirtualKeyboard>true</ShowVirtualKeyboard>
<RunningOnSecondaryScreen>false</RunningOnSecondaryScreen> <RunningOnSecondaryScreen>false</RunningOnSecondaryScreen>
<DeveloperMode>true</DeveloperMode> <DeveloperMode>true</DeveloperMode>
</Client> </Client>
+1 -1
View File
@@ -434,7 +434,7 @@ namespace Active_Client.View
string dom = ev.Node.GetElementAttribute("type").ToLower(); string dom = ev.Node.GetElementAttribute("type").ToLower();
//Filter if the node Type is TEXT or PASSWORD //Filter if the node Type is TEXT or PASSWORD
if (dom != null && (dom.Equals("text") || dom.Equals("password"))) if (dom != null && (dom.Equals("text") || dom.Equals("password") || dom.Equals("")))
NcWindow.openVirtualKeyboard(ev.Node.ElementBounds, ev.Browser.Identifier > 1, false); NcWindow.openVirtualKeyboard(ev.Node.ElementBounds, ev.Browser.Identifier > 1, false);
} }
//Filter if this node is TEXTAREA Node //Filter if this node is TEXTAREA Node
@@ -38,6 +38,7 @@ export default class Slider extends Vue {
incrementingStep: number; incrementingStep: number;
step: number = 1; step: number = 1;
initalStep: number = 1;
// get step() { // get step() {
// var s = ((this.value.range.max - this.value.range.min) / (this.lines + 1)); // var s = ((this.value.range.max - this.value.range.min) / (this.lines + 1));
// var m = Math.pow(10, this.decimal); // var m = Math.pow(10, this.decimal);
@@ -46,44 +47,45 @@ export default class Slider extends Vue {
// }; // };
mounted() { mounted() {
this.step = 1 / Math.pow(10, this.value.numDec); this.initalStep = 1 / Math.pow(10, this.value.numDec);
this.step = this.initalStep;
if (Number.isNaN(this.step)) this.step = 1; if (Number.isNaN(this.step)) this.step = 1;
} }
startIncrement() { startIncrement() {
if (!this.value.status.enabled) return; if (!this.value.status.enabled) return;
this.incrementValue(); this.incrementValue();
this.incrementing = setInterval(this.incrementValue, 50); this.incrementing = setInterval(this.incrementValue, 100);
} }
startDecrement() { startDecrement() {
if (!this.value.status.enabled) return; if (!this.value.status.enabled) return;
this.decrementValue(); this.decrementValue();
this.incrementing = setInterval(this.decrementValue, 50); this.incrementing = setInterval(this.decrementValue, 100);
} }
decrementValue(){ decrementValue(){
var v = this.value.setpointHMI; var v = this.value.setpointHMI;
if (v < this.value.range.max) { if (v < this.value.range.max) {
v += Math.floor(this.step); v -= this.step;
this.step += this.incrementingStep; this.step += this.incrementingStep * this.initalStep;
} }
if (v > this.value.range.max) { if (v > this.value.range.max) {
v = this.value.range.max; v = this.value.range.max;
} }
this.actualvalue = v; this.actualvalue = parseFloat(v.toFixed(this.value.numDec));
} }
incrementValue(){ incrementValue(){
var v = this.value.setpointHMI; var v = this.value.setpointHMI;
if (v < this.value.range.max) { if (v < this.value.range.max) {
v += Math.floor(this.step); v += this.step;
this.step += this.incrementingStep; this.step += this.incrementingStep * this.initalStep;
} }
if (v > this.value.range.max) { if (v > this.value.range.max) {
v = this.value.range.max; v = this.value.range.max;
} }
this.actualvalue = v; this.actualvalue = parseFloat(v.toFixed(this.value.numDec));
} }
confirm() { confirm() {
@@ -92,7 +94,7 @@ export default class Slider extends Vue {
clearInterval(this.incrementing); clearInterval(this.incrementing);
this.incrementing = 0; this.incrementing = 0;
this.step = 1; this.step = this.initalStep;
}; };
@@ -20,9 +20,9 @@
<span v-for="iter in lines" :key="iter" class="line"></span> <span v-for="iter in lines" :key="iter" class="line"></span>
</div> </div>
<div class="labels"> <div class="labels">
<small>{{`${this.value.range.min} ${this.value.unitMeasure}`}}</small> <small>{{`${this.value.range.min.toFixed(this.value.numDec)} ${this.value.unitMeasure}`}}</small>
<small>{{`${(this.value.range.max - this.value.range.min) / 2 + this.value.range.min} ${this.value.unitMeasure}`}}</small> <small>{{`${((this.value.range.max - this.value.range.min) / 2 + this.value.range.min).toFixed(this.value.numDec)} ${this.value.unitMeasure}`}}</small>
<small>{{`${this.value.range.max} ${this.value.unitMeasure}`}}</small> <small>{{`${this.value.range.max.toFixed(this.value.numDec)} ${this.value.unitMeasure}`}}</small>
</div> </div>
</div> </div>
<button class="btn btn-info square" <button class="btn btn-info square"